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

Migrate 'preferences' e2e tests to Playwright #57446

Merged
merged 2 commits into from
Dec 30, 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
62 changes: 0 additions & 62 deletions packages/e2e-tests/specs/editor/various/preferences.test.js

This file was deleted.

50 changes: 50 additions & 0 deletions test/e2e/specs/editor/various/preferences.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Preferences', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'remembers sidebar dismissal between sessions', async ( {
editor,
page,
} ) => {
await editor.openDocumentSettingsSidebar();

const editorSettings = page.getByRole( 'region', {
name: 'Editor settings',
} );
const activeTab = editorSettings.getByRole( 'tab', { selected: true } );

// Open by default.
await expect( activeTab ).toHaveText( 'Post' );

// Change to "Block" tab.
await editorSettings.getByRole( 'tab', { name: 'Block' } ).click();
await expect( activeTab ).toHaveText( 'Block' );

/**
* Regression test: Reload resets to document tab.
*
* See: https://github.com/WordPress/gutenberg/issues/6377
* See: https://github.com/WordPress/gutenberg/pull/8995
*/
await page.reload();
await expect( activeTab ).toHaveText( 'Post' );

// Dismiss.
await editorSettings
.getByRole( 'button', {
name: 'Close Settings',
} )
.click();
await expect( activeTab ).toBeHidden();

// Remember after reload.
await page.reload();
await expect( activeTab ).toBeHidden();
} );
} );
Loading