Try and make the seamless pagination test more robust (wait for Synapse to settle)

Previously was seeing some failures like this locally
```
  1 failing

  1) matrix-viewer
       Matrix Viewer
         Room directory
           pagination is seamless:

      AssertionError [ERR_ASSERTION]: Make sure we saw all visible rooms paginating through the directory
      + expected - actual

         "planet-1689366398300-room-29"
         "planet-1689366398300-room-31"
         "planet-1689366398300-room-32"
         "planet-1689366398300-room-34"
      -  "planet-1689366398300-room-34"
         "planet-1689366398300-room-35"
         "planet-1689366398300-room-37"
         "planet-1689366398300-room-38"
         "planet-1689366398300-room-4"

      at Context.<anonymous> (test/e2e-tests.js:2835:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
```
This commit is contained in:
Eric Eastwood 2023-07-14 15:53:38 -05:00
parent 5d444d5044
commit 19f3d2c897
1 changed files with 11 additions and 3 deletions

View File

@ -2735,10 +2735,13 @@ describe('matrix-viewer', () => {
// doing them serially and the room directory doesn't return the rooms in any // doing them serially and the room directory doesn't return the rooms in any
// particular order so it doesn't make the test any more clear doing them // particular order so it doesn't make the test any more clear doing them
// serially anyway. // serially anyway.
let lastCreatedRoomId;
const createdRoomsIds = await Promise.all( const createdRoomsIds = await Promise.all(
roomsConfigurationsToCreate.map((roomCreateOptions) => roomsConfigurationsToCreate.map(async (roomCreateOptions) => {
createTestRoom(client, roomCreateOptions) const roomId = await createTestRoom(client, roomCreateOptions);
) lastCreatedRoomId = roomId;
return roomId;
})
); );
function roomIdToRoomName(expectedRoomId) { function roomIdToRoomName(expectedRoomId) {
@ -2822,6 +2825,11 @@ describe('matrix-viewer', () => {
client, client,
searchTerm: visibleRoomConfigurations[visibleRoomConfigurations.length - 1].name, searchTerm: visibleRoomConfigurations[visibleRoomConfigurations.length - 1].name,
}); });
// Also check for the room that we last saw created as an extra measure
await waitForResultsInHomeserverRoomDirectory({
client,
searchTerm: roomIdToRoomName(lastCreatedRoomId),
});
// Visit a sequence of pages using the pagination links: 1 -> 2 -> 3 -> 2 -> 1 // Visit a sequence of pages using the pagination links: 1 -> 2 -> 3 -> 2 -> 1
const firstPage = await checkRoomsOnPage(testUrl); const firstPage = await checkRoomsOnPage(testUrl);