Skip to content

chore(playwright): Wait for server response before checking sorting result#62032

Merged
DerDreschner merged 1 commit into
masterfrom
fix/race-condition-on-sort
Jul 15, 2026
Merged

chore(playwright): Wait for server response before checking sorting result#62032
DerDreschner merged 1 commit into
masterfrom
fix/race-condition-on-sort

Conversation

@DerDreschner

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a race condition that affects the playwright tests under high load on the CI runners. In case the race condition occurs, the tests fail with the following message:

Notice:   1 failed
    [chrome] › tests/playwright/e2e/files/files-sorting.spec.ts:138:2 › Files: Sorting the file list › Sorting works after switching view twice 
  43 passed (10.8m)

  1) [chrome] › tests/playwright/e2e/files/files-sorting.spec.ts:138:2 › Files: Sorting the file list › Sorting works after switching view twice 

    Error: expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 3

      Array [
        "folder",
    -   "1 tiny.txt",
    -   "welcome.txt",
    -   "a medium.txt",
        "z big.txt",
    +   "a medium.txt",
    +   "welcome.txt",
    +   "1 tiny.txt",
      ]

    Call Log:
    - Timeout 15000ms exceeded while waiting on the predicate

      158 | 		await filesListPage.sortByColumn('Size')
      159 | 		await expect(filesListPage.getColumnHeader('Size')).toHaveAttribute('aria-sort', 'ascending')
    > 160 | 		await expect.poll(() => filesListPage.getRowNames()).toEqual([
          | 		                                                     ^
      161 | 			'folder',
      162 | 			'1 tiny.txt',
      163 | 			'welcome.txt',
        at /home/runner/actions-runner/_work/server/server/tests/playwright/e2e/files/files-sorting.spec.ts:160:56

    Error Context: test-results/files-files-sorting-Files--46f65--after-switching-view-twice-chrome/error-context.md

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@DerDreschner DerDreschner requested review from a team and skjnldsv as code owners July 13, 2026 01:11
@DerDreschner DerDreschner added bug 3. to review Waiting for reviews labels Jul 13, 2026
@DerDreschner DerDreschner requested review from nfebe and removed request for a team July 13, 2026 01:11
@DerDreschner DerDreschner requested a review from sorbaugh July 13, 2026 01:11
@DerDreschner DerDreschner added the tests Related to tests label Jul 13, 2026
Comment thread apps/files/src/store/viewConfig.ts Outdated

@susnux susnux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pre-emit the event before the actual update you must handle the error case where the update failed and revert the config update.

@susnux

susnux commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a race condition that affects the playwright tests under high load on the CI runners.

If its only about the tests then make them wait for the PUT before continue. Should be an easy wait for response call.

@DerDreschner DerDreschner force-pushed the fix/race-condition-on-sort branch from d047fc2 to b44954d Compare July 14, 2026 09:49
@DerDreschner DerDreschner changed the title fix(store): Prevent out-of-order server responses to mess up the folder listing chore(playwright): Wait for server response before checking sorting result Jul 14, 2026
@DerDreschner DerDreschner force-pushed the fix/race-condition-on-sort branch from b44954d to 5bb6eb5 Compare July 14, 2026 09:54
@DerDreschner

DerDreschner commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@susnux: I've changed the PR. I now wait for the response of the server in the test itself. I realized this is the best thing to do even if we would implement some kind of optimistic update here.

If its only about the tests then make them wait for the PUT before continue. Should be an easy wait for response call.

It kinda is, kinda not. You can trigger the race condition with slow servers and multiple clicks as well as only the last server response is the state being shown. Not the last thing the user did. But we don't have an optimistic UI approach here, so, I think it's the right thing to do. Although I think that's a pretty low-hanging fruit to make the files UI feel more smooth.

@DerDreschner DerDreschner requested a review from susnux July 14, 2026 09:54
…esult

Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@DerDreschner DerDreschner force-pushed the fix/race-condition-on-sort branch from 5bb6eb5 to 672a46f Compare July 14, 2026 12:51
@DerDreschner DerDreschner enabled auto-merge July 14, 2026 14:47
@DerDreschner DerDreschner requested review from Copilot and removed request for Copilot July 15, 2026 03:21
@DerDreschner DerDreschner merged commit 9b70a65 into master Jul 15, 2026
212 of 217 checks passed
@DerDreschner DerDreschner deleted the fix/race-condition-on-sort branch July 15, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug CI tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants