Skip to content

Commit

Permalink
update e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Dec 2, 2024
1 parent c64ee8b commit e691135
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 3 additions & 1 deletion test/e2e/specs/site-editor/browser-history.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ test.describe( 'Site editor browser history', () => {

// Navigate to a single template
await page.click( 'role=button[name="Templates"]' );
await page.getByRole( 'link', { name: 'Index' } ).click();
await page
.locator( '.fields-title-field', { hasText: 'Index' } )
.click();
await expect( page ).toHaveURL(
'/wp-admin/site-editor.php?p=%2Fwp_template%2Femptytheme%2F%2Findex&canvas=edit'
);
Expand Down
12 changes: 2 additions & 10 deletions test/e2e/specs/site-editor/new-templates-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ test.describe( 'Templates', () => {
page.locator( '[aria-label="Templates"]' )
).toBeVisible();

const firstTitle = page
.getByRole( 'region', {
name: 'Template',
includeHidden: true,
} )
.getByRole( 'link', { includeHidden: true } )
.first();
const firstTitle = page.locator( '.fields-title-field' ).first();

// Descending by title.
await page.getByRole( 'button', { name: 'View options' } ).click();
Expand All @@ -54,9 +48,7 @@ test.describe( 'Templates', () => {
await admin.visitSiteEditor( { postType: 'wp_template' } );
// Global search.
await page.getByRole( 'searchbox', { name: 'Search' } ).fill( 'tag' );
const titles = page
.getByRole( 'region', { name: 'Template' } )
.getByRole( 'link', { includeHidden: true } );
const titles = page.locator( '.fields-title-field' );
await expect( titles ).toHaveCount( 1 );
await expect( titles.first() ).toHaveText( 'Tag Archives' );
await page
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/site-editor/template-registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ test.describe( 'Block template registration', () => {
.getByLabel( 'Dismiss this notice' )
.getByText( `"Author: Admin" reset.` );
await page.getByPlaceholder( 'Search' ).fill( 'Author: admin' );
await page.getByRole( 'link', { name: 'Author: Admin' } ).click();
await page.getByRole( 'button', { name: 'Author: Admin' } ).click();

Check failure on line 322 in test/e2e/specs/site-editor/template-registration.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 6

[chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins

1) [chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins Error: locator.click: Error: strict mode violation: getByRole('button', { name: 'Author: Admin' }) resolved to 3 elements: 1) <div tabindex="0" role="button" class="dataviews-view-grid__media dataviews-view-grid__media--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).first() 2) <button type="button" aria-label="Author: admin" class="page-templates-preview-field__button">…</button> aka getByLabel('Author: admin', { exact: true }) 3) <div tabindex="0" role="button" class="dataviews-view-grid__primary-field dataviews-view-grid__primary-field--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).nth(2) Call log: - waiting for getByRole('button', { name: 'Author: Admin' }) 320 | .getByText( `"Author: Admin" reset.` ); 321 | await page.getByPlaceholder( 'Search' ).fill( 'Author: admin' ); > 322 | await page.getByRole( 'button', { name: 'Author: Admin' } ).click(); | ^ 323 | const actions = page.getByLabel( 'Actions' ); 324 | await actions.first().click(); 325 | await page.getByRole( 'menuitem', { name: 'Reset' } ).click(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-registration.spec.js:322:63

Check failure on line 322 in test/e2e/specs/site-editor/template-registration.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 6

[chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins

1) [chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Error: strict mode violation: getByRole('button', { name: 'Author: Admin' }) resolved to 3 elements: 1) <div tabindex="0" role="button" class="dataviews-view-grid__media dataviews-view-grid__media--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).first() 2) <button type="button" aria-label="Author: admin" class="page-templates-preview-field__button">…</button> aka getByLabel('Author: admin', { exact: true }) 3) <div tabindex="0" role="button" class="dataviews-view-grid__primary-field dataviews-view-grid__primary-field--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).nth(2) Call log: - waiting for getByRole('button', { name: 'Author: Admin' }) 320 | .getByText( `"Author: Admin" reset.` ); 321 | await page.getByPlaceholder( 'Search' ).fill( 'Author: admin' ); > 322 | await page.getByRole( 'button', { name: 'Author: Admin' } ).click(); | ^ 323 | const actions = page.getByLabel( 'Actions' ); 324 | await actions.first().click(); 325 | await page.getByRole( 'menuitem', { name: 'Reset' } ).click(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-registration.spec.js:322:63

Check failure on line 322 in test/e2e/specs/site-editor/template-registration.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 6

[chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins

1) [chromium] › site-editor/template-registration.spec.js:264:2 › Block template registration › user-customized templates cannot be overridden by plugins Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Error: strict mode violation: getByRole('button', { name: 'Author: Admin' }) resolved to 3 elements: 1) <div tabindex="0" role="button" class="dataviews-view-grid__media dataviews-view-grid__media--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).first() 2) <button type="button" aria-label="Author: admin" class="page-templates-preview-field__button">…</button> aka getByLabel('Author: admin', { exact: true }) 3) <div tabindex="0" role="button" class="dataviews-view-grid__primary-field dataviews-view-grid__primary-field--clickable">…</div> aka getByRole('button', { name: 'Author: admin' }).nth(2) Call log: - waiting for getByRole('button', { name: 'Author: Admin' }) 320 | .getByText( `"Author: Admin" reset.` ); 321 | await page.getByPlaceholder( 'Search' ).fill( 'Author: admin' ); > 322 | await page.getByRole( 'button', { name: 'Author: Admin' } ).click(); | ^ 323 | const actions = page.getByLabel( 'Actions' ); 324 | await actions.first().click(); 325 | await page.getByRole( 'menuitem', { name: 'Reset' } ).click(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-registration.spec.js:322:63
const actions = page.getByLabel( 'Actions' );
await actions.first().click();
await page.getByRole( 'menuitem', { name: 'Reset' } ).click();
Expand Down

0 comments on commit e691135

Please sign in to comment.