Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Nov 6, 2021
1 parent b28e8cc commit 8be664f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/e2e-tests/experimental-features.js
Expand Up @@ -157,4 +157,17 @@ export const siteEditor = {
return '';
} );
},

async disableWelcomeGuide() {
const isWelcomeGuideActive = await page.evaluate( () =>
wp.data.select( 'core/edit-site' ).isFeatureActive( 'welcomeGuide' )
);
if ( isWelcomeGuideActive ) {
await page.evaluate( () =>
wp.data
.dispatch( 'core/edit-site' )
.toggleFeature( 'welcomeGuide' )
);
}
},
};
Expand Up @@ -36,6 +36,7 @@ describe( 'Document Settings', () => {

beforeEach( async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
} );

describe( 'when a template is selected from the navigation sidebar', () => {
Expand Down
Expand Up @@ -145,6 +145,7 @@ describe( 'Multi-entity editor states', () => {

it( 'should not display any dirty entities when loading the site editor', async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
expect( await openEntitySavePanel() ).toBe( false );
} );

Expand Down Expand Up @@ -204,6 +205,7 @@ describe( 'Multi-entity editor states', () => {
);
await saveAllEntities();
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();

// Wait for site editor to load.
await canvas().waitForSelector(
Expand Down
Expand Up @@ -53,6 +53,7 @@ describe( 'Settings sidebar', () => {
} );
beforeEach( async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
} );

describe( 'Template tab', () => {
Expand Down
Expand Up @@ -41,6 +41,7 @@ describe( 'Site Editor Templates Export', () => {

beforeEach( async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
} );

it( 'clicking export should download edit-site-export.zip file', async () => {
Expand Down
Expand Up @@ -19,6 +19,7 @@ describe( 'Site Editor Inserter', () => {
} );
beforeEach( async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
} );

it( 'inserter toggle button should toggle global inserter', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/e2e-tests/specs/experiments/template-part.test.js
Expand Up @@ -36,6 +36,7 @@ describe( 'Template Part', () => {
describe( 'Template part block', () => {
beforeEach( async () => {
await siteEditor.visit();
await siteEditor.disableWelcomeGuide();
} );

async function navigateToHeader() {
Expand Down
7 changes: 6 additions & 1 deletion packages/e2e-tests/specs/experiments/template-revert.test.js
Expand Up @@ -16,7 +16,11 @@ import { addQueryArgs } from '@wordpress/url';
*/
import { siteEditor } from '../../experimental-features';

const { visit: visitSiteEditor, getEditedPostContent } = siteEditor;
const {
visit: visitSiteEditor,
getEditedPostContent,
disableWelcomeGuide,
} = siteEditor;

const assertSaveButtonIsDisabled = () =>
page.waitForSelector(
Expand Down Expand Up @@ -97,6 +101,7 @@ describe( 'Template Revert', () => {
beforeEach( async () => {
await trashAllPosts( 'wp_template' );
await visitSiteEditor();
await disableWelcomeGuide();
} );

it( 'should delete the template after saving the reverted template', async () => {
Expand Down

0 comments on commit 8be664f

Please sign in to comment.