-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Improve mobile editor performance tests #48101
test: Improve mobile editor performance tests #48101
Conversation
Performance tests often only assert the performance of a component via `measurePerformance`. This change adds `measurePerformance` to the list of functions that are considered assertions to avoid erroneous lint warnings.
- Remove unnecessary lint warning disable line caused by erroneous placement of `screen` argument. - Query UI components via user-facing attributes, e.g. a11y label. - Pass mock function to required `onChange` prop to `RichText` component.
rules: { | ||
'jest/expect-expect': [ | ||
'error', | ||
{ assertFunctionNames: [ 'expect', 'measurePerformance' ] }, | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As referenced in the Reassure docs, this has the linter consider measurePerformance
an assertion.
It is possible there may be a better location to place this new configuration, but the test-unit
file did seem appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good call. I agree this is better than forcing the other assertions.
Size Change: 0 B Total Size: 1.31 MB ℹ️ View Unchanged
|
To avoid web test scripts from including the performance files for the native mobile editor, we must include the term "native" in the file name. This renames the test files to follow the existing pattern of not including "test" in the file name.
Flaky tests detected in 648c104. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4185834653
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you! 🚀
rules: { | ||
'jest/expect-expect': [ | ||
'error', | ||
{ assertFunctionNames: [ 'expect', 'measurePerformance' ] }, | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good call. I agree this is better than forcing the other assertions.
What?
Address test failures and lint warnings in mobile editor performance tests.
Why?
The tests should pass without lint warnings.
How?
measurePerfomrance
an assertion.RichText
performance test by leveragingscreen
to query thesubject component.
Testing Instructions
n/a
Testing Instructions for Keyboard
Screenshots or screencast
n/a