Skip to content
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

Enhance template registration e2e tests to handle welcome dialog visibility #68059

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion test/e2e/specs/site-editor/template-registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ test.describe( 'Block template registration', () => {
} ) => {
// Create a post.
await admin.visitAdminPage( '/post-new.php' );
michalczaplinski marked this conversation as resolved.
Show resolved Hide resolved
await page.getByLabel( 'Close', { exact: true } ).click();

// Get the dialog with aria-label "Welcome to the editor"
const welcomeDialog = page.getByLabel( 'Welcome to the editor' );

// if the dialog is visible within 2 seconds, click the Close button, otherwise continue
if ( await welcomeDialog.isVisible( { timeout: 2000 } ) ) {
await welcomeDialog.getByLabel( 'Close' ).click();
}

await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: 'User-created post.' },
Expand Down Expand Up @@ -283,6 +291,15 @@ test.describe( 'Block template registration', () => {
.click();
await page.getByRole( 'option', { name: 'admin' } ).click();
await expect( page.getByText( 'Choose a pattern' ) ).toBeVisible();

// Get the dialog with aria-label "Welcome to the editor"
const welcomeDialog = page.getByLabel( 'Welcome to the editor' );

// if the dialog is visible within 2 seconds, click the Close button, otherwise continue
if ( await welcomeDialog.isVisible( { timeout: 2000 } ) ) {
await welcomeDialog.getByLabel( 'Close' ).click();
}
michalczaplinski marked this conversation as resolved.
Show resolved Hide resolved

await page.getByLabel( 'Close', { exact: true } ).click();
await editor.insertBlock( {
name: 'core/paragraph',
Expand Down
Loading