Fix e2e and api execution on daily runs (#41113)
* Increase a couple of timeouts * Remove duplicate update to nightly * Add changelog * Install Playwright * Handle Playwright setup * Add in build name * Add in check in e2e tests for daily run * Reverse check * Rookie mistake * Use ternary operator instead --------- Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
parent
4423117dc9
commit
9572bf2a12
|
@ -19,6 +19,11 @@ outputs:
|
|||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run API tests.
|
||||
id: run-api-tests
|
||||
working-directory: plugins/woocommerce
|
||||
|
|
|
@ -45,15 +45,6 @@ jobs:
|
|||
install-filters: woocommerce
|
||||
build: false
|
||||
|
||||
- name: Update site to nightly version
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: ${{ env.API_ARTIFACT }}
|
||||
tests: update-woocommerce.spec.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: nightly
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
|
@ -62,6 +53,8 @@ jobs:
|
|||
env:
|
||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: nightly
|
||||
|
||||
e2e-tests:
|
||||
name: E2E tests on nightly build
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fixes daily execution workflow for API and e2e tests
|
|
@ -4,7 +4,6 @@ const axios = require( 'axios' ).default;
|
|||
const playwrightConfig = require( './playwright.config' );
|
||||
const { site } = require( './utils' );
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('@playwright/test').FullConfig} config
|
||||
|
@ -155,9 +154,15 @@ module.exports = async ( config ) => {
|
|||
await setupPage
|
||||
.locator( '#install-plugin-submit' )
|
||||
.click( { timeout: 60000 } );
|
||||
await setupPage.waitForLoadState( 'networkidle' );
|
||||
await setupPage.waitForLoadState( 'networkidle', {
|
||||
timeout: 60000,
|
||||
} );
|
||||
await expect(
|
||||
setupPage.getByRole( 'link', { name: 'Activate Plugin' } )
|
||||
setupPage.getByRole(
|
||||
'link',
|
||||
{ name: 'Activate Plugin' },
|
||||
{ timeout: 60000 }
|
||||
)
|
||||
).toBeVisible();
|
||||
console.log( 'Activating Plugin...' );
|
||||
await setupPage
|
||||
|
@ -210,10 +215,22 @@ module.exports = async ( config ) => {
|
|||
let hposConfigured = false;
|
||||
const value = ENABLE_HPOS === '0' ? 'no' : 'yes';
|
||||
try {
|
||||
const auth = { username: playwrightConfig.userKey, password: playwrightConfig.userSecret };
|
||||
const hposResponse = await axios.post( playwrightConfig.use.baseURL + '/wp-json/wc/v3/settings/advanced/woocommerce_custom_orders_table_enabled', { value }, { auth } );
|
||||
const auth = {
|
||||
username: playwrightConfig.userKey,
|
||||
password: playwrightConfig.userSecret,
|
||||
};
|
||||
const hposResponse = await axios.post(
|
||||
playwrightConfig.use.baseURL +
|
||||
'/wp-json/wc/v3/settings/advanced/woocommerce_custom_orders_table_enabled',
|
||||
{ value },
|
||||
{ auth }
|
||||
);
|
||||
if ( hposResponse.data.value === value ) {
|
||||
console.log( `HPOS Switched ${ value === 'yes' ? 'on' : 'off' } successfully` );
|
||||
console.log(
|
||||
`HPOS Switched ${
|
||||
value === 'yes' ? 'on' : 'off'
|
||||
} successfully`
|
||||
);
|
||||
hposConfigured = true;
|
||||
}
|
||||
} catch ( error ) {
|
||||
|
|
|
@ -224,7 +224,7 @@ module.exports = async ( config ) => {
|
|||
}
|
||||
}
|
||||
|
||||
await site.useCartCheckoutShortcodes( baseURL, userAgent, admin );
|
||||
!process.env.BASE_URL || process.env.BASE_URL === 'localhost' && await site.useCartCheckoutShortcodes( baseURL, userAgent, admin );
|
||||
|
||||
await adminContext.close();
|
||||
await customerContext.close();
|
||||
|
|
Loading…
Reference in New Issue