-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
E2E: Ensure SE canvas loader appears before waiting for it to disappear #61629
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,32 @@ export async function visitSiteEditor( | |
query.set( 'canvas', canvas ); | ||
} | ||
|
||
const canvasLoader = this.page.locator( | ||
// Spinner was used instead of the progress bar in an earlier version of | ||
// the site editor. | ||
'.edit-site-canvas-loader, .edit-site-canvas-spinner' | ||
); | ||
|
||
await this.visitAdminPage( 'site-editor.php', query.toString() ); | ||
|
||
// Try waiting for the canvas loader to appear first, so that the locator | ||
// that waits for it to disappear doesn't resolve prematurely. | ||
await canvasLoader.waitFor().catch( () => {} ); | ||
|
||
/** | ||
* @todo This is a workaround for the fact that the editor canvas is seen as | ||
* ready and visible before the loading spinner is hidden. Ideally, the | ||
* content underneath the loading overlay should be marked inert until the | ||
* loading is done. | ||
*/ | ||
await canvasLoader.waitFor( { | ||
state: 'hidden', | ||
// Bigger timeout is needed for larger entities, like the Large Post | ||
// HTML fixture that we load for performance tests, which often doesn't | ||
// make it under the default timeout value. | ||
timeout: 60_000, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is called a numeric separator that helps readability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lol, how is this the first time I hear about this after all these years 🫠 |
||
} ); | ||
|
||
if ( ! options.showWelcomeGuide ) { | ||
await this.editor.setPreferences( 'core/edit-site', { | ||
welcomeGuide: false, | ||
|
@@ -47,19 +71,4 @@ export async function visitSiteEditor( | |
welcomeGuideTemplate: false, | ||
} ); | ||
} | ||
|
||
/** | ||
* @todo This is a workaround for the fact that the editor canvas is seen as | ||
* ready and visible before the loading spinner is hidden. Ideally, the | ||
* content underneath the loading overlay should be marked inert until the | ||
* loading is done. | ||
*/ | ||
await this.page | ||
// Spinner was used instead of the progress bar in an earlier version of | ||
// the site editor. | ||
.locator( '.edit-site-canvas-loader, .edit-site-canvas-spinner' ) | ||
// Bigger timeout is needed for larger entities, for example the large | ||
// post html fixture that we load for performance tests, which often | ||
// doesn't make it under the default 10 seconds. | ||
.waitFor( { state: 'hidden', timeout: 60_000 } ); | ||
} |
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.
What's the error we're expecting to catch here?
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.
In an unlikely case where the loader has already disappeared by the time we get to this line, it shouldn't fail the test – the action should continue executing. TBH, it hasn't happened to me so far, but it is possible so I think it's worth having this extra precaution as it doesn't really hurt us. Does that make sense?
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.
Makes sense
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.
@ellatrix, I think this line is the cause of regression. Now, each Site Editor > Navigation test takes around 2 minutes to run locally, instead of 5 seconds when I comment out this line. Running the tests in UI Mode gives a better breakdown of locator timers.
@WunderBart, I also realized that the util expects every site editor page it visits to have a
canvasLoader
, which isn't true. The DataView routes have no loaders for the moment.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.
For reference: #61816