Skip to content

Commit

Permalink
Try and make the seamless pagination test more robust (wait for Synap…
Browse files Browse the repository at this point in the history
…se to settle) (#281)

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)
```
  • Loading branch information
MadLittleMods authored Jul 14, 2023
1 parent 5d444d5 commit f91b8f0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2735,10 +2735,13 @@ describe('matrix-viewer', () => {
// 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
// serially anyway.
let lastCreatedRoomId;
const createdRoomsIds = await Promise.all(
roomsConfigurationsToCreate.map((roomCreateOptions) =>
createTestRoom(client, roomCreateOptions)
)
roomsConfigurationsToCreate.map(async (roomCreateOptions) => {
const roomId = await createTestRoom(client, roomCreateOptions);
lastCreatedRoomId = roomId;
return roomId;
})
);

function roomIdToRoomName(expectedRoomId) {
Expand Down Expand Up @@ -2822,6 +2825,11 @@ describe('matrix-viewer', () => {
client,
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
const firstPage = await checkRoomsOnPage(testUrl);
Expand Down

0 comments on commit f91b8f0

Please sign in to comment.