Skip to content

Commit

Permalink
Replace autoptimize with akismet for E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Nov 30, 2021
1 parent bd3de18 commit b69d826
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions tests/e2e/specs/admin/site-scan-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe( 'AMP settings screen Site Scan panel', () => {

beforeAll( async () => {
await installTheme( 'hestia' );
await installPlugin( 'autoptimize' );
await installPlugin( 'akismet' );

await cleanUpSettings();

Expand All @@ -36,7 +36,7 @@ describe( 'AMP settings screen Site Scan panel', () => {

afterAll( async () => {
await deleteTheme( 'hestia', { newThemeSlug: 'twentytwenty' } );
await uninstallPlugin( 'autoptimize' );
await uninstallPlugin( 'akismet' );

await cleanUpSettings();
} );
Expand Down Expand Up @@ -96,7 +96,7 @@ describe( 'AMP settings screen Site Scan panel', () => {

it( 'lists Autoptimize plugin as causing AMP incompatibility', async () => {
await activateTheme( 'twentytwenty' );
await activatePlugin( 'autoptimize' );
await activatePlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

Expand All @@ -107,12 +107,12 @@ describe( 'AMP settings screen Site Scan panel', () => {

await expect( page ).not.toMatchElement( '.site-scan-results--themes' );

await deactivatePlugin( 'autoptimize' );
await deactivatePlugin( 'akismet' );
} );

it( 'lists Hestia theme and Autoptimize plugin for causing AMP incompatibilities', async () => {
await activateTheme( 'hestia' );
await activatePlugin( 'autoptimize' );
await activatePlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

Expand All @@ -127,12 +127,12 @@ describe( 'AMP settings screen Site Scan panel', () => {
await expect( page ).toMatchElement( '.site-scan-results--themes .site-scan-results__source-name', { text: /Hestia/ } );
await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-name', { text: /Autoptimize/ } );

await deactivatePlugin( 'autoptimize' );
await deactivatePlugin( 'akismet' );
} );

it( 'displays a notice if a plugin has been deactivated or removed', async () => {
await activateTheme( 'twentytwenty' );
await activatePlugin( 'autoptimize' );
await activatePlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

Expand All @@ -141,27 +141,27 @@ describe( 'AMP settings screen Site Scan panel', () => {
await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-name', { text: /Autoptimize/, timeout } );

// Deactivate the plugin and test.
await deactivatePlugin( 'autoptimize' );
await deactivatePlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-name', { text: /Autoptimize/ } );
await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-notice', { text: /This plugin has been deactivated since last site scan./ } );

// Uninstall the plugin and test.
await uninstallPlugin( 'autoptimize' );
await uninstallPlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-slug', { text: /autoptimize/ } );
await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-slug', { text: /akismet/ } );
await expect( page ).toMatchElement( '.site-scan-results--plugins .site-scan-results__source-notice', { text: /This plugin has been uninstalled since last site scan./ } );

// Clean up.
await installPlugin( 'autoptimize' );
await installPlugin( 'akismet' );
} );

it( 'automatically triggers a scan if Plugin Suppression option has changed', async () => {
await activatePlugin( 'autoptimize' );
await activatePlugin( 'akismet' );

await visitAdminPage( 'admin.php', 'page=amp-options' );

Expand All @@ -181,6 +181,6 @@ describe( 'AMP settings screen Site Scan panel', () => {
isAmpFirst: false,
} );

await deactivatePlugin( 'autoptimize' );
await deactivatePlugin( 'akismet' );
} );
} );
8 changes: 4 additions & 4 deletions tests/e2e/specs/amp-onboarding/site-scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import {
describe( 'Onboarding Wizard Site Scan Step', () => {
beforeAll( async () => {
await installTheme( 'hestia' );
await installPlugin( 'autoptimize' );
await installPlugin( 'akismet' );
} );

afterAll( async () => {
await deleteTheme( 'hestia', { newThemeSlug: 'twentytwenty' } );
await uninstallPlugin( 'autoptimize' );
await uninstallPlugin( 'akismet' );
} );

it( 'should start a site scan immediately', async () => {
Expand All @@ -57,7 +57,7 @@ describe( 'Onboarding Wizard Site Scan Step', () => {

it( 'should list out plugin and theme issues after the scan', async () => {
await activateTheme( 'hestia' );
await activatePlugin( 'autoptimize' );
await activatePlugin( 'akismet' );

await moveToSiteScanScreen( { technical: true } );

Expand All @@ -81,7 +81,7 @@ describe( 'Onboarding Wizard Site Scan Step', () => {
await testNextButton( { text: 'Next' } );
await testPreviousButton( { text: 'Previous' } );

await deactivatePlugin( 'autoptimize' );
await deactivatePlugin( 'akismet' );
await activateTheme( 'twentytwenty' );
} );
} );

0 comments on commit b69d826

Please sign in to comment.