diff --git a/.gitignore b/.gitignore index 7663068efc66f..6040189b8c649 100644 --- a/.gitignore +++ b/.gitignore @@ -80,4 +80,4 @@ wp-tests-config.php /docker-compose.override.yml # Visual regression test diffs -tests/e2e/specs/__image_snapshots__/__diff_output__ \ No newline at end of file +tests/visual-regression/specs/__image_snapshots__ \ No newline at end of file diff --git a/package.json b/package.json index 345dee6a1bcae..cc60328024112 100644 --- a/package.json +++ b/package.json @@ -169,6 +169,7 @@ "test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit", "test:php-composer": "node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit", "test:e2e": "node ./tests/e2e/run-tests.js", + "test:visual": "node ./tests/visual-regression/run-tests.js", "wp-packages-update": "wp-scripts packages-update" } } diff --git a/tests/e2e/config/bootstrap.js b/tests/e2e/config/bootstrap.js index a4545235261c6..83c9ada3f77b9 100644 --- a/tests/e2e/config/bootstrap.js +++ b/tests/e2e/config/bootstrap.js @@ -1,6 +1,4 @@ import { get } from 'lodash'; -import { configureToMatchImageSnapshot } from 'jest-image-snapshot'; - import { clearLocalStorage, enablePageDialogAccept, @@ -35,14 +33,6 @@ const pageEvents = []; // The Jest timeout is increased because these tests are a bit slow jest.setTimeout( PUPPETEER_TIMEOUT || 100000 ); -const toMatchImageSnapshot = configureToMatchImageSnapshot( { - dumpDiffToConsole: true, - failureThresholdType: 'percent', - failureThreshold: 3, -} ); - -// Extend Jest's "expect" with image snapshot functionality. -expect.extend( { toMatchImageSnapshot } ); /** * Adds an event listener to the page to handle additions of page event @@ -114,11 +104,7 @@ function observeConsoleLogging() { // correctly. Instead, the logic here synchronously inspects the // internal object shape of the JSHandle to find the error text. If it // cannot be found, the default text value is used instead. - text = get( - message.args(), - [ 0, '_remoteObject', 'description' ], - text - ); + text = get( message.args(), [ 0, '_remoteObject', 'description' ], text ); // Disable reason: We intentionally bubble up the console message // which, unless the test explicitly anticipates the logging via diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-media-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-media-1-snap.png deleted file mode 100644 index 84877ddfc86ae..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-media-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-user-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-user-1-snap.png deleted file mode 100644 index ac37711b75ead..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-add-new-user-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-pages-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-pages-1-snap.png deleted file mode 100644 index 91bab9e695b97..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-pages-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-posts-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-posts-1-snap.png deleted file mode 100644 index e01d165f147f5..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-posts-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-users-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-users-1-snap.png deleted file mode 100644 index 69513efeec492..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-all-users-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-available-tools-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-available-tools-1-snap.png deleted file mode 100644 index 66c2ea16f8d9a..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-available-tools-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-categories-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-categories-1-snap.png deleted file mode 100644 index d17ef12f1db4b..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-categories-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-comments-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-comments-1-snap.png deleted file mode 100644 index 7d90c84767cec..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-comments-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-discussion-settings-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-discussion-settings-1-snap.png deleted file mode 100644 index 0196137a91454..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-discussion-settings-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-erase-personal-data-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-erase-personal-data-1-snap.png deleted file mode 100644 index 71a01067b95a9..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-erase-personal-data-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-1-snap.png deleted file mode 100644 index 31119c129c20e..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-personal-data-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-personal-data-1-snap.png deleted file mode 100644 index 86ccdf50b8aa1..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-export-personal-data-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-import-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-import-1-snap.png deleted file mode 100644 index 95b7b0b3ae6a4..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-import-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-library-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-library-1-snap.png deleted file mode 100644 index 8f2e931f7957f..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-library-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-settings-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-settings-1-snap.png deleted file mode 100644 index 4b7f41b5a2d53..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-media-settings-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-menus-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-menus-1-snap.png deleted file mode 100644 index 1b915a3b31ece..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-menus-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-plugins-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-plugins-1-snap.png deleted file mode 100644 index 465d5483385a5..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-plugins-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-privacy-settings-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-privacy-settings-1-snap.png deleted file mode 100644 index cfcd4f7a79208..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-privacy-settings-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-reading-settings-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-reading-settings-1-snap.png deleted file mode 100644 index d9c15dc5e07ad..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-reading-settings-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-tags-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-tags-1-snap.png deleted file mode 100644 index f5c23dd892d08..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-tags-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-widgets-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-widgets-1-snap.png deleted file mode 100644 index 2c10f91099bd4..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-widgets-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-your-profile-1-snap.png b/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-your-profile-1-snap.png deleted file mode 100644 index be0a9d97be581..0000000000000 Binary files a/tests/e2e/specs/__image_snapshots__/visual-snapshots-test-js-admin-visual-snapshots-your-profile-1-snap.png and /dev/null differ diff --git a/tests/e2e/specs/visual-snapshots.test.js b/tests/e2e/specs/visual-snapshots.test.js deleted file mode 100644 index fbdd8b5b956b4..0000000000000 --- a/tests/e2e/specs/visual-snapshots.test.js +++ /dev/null @@ -1,186 +0,0 @@ -import { visitAdminPage } from '@wordpress/e2e-test-utils'; - -const screenshotOptions = { - fullPage: true, -} - -async function hideDynamicElements(elements) { - for (let i = 0; i < elements.length; i++) { - const elementOnPage = await page.$(elements[i]); - if (elementOnPage) { - await page.$eval(elements[i], el => { - el.style.visibility = 'hidden' - }); - } - } - await new Promise((resolve) => setTimeout(resolve, 1000)); -} - -const commonDynamicElements = [ - '#footer-upgrade', - '#wp-admin-bar-root-default', - '#toplevel_page_gutenberg', -]; - -describe('Admin Visual Snapshots', () => { - beforeAll(async () => { - await page.setViewport({ - width: 1000, - height: 750, - }); - }); - - it('All Posts', async () => { - await visitAdminPage('/edit.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Categories', async () => { - await visitAdminPage('/edit-tags.php', 'taxonomy=category'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Tags', async () => { - await visitAdminPage('/edit-tags.php', 'taxonomy=post_tag'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Media Library', async () => { - await visitAdminPage('/upload.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Add New Media', async () => { - await visitAdminPage('/media-new.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('All Pages', async () => { - await visitAdminPage('/edit.php', 'post_type=page'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Comments', async () => { - await visitAdminPage('/edit-comments.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Widgets', async () => { - await visitAdminPage('/widgets.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Menus', async () => { - await visitAdminPage('/nav-menus.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Plugins', async () => { - await visitAdminPage('/plugins.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('All Users', async () => { - await visitAdminPage('/users.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Add New User', async () => { - await visitAdminPage('/user-new.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Your Profile', async () => { - await visitAdminPage('/profile.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Available Tools', async () => { - await visitAdminPage('/tools.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Import', async () => { - await visitAdminPage('/import.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Export', async () => { - await visitAdminPage('/export.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Export Personal Data', async () => { - await visitAdminPage('/export-personal-data.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Erase Personal Data', async () => { - await visitAdminPage('/erase-personal-data.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Reading Settings', async () => { - await visitAdminPage('/options-reading.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Discussion Settings', async () => { - await visitAdminPage('/options-discussion.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Media Settings', async () => { - await visitAdminPage('/options-media.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); - - it('Privacy Settings', async () => { - await visitAdminPage('/options-privacy.php'); - await hideDynamicElements(commonDynamicElements); - const image = await page.screenshot(screenshotOptions); - expect(image).toMatchImageSnapshot(); - }); -}); \ No newline at end of file diff --git a/tests/visual-regression/config/bootstrap.js b/tests/visual-regression/config/bootstrap.js new file mode 100644 index 0000000000000..49f19881b5f48 --- /dev/null +++ b/tests/visual-regression/config/bootstrap.js @@ -0,0 +1,8 @@ +import { configureToMatchImageSnapshot } from 'jest-image-snapshot'; + +const toMatchImageSnapshot = configureToMatchImageSnapshot( { + failureThreshold: 1, +} ); + +// Extend Jest's "expect" with image snapshot functionality. +expect.extend( { toMatchImageSnapshot } ); diff --git a/tests/visual-regression/jest.config.js b/tests/visual-regression/jest.config.js new file mode 100644 index 0000000000000..aa5d3d1fbd0fb --- /dev/null +++ b/tests/visual-regression/jest.config.js @@ -0,0 +1,8 @@ +const config = require( '@wordpress/scripts/config/jest-e2e.config' ); + +const jestVisualRegressionConfig = { + ...config, + setupFilesAfterEnv: [ '/config/bootstrap.js' ], +}; + +module.exports = jestVisualRegressionConfig; diff --git a/tests/visual-regression/run-tests.js b/tests/visual-regression/run-tests.js new file mode 100644 index 0000000000000..99ec86687d631 --- /dev/null +++ b/tests/visual-regression/run-tests.js @@ -0,0 +1,21 @@ +const dotenv = require( 'dotenv' ); +const dotenv_expand = require( 'dotenv-expand' ); +const { sync: spawn } = require( 'cross-spawn' ); +const { execSync } = require( 'child_process' ); + +// WP_BASE_URL interpolates LOCAL_PORT, so needs to be parsed by dotenv_expand(). +dotenv_expand( dotenv.config() ); + +const result = spawn( 'node', [ require.resolve( 'puppeteer/install' ) ], { + stdio: 'inherit', +} ); +if ( result.status > 0 ) { + process.exit( result.status ); +} + +// Run the tests, passing additional arguments through to the test script. +execSync( + 'wp-scripts test-e2e --config tests/visual-regression/jest.config.js ' + + process.argv.slice( 2 ).join( ' ' ), + { stdio: 'inherit' } +); diff --git a/tests/visual-regression/specs/visual-snapshots.test.js b/tests/visual-regression/specs/visual-snapshots.test.js new file mode 100644 index 0000000000000..a47077da47391 --- /dev/null +++ b/tests/visual-regression/specs/visual-snapshots.test.js @@ -0,0 +1,189 @@ +import { visitAdminPage } from '@wordpress/e2e-test-utils'; + +const screenshotOptions = { + fullPage: true, +}; + +async function hideDynamicElements( elements ) { + for ( let i = 0; i < elements.length; i++ ) { + const elementOnPage = await page.$( elements[ i ] ); + if ( elementOnPage ) { + await page.$eval( elements[ i ], ( el ) => { + el.style.visibility = 'hidden'; + } ); + } + } + await new Promise( ( resolve ) => setTimeout( resolve, 1000 ) ); +} + +const commonDynamicElements = [ + '#footer-upgrade', + '#wp-admin-bar-root-default', + '#toplevel_page_gutenberg', +]; + +describe( 'Admin Visual Snapshots', () => { + beforeAll( async () => { + await page.setViewport( { + width: 1000, + height: 750, + } ); + } ); + + it( 'All Posts', async () => { + await visitAdminPage( '/edit.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Categories', async () => { + await visitAdminPage( '/edit-tags.php', 'taxonomy=category' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Tags', async () => { + await visitAdminPage( '/edit-tags.php', 'taxonomy=post_tag' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Media Library', async () => { + await visitAdminPage( '/upload.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Add New Media', async () => { + await visitAdminPage( '/media-new.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'All Pages', async () => { + await visitAdminPage( '/edit.php', 'post_type=page' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Comments', async () => { + await visitAdminPage( '/edit-comments.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Widgets', async () => { + await visitAdminPage( '/widgets.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Menus', async () => { + await visitAdminPage( '/nav-menus.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Plugins', async () => { + await visitAdminPage( '/plugins.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'All Users', async () => { + await visitAdminPage( '/users.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Add New User', async () => { + await visitAdminPage( '/user-new.php' ); + await hideDynamicElements( [ + ...commonDynamicElements, + '.password-input-wrapper', + ] ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Your Profile', async () => { + await visitAdminPage( '/profile.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Available Tools', async () => { + await visitAdminPage( '/tools.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Import', async () => { + await visitAdminPage( '/import.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Export', async () => { + await visitAdminPage( '/export.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Export Personal Data', async () => { + await visitAdminPage( '/export-personal-data.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Erase Personal Data', async () => { + await visitAdminPage( '/erase-personal-data.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Reading Settings', async () => { + await visitAdminPage( '/options-reading.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Discussion Settings', async () => { + await visitAdminPage( '/options-discussion.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Media Settings', async () => { + await visitAdminPage( '/options-media.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); + + it( 'Privacy Settings', async () => { + await visitAdminPage( '/options-privacy.php' ); + await hideDynamicElements( commonDynamicElements ); + const image = await page.screenshot( screenshotOptions ); + expect( image ).toMatchImageSnapshot(); + } ); +} );