Skip to content

Commit

Permalink
Fix failing e2e tests due to changes in post preview button class names
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Jan 8, 2024
1 parent 7423f59 commit 124af16
Show file tree
Hide file tree
Showing 10 changed files with 8,005 additions and 3 deletions.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e-failure-artifacts.zip
Binary file not shown.
2,000 changes: 2,000 additions & 0 deletions is rendered on a new post 2024-01-08T08-42-21-snapshot.html

Large diffs are not rendered by default.

Binary file added is rendered on a new post 2024-01-08T08-42-21.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,000 changes: 2,000 additions & 0 deletions is rendered when a post has content 2024-01-08T08-43-25-snapshot.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions tests/e2e/specs/block-editor/amp-preview-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import {
deactivatePlugin,
} from '../../utils/amp-settings-utils';

const postPreviewBtnSelector = '.components-button.editor-post-preview';
const postPreviewBtnSelector =
'.components-button.edit-post-header__post-preview-button';
const ampPreviewBtnSelector = `${postPreviewBtnSelector} + .amp-wrapper-post-preview > .amp-editor-post-preview`;

// Remove legacy selectors once changes of <https://github.com/WordPress/gutenberg/pull/56921> lands in WP core.
const legacyPreviewBtnSelector = '.components-button.editor-post-preview';
const legacyAmpPreviewBtnSelector = `${legacyPreviewBtnSelector} + .amp-wrapper-post-preview > .amp-editor-post-preview`;

describe('AMP Preview button', () => {
it('is rendered on a new post', async () => {
await createNewPost();
Expand All @@ -27,9 +32,9 @@ describe('AMP Preview button', () => {
await deactivatePlugin('gutenberg');

await createNewPost();
await page.waitForSelector(postPreviewBtnSelector);
await page.waitForSelector(legacyPreviewBtnSelector);

await expect(page).toMatchElement(ampPreviewBtnSelector);
await expect(page).toMatchElement(legacyAmpPreviewBtnSelector);

await activatePlugin('gutenberg');
});
Expand Down

0 comments on commit 124af16

Please sign in to comment.