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 tests #57443

Closed
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.

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

test.describe( 'preferences', () => {
test( 'remembers sidebar dismissal between sessions', async ( {
page,
admin,
editor,
} ) => {
const post = 'role=button[name="Post (selected)"i]';
await admin.createNewPost();
await editor.openDocumentSettingsSidebar();

// Open by default.
await expect( page.locator( post ) ).toHaveText( 'Post' );

Check failure on line 17 in test/e2e/specs/editor/various/preferences.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 5

[chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions

1) [chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('role=button[name="Post (selected)"i]') Expected string: "Post" Received string: "" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('role=button[name="Post (selected)"i]') 15 | 16 | // Open by default. > 17 | await expect( page.locator( post ) ).toHaveText( 'Post' ); | ^ 18 | 19 | // Change to "Block" tab. 20 | await page at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/preferences.spec.js:17:40

Check failure on line 17 in test/e2e/specs/editor/various/preferences.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 5

[chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions

1) [chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('role=button[name="Post (selected)"i]') Expected string: "Post" Received string: "" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('role=button[name="Post (selected)"i]') 15 | 16 | // Open by default. > 17 | await expect( page.locator( post ) ).toHaveText( 'Post' ); | ^ 18 | 19 | // Change to "Block" tab. 20 | await page at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/preferences.spec.js:17:40

Check failure on line 17 in test/e2e/specs/editor/various/preferences.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 5

[chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions

1) [chromium] › editor/various/preferences.spec.js:7:2 › preferences › remembers sidebar dismissal between sessions Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('role=button[name="Post (selected)"i]') Expected string: "Post" Received string: "" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('role=button[name="Post (selected)"i]') 15 | 16 | // Open by default. > 17 | await expect( page.locator( post ) ).toHaveText( 'Post' ); | ^ 18 | 19 | // Change to "Block" tab. 20 | await page at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/preferences.spec.js:17:40

// Change to "Block" tab.
await page
.getByRole( 'button', { name: 'Block', exact: true } )
.click();

await expect(
page.locator( 'role=button[name="Block (selected)"i]' )
).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( page.locator( post ) ).toHaveText( 'Post' );

// Dismiss.
await page.getByRole( 'button', { name: 'Close settings' } ).click();
await expect( page.locator( post ) ).not.toBeVisible();

// Remember after reload.
await page.reload();

await expect( page.locator( post ) ).not.toBeVisible();
} );
} );
Loading