-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
test/e2e/specs/site-editor/site-editor-dark-background.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Site editor with dark background theme', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'darktheme' ); | ||
} ); | ||
|
||
test.beforeEach( async ( { admin } ) => { | ||
await admin.visitSiteEditor(); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test.describe( 'Site editor iframe body', () => { | ||
test( 'Should have the is-dark-theme CSS class', async ( { | ||
editor, | ||
} ) => { | ||
const canvasBody = editor.canvas.locator( 'body' ); | ||
|
||
await expect( canvasBody ).toHaveClass( /is-dark-theme/ ); | ||
} ); | ||
} ); | ||
} ); | ||
|
||
test.describe( 'Site editor with light background theme and theme variations', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyfour' ); | ||
} ); | ||
|
||
test.beforeEach( async ( { admin } ) => { | ||
await admin.visitSiteEditor(); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test.describe( 'Site editor iframe body', () => { | ||
test( 'Should not have the is-dark-theme CSS class', async ( { | ||
editor, | ||
} ) => { | ||
const canvasBody = editor.canvas.locator( 'body' ); | ||
|
||
await expect( canvasBody ).not.toHaveClass( /is-dark-theme/ ); | ||
} ); | ||
|
||
test( 'Should add and remove the is-dark-theme CSS class with dark and light theme variation', async ( { | ||
page, | ||
editor, | ||
} ) => { | ||
// Click "Styles" | ||
await page.getByRole( 'button', { name: 'Styles' } ).click(); | ||
|
||
// Click "Browse styles" | ||
await page.getByRole( 'button', { name: 'Browse styles' } ).click(); | ||
|
||
const canvasBody = editor.canvas.locator( 'body' ); | ||
|
||
// Activate "Maelstrom" Theme Variation. | ||
await page.getByRole( 'button', { name: 'Maelstrom' } ).click(); | ||
|
||
await expect( canvasBody ).toHaveClass( /is-dark-theme/ ); | ||
|
||
// Activate "Ember" Theme Variation. | ||
await page.getByRole( 'button', { name: 'Ember' } ).click(); | ||
|
||
await expect( canvasBody ).not.toHaveClass( /is-dark-theme/ ); | ||
} ); | ||
} ); | ||
} ); |