Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 8, 2024
1 parent b3f5088 commit 63efe53
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function publishPost( this: Editor ) {
.getByRole( 'button', { name: 'Save', exact: true } );
const publishButton = this.page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Publish' } );
.getByRole( 'button', { name: 'Publish', exact: true } );
const buttonToClick = ( await saveButton.isVisible() )
? saveButton
: publishButton;
Expand Down
12 changes: 9 additions & 3 deletions test/e2e/specs/site-editor/block-removal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ test.describe( 'Site editor block removal prompt', () => {
} ) => {
// Open and focus List View
const topBar = page.getByRole( 'region', { name: 'Editor top bar' } );
await topBar.getByRole( 'button', { name: 'List View' } ).click();
await topBar
.getByRole( 'button', { name: 'Document Overview' } )
.click();

// Select and try to remove Query Loop block
const listView = page.getByRole( 'region', { name: 'List View' } );
Expand All @@ -45,7 +47,9 @@ test.describe( 'Site editor block removal prompt', () => {
} ) => {
// Open and focus List View
const topBar = page.getByRole( 'region', { name: 'Editor top bar' } );
await topBar.getByRole( 'button', { name: 'List View' } ).click();
await topBar
.getByRole( 'button', { name: 'Document Overview' } )
.click();

// Select and open child blocks of Query Loop block
const listView = page.getByRole( 'region', { name: 'List View' } );
Expand All @@ -70,7 +74,9 @@ test.describe( 'Site editor block removal prompt', () => {
} ) => {
// Open and focus List View
const topBar = page.getByRole( 'region', { name: 'Editor top bar' } );
await topBar.getByRole( 'button', { name: 'List View' } ).click();
await topBar
.getByRole( 'button', { name: 'Document Overview' } )
.click();

// Select Query Loop list item
const listView = page.getByRole( 'region', { name: 'List View' } );
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/site-editor/list-view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ test.describe( 'Site Editor List View', () => {

// Focus should now be on the list view toggle button.
await expect(
page.getByRole( 'button', { name: 'List View' } )
page.getByRole( 'button', { name: 'Document Overview' } )
).toBeFocused();

// Open List View.
Expand All @@ -129,7 +129,7 @@ test.describe( 'Site Editor List View', () => {
await pageUtils.pressKeys( 'access+o' );
await expect( listView ).toBeHidden();
await expect(
page.getByRole( 'button', { name: 'List View' } )
page.getByRole( 'button', { name: 'Document Overview' } )
).toBeFocused();
} );
} );
12 changes: 3 additions & 9 deletions test/e2e/specs/site-editor/style-book.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,12 @@ test.describe( 'Style Book', () => {
test( 'should disable toolbar buttons when open', async ( { page } ) => {
await expect(
page.locator( 'role=button[name="Toggle block inserter"i]' )
).toBeHidden();
).toBeDisabled();
await expect(
page.locator( 'role=button[name="Tools"i]' )
).toBeHidden();
await expect(
page.locator( 'role=button[name="Undo"i]' )
).toBeHidden();
await expect(
page.locator( 'role=button[name="Redo"i]' )
).toBeHidden();
).toBeDisabled();
await expect(
page.locator( 'role=button[name="View"i]' )
page.locator( 'role=button[name="Document Overview"i]' )
).toBeDisabled();
} );

Expand Down

0 comments on commit 63efe53

Please sign in to comment.