-
Notifications
You must be signed in to change notification settings - Fork 833
Boost: Re-enable Module E2E tests #44141
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: changed | ||
Comment: Add back previously flaky e2e tests | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { JetpackBoostPage } from '../../lib/pages/index.js'; | |
|
||
const modules = [ | ||
// ['MODULE_NAME', 'DEFAULT STATE'], | ||
[ 'critical_css', 'disabled' ], | ||
[ 'critical_css', 'enabled' ], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be enabled. We now enable local Critical CSS by default when the user selects a free plan. |
||
[ 'render_blocking_js', 'disabled' ], | ||
]; | ||
|
||
|
@@ -17,34 +17,40 @@ test.describe.serial( 'Modules', () => { | |
page = await browser.newPage( playwrightConfig.use ); | ||
|
||
await boostPrerequisitesBuilder( page ) | ||
.withCleanEnv() | ||
.withConnection( true ) | ||
.withInactiveModules( [ 'critical_css', 'render_blocking_js' ] ) | ||
.withSpeedScoreMocked( true ) | ||
.build(); | ||
jetpackBoostPage = await JetpackBoostPage.visit( page ); | ||
} ); | ||
|
||
test.afterAll( async () => { | ||
await page.close(); | ||
} ); | ||
|
||
modules.forEach( ( [ moduleSlug, moduleState ] = module ) => { | ||
test( `The ${ moduleSlug } module should be ${ moduleState } by default`, async () => { | ||
expect( | ||
await jetpackBoostPage.isModuleEnabled( moduleSlug ), | ||
await jetpackBoostPage.waitForModuleState( moduleSlug, moduleState === 'enabled' ), | ||
`${ moduleSlug } should be enabled` | ||
).toEqual( moduleState === 'enabled' ); | ||
).toBeTruthy(); | ||
} ); | ||
|
||
test( `The ${ moduleSlug } module state should toggle to an inverse state`, async () => { | ||
await jetpackBoostPage.toggleModule( moduleSlug ); | ||
await jetpackBoostPage.toggleModule( moduleSlug, moduleState !== 'enabled' ); | ||
expect( | ||
await jetpackBoostPage.isModuleEnabled( moduleSlug ), | ||
`${ moduleSlug } should not be enabled` | ||
).toEqual( moduleState !== 'enabled' ); | ||
await jetpackBoostPage.waitForModuleState( moduleSlug, moduleState !== 'enabled' ), | ||
`${ moduleSlug } should be enabled` | ||
).toBeTruthy(); | ||
} ); | ||
|
||
test( `The ${ moduleSlug } module state should revert back to original state`, async () => { | ||
await jetpackBoostPage.toggleModule( moduleSlug ); | ||
await jetpackBoostPage.toggleModule( moduleSlug, moduleState === 'enabled' ); | ||
|
||
expect( | ||
await jetpackBoostPage.isModuleEnabled( moduleSlug ), | ||
await jetpackBoostPage.waitForModuleState( moduleSlug, moduleState === 'enabled' ), | ||
`${ moduleSlug } should be enabled` | ||
).toEqual( moduleState === 'enabled' ); | ||
).toBeTruthy(); | ||
} ); | ||
} ); | ||
} ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,34 @@ | |
import { boostPrerequisitesBuilder } from '../../lib/env/prerequisites.js'; | ||
import { JetpackBoostPage } from '../../lib/pages/index.js'; | ||
|
||
let jetpackBoostPage; | ||
|
||
test.describe( 'Speed Score feature', () => { | ||
let page; | ||
let jetpackBoostPage; | ||
|
||
test.beforeAll( async ( { browser } ) => { | ||
const page = await browser.newPage(); | ||
await boostPrerequisitesBuilder( page ).withSpeedScoreMocked( false ).build(); | ||
page = await browser.newPage(); | ||
await boostPrerequisitesBuilder( page ) | ||
.withCleanEnv() | ||
.withConnection( true ) | ||
.withSpeedScoreMocked( false ) | ||
.build(); | ||
} ); | ||
|
||
test.afterAll( async ( { browser } ) => { | ||
const page = await browser.newPage(); | ||
await boostPrerequisitesBuilder( page ).withSpeedScoreMocked( true ).build(); | ||
test.afterAll( async () => { | ||
await page.close(); | ||
} ); | ||
|
||
test.beforeEach( async function ( { page } ) { | ||
test.beforeEach( async () => { | ||
Check failure on line 22 in projects/plugins/boost/tests/e2e/specs/modules/speed-score.test.js
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This beforeEach simply just visits the Boost page, the fact that this times out tells me there is a timeout issue with localtunnel, a retry resolved this issue. |
||
jetpackBoostPage = await JetpackBoostPage.visit( page ); | ||
} ); | ||
|
||
test( 'The Speed Score section should display a mobile and desktop speed score greater than zero', async () => { | ||
await jetpackBoostPage.waitForScoreLoadingToFinish(); | ||
|
||
expect( | ||
await jetpackBoostPage.getSpeedScore( 'mobile' ), | ||
'Mobile speed score should be greater than 0' | ||
).toBeGreaterThan( 0 ); | ||
Check failure on line 32 in projects/plugins/boost/tests/e2e/specs/modules/speed-score.test.js
|
||
expect( | ||
await jetpackBoostPage.getSpeedScore( 'desktop' ), | ||
'Desktop speed score should be greater than 0' | ||
|
@@ -34,7 +40,6 @@ | |
await jetpackBoostPage.waitForScoreLoadingToFinish(); | ||
await jetpackBoostPage.clickRefreshSpeedScore(); | ||
|
||
expect( await jetpackBoostPage.isScoreLoading(), 'Score should be loading' ).toBeTruthy(); | ||
await jetpackBoostPage.waitForScoreLoadingToFinish(); | ||
expect( await jetpackBoostPage.isScoreVisible(), 'Score should be displayed' ).toBeTruthy(); | ||
} ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never used.