Skip to content

Commit

Permalink
Use new siteEditor object
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 committed Jan 26, 2021
1 parent 3afdc04 commit 50d660b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 39 deletions.
18 changes: 4 additions & 14 deletions packages/e2e-tests/specs/experiments/multi-entity-editing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,17 @@
*/
import {
insertBlock,
visitAdminPage,
createNewPost,
publishPost,
trashAllPosts,
activateTheme,
canvas,
} from '@wordpress/e2e-test-utils';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
import { navigationPanel } from '../../experimental-features';

const visitSiteEditor = async () => {
const query = addQueryArgs( '', {
page: 'gutenberg-edit-site',
} ).slice( 1 );
await visitAdminPage( 'admin.php', query );
await page.waitForSelector( '.edit-site-visual-editor iframe' );
};
import { navigationPanel, siteEditor } from '../../experimental-features';

const clickTemplateItem = async ( menus, itemName ) => {
await navigationPanel.open();
Expand Down Expand Up @@ -138,12 +128,12 @@ describe( 'Multi-entity editor states', () => {
} );

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

it( 'should not dirty an entity by switching to it in the template dropdown', async () => {
await visitSiteEditor();
await siteEditor.visit();
await clickTemplateItem( 'Template Parts', 'header' );
await page.waitForFunction( () =>
Array.from( window.frames ).find(
Expand Down Expand Up @@ -194,7 +184,7 @@ describe( 'Multi-entity editor states', () => {
true
);
await saveAllEntities();
await visitSiteEditor();
await siteEditor.visit();

// Wait for site editor to load.
await canvas().waitForSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import {
createNewPost,
insertBlock,
publishPost,
visitAdminPage,
trashAllPosts,
activateTheme,
canvas,
} from '@wordpress/e2e-test-utils';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
import { navigationPanel } from '../../experimental-features';
import { navigationPanel, siteEditor } from '../../experimental-features';

describe( 'Multi-entity save flow', () => {
// Selectors - usable between Post/Site editors.
Expand Down Expand Up @@ -186,10 +184,7 @@ describe( 'Multi-entity save flow', () => {

it( 'Save flow should work as expected', async () => {
// Navigate to site editor.
const query = addQueryArgs( '', {
page: 'gutenberg-edit-site',
} ).slice( 1 );
await visitAdminPage( 'admin.php', query );
await siteEditor.visit();

// Ensure we are on 'front-page' demo template.
await navigationPanel.open();
Expand Down
12 changes: 2 additions & 10 deletions packages/e2e-tests/specs/experiments/template-part.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ import {
createNewPost,
insertBlock,
disablePrePublishChecks,
visitAdminPage,
trashAllPosts,
activateTheme,
getAllBlocks,
selectBlockByClientId,
clickBlockToolbarButton,
canvas,
} from '@wordpress/e2e-test-utils';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
import { navigationPanel } from '../../experimental-features';
import { navigationPanel, siteEditor } from '../../experimental-features';

describe( 'Template Part', () => {
beforeAll( async () => {
Expand All @@ -34,13 +32,7 @@ describe( 'Template Part', () => {

describe( 'Template part block', () => {
beforeEach( async () => {
await visitAdminPage(
'admin.php',
addQueryArgs( '', {
page: 'gutenberg-edit-site',
} ).slice( 1 )
);
await page.waitForSelector( '.edit-site-visual-editor iframe' );
await siteEditor.visit();
} );

async function updateHeader( content ) {
Expand Down
14 changes: 6 additions & 8 deletions packages/e2e-tests/specs/performance/site-editor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import { writeFileSync } from 'fs';
*/
import {
trashAllPosts,
visitAdminPage,
activateTheme,
canvas,
} from '@wordpress/e2e-test-utils';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
import { siteEditor } from '../../experimental-features';

jest.setTimeout( 1000000 );

Expand All @@ -39,12 +42,7 @@ describe( 'Site Editor Performance', () => {
inserterHover: [],
};

await visitAdminPage(
'admin.php',
addQueryArgs( '', {
page: 'gutenberg-edit-site',
} ).slice( 1 )
);
await siteEditor.visit();

let i = 3;

Expand Down

0 comments on commit 50d660b

Please sign in to comment.