Skip to content

Commit

Permalink
Adjust e2e tests to new configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed May 1, 2023
1 parent 2623fb5 commit b595fea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ exports[`PostSavedState returns a disabled button if the post is not saveable 1`
</button>
`;

exports[`PostSavedState returns a switch to draft link if the post is published 1`] = `
<button
class="components-button editor-post-switch-to-draft is-tertiary"
type="button"
>
Switch to draft
</button>
`;

exports[`PostSavedState should return Save button if edits to be saved 1`] = `
<button
aria-disabled="false"
Expand Down
10 changes: 0 additions & 10 deletions packages/editor/src/components/post-saved-state/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ describe( 'PostSavedState', () => {
expect( screen.getByRole( 'button' ) ).toMatchSnapshot();
} );

it( 'returns a switch to draft link if the post is published', () => {
useSelect.mockImplementation( () => ( {
isPublished: true,
} ) );

render( <PostSavedState /> );

expect( screen.getByRole( 'button' ) ).toMatchSnapshot();
} );

it( 'should return Saved text if not new and not dirty', () => {
useSelect.mockImplementation( () => ( {
isDirty: false,
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/specs/editor/various/switch-to-draft.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test.describe( 'Clicking "Switch to draft" on a published/scheduled post/page',
page,
switchToDraftUtils,
pageUtils,
editor,
} ) => {
await pageUtils.setBrowserViewport( viewport );

Expand All @@ -44,6 +45,8 @@ test.describe( 'Clicking "Switch to draft" on a published/scheduled post/page',
postStatus === 'schedule'
);

await editor.openDocumentSettingsSidebar();

await switchToDraftUtils.switchToDraftButton.click();

await page
Expand Down Expand Up @@ -100,9 +103,9 @@ class SwitchToDraftUtils {
this.#admin = admin;
this.#requestUtils = requestUtils;

this.switchToDraftButton = page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'draft' } );
this.switchToDraftButton = page.locator(
'role=button[name="Switch to draft"i]'
);
}

/**
Expand Down

0 comments on commit b595fea

Please sign in to comment.