Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant calls to disable the Styles welcome guide #50871

Merged
merged 2 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions test/e2e/specs/site-editor/style-book.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,7 @@ class StyleBook {
this.page = page;
}

async disableWelcomeGuide() {
// Turn off the welcome guide.
await this.page.evaluate( () => {
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );
} );
}

async open() {
await this.disableWelcomeGuide();
await this.page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Styles' } )
Expand Down
10 changes: 0 additions & 10 deletions test/e2e/specs/site-editor/style-variations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,7 @@ class SiteEditorStyleVariations {
this.page = page;
}

async disableWelcomeGuide() {
// Turn off the welcome guide.
await this.page.evaluate( () => {
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );
} );
}

async browseStyles() {
await this.disableWelcomeGuide();
await this.page.click( 'role=button[name="Styles"i]' );
await this.page.click( 'role=button[name="Browse styles"i]' );
}
Expand Down
26 changes: 4 additions & 22 deletions test/e2e/specs/site-editor/user-global-styles-revisions.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
/**
* WordPress dependencies
*/
const {
test,
expect,
Editor,
} = require( '@wordpress/e2e-test-utils-playwright' );
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.use( {
editor: async ( { page }, use ) => {
await use( new Editor( { page } ) );
},
Comment on lines -11 to -13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editor is available by default; there's no need for a manul setup.

userGlobalStylesRevisions: async ( { page, requestUtils }, use ) => {
await use( new UserGlobalStylesRevisions( { page, requestUtils } ) );
},
Expand All @@ -29,10 +22,9 @@ test.describe( 'Global styles revisions', () => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.visitSiteEditor( {
canvas: 'edit',
} );
test.beforeEach( async ( { admin, editor } ) => {
await admin.visitSiteEditor();
await editor.canvas.click( 'body' );
Comment on lines +25 to +27
Copy link
Member Author

@Mamaduka Mamaduka May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramonjd, I wasn't able to run tests locally without this change. However, it's a common pattern, so I don't think there's a need for a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, thanks for the heads up!

} );

test( 'should display revisions UI when there is more than 1 revision', async ( {
Expand Down Expand Up @@ -131,15 +123,6 @@ class UserGlobalStylesRevisions {
this.requestUtils = requestUtils;
}

async disableWelcomeGuide() {
// Turn off the welcome guide.
await this.page.evaluate( () => {
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );
} );
}

async getGlobalStylesRevisions() {
const stylesPostId =
await this.requestUtils.getCurrentThemeGlobalStylesPostId();
Expand All @@ -159,7 +142,6 @@ class UserGlobalStylesRevisions {
}

async openStylesPanel() {
await this.disableWelcomeGuide();
await this.page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Styles' } )
Expand Down