Chore: Increase Playwright test timeouts and reduce test flakiness #11970
Merged
laurent22 merged 3 commits intolaurent22:devfrom Mar 15, 2025
Merged
Conversation
Comment on lines
+121
to
+122
| // Work around occasional "resolved to 2 elements" errors in CI | ||
| .last(); |
Collaborator
Author
There was a problem hiding this comment.
The goal of this change is to work around the following occasional test failure:
Error: locator.waitFor: Error: strict mode violation: getByAltText('large-jpg-image-with-exif-rotation.jpg') resolved to 2 elements:
➤ YN0000: [@joplin/app-desktop]: 1) <img title="" data-from-md="" alt="large-jpg-image-with-exif-rotation.jpg" data-resource-id="3379eea703504dbfb1b949db385a0abe" src="joplin-content://note-viewer//Users/runner/work/joplin/joplin/packages/app-desktop/integration-tests/test-profile/1M2urBZZBp2RhdaiCwPMhA/resources//3379eea703504dbfb1b949db385a0abe.jpg?t=1742052371936"/> aka getByRole('img', { name: 'large-jpg-image-with-exif-' }).first()
➤ YN0000: [@joplin/app-desktop]: 2) <img title="" data-from-md="" alt="large-jpg-image-with-exif-rotation.jpg" data-resource-id="9ee801938bf84de3b1ed3210526954c3" src="joplin-content://note-viewer//Users/runner/work/joplin/joplin/packages/app-desktop/integration-tests/test-profile/1M2urBZZBp2RhdaiCwPMhA/resources//9ee801938bf84de3b1ed3210526954c3.jpg?t=1742052371811"/> aka getByRole('img', { name: 'large-jpg-image-with-exif-' }).nth(1)
➤ YN0000: [@joplin/app-desktop]:
➤ YN0000: [@joplin/app-desktop]: Call log:
➤ YN0000: [@joplin/app-desktop]: - waiting for locator('.rli-editor').locator('iframe[src$="note-viewer/index.html"]').frameLocator(':scope').getByAltText('large-jpg-image-with-exif-rotation.jpg')
➤ YN0000: [@joplin/app-desktop]:
➤ YN0000: [@joplin/app-desktop]:
➤ YN0000: [@joplin/app-desktop]: at util/getImageSourceSize.ts:6
➤ YN0000: [@joplin/app-desktop]:
➤ YN0000: [@joplin/app-desktop]: 4 | // Use state: 'attached' -- we don't need the image to be on the screen (just present
➤ YN0000: [@joplin/app-desktop]: 5 | // in the DOM).
➤ YN0000: [@joplin/app-desktop]: > 6 | await imageLocator.waitFor({ state: 'attached' });
➤ YN0000: [@joplin/app-desktop]: | ^
➤ YN0000: [@joplin/app-desktop]: 7 |
➤ YN0000: [@joplin/app-desktop]: 8 | // We load a copy of the image to avoid returning an overriden width set with
➤ YN0000: [@joplin/app-desktop]: 9 | // .width = some_number
It may also make sense to check the image attachment logic to verify that it doesn't attach images to a note twice in certain cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request attempts to address recent Playwright-related test failures in CI (and locally) by increasing test timeouts.
Possible future work
At present, each test runs Joplin's database migrations to create a new profile. Creating a test profile once, then re-using a copy of it for all tests could improve test performance.