[e2e tests] External sites - update activate-and-setup tests (#50927)

* Disable woocommerce_calc_taxes before tests start

* TEMP: Comment on expect `#setting-error-settings_updated`

* Include activate-and-setup folder into test runs for external envs

* Update core-profiler.spec.js so it's passing on Pressable and WPCOM

* Check only active plugins

* "Total sales" is missing on one of the external sites. Trying without it.

* Remove comments

* Revert to use `#submit` locator

* Revert "#setting-error-settings_updated"

* Revert "I’m just starting my business" string - check `'` sign on CI

* Revert all strings that initially contained `'` sign

* Revert "Revert "#setting-error-settings_updated""

This reverts commit ae6b72b5c4.

* Revert "Revert "I’m just starting my business" string - check `'` sign on CI"

This reverts commit e852707e06.

* Revert "Revert all strings that initially contained `'` sign"

This reverts commit f978595303.

* Reload page and check settings state instead of verifying `#setting-error-settings_updated`

* Ensure the store is not in "Coming soon" mode before basic.spec.js

* Check if store is in "Comin soon" mode - `hasText` instead of `name`

* Remove `grepInvert: /@local/`

* WPCOM - run only `basic.spec.js`

* WPCOM - run only `basic.spec.js`

* Revert default-wpcpom/playwright.config.js

* Add changefile(s) from automation for the following project(s): woocommerce

* Introduce @skip-on-default-pressable and skip `Can connect to WooCommerce.com`

* Revert "Introduce @skip-on-default-pressable and skip `Can connect to WooCommerce.com`"

This reverts commit e38abebdd2.

* Re-enable "Go to WC Home and make sure the total sales is visible"

* Introduce @skip-on-default-pressable and skip `core-profiler.spec.js`

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-08-27 14:07:18 +02:00 committed by GitHub
parent 47ff627048
commit 3c12dd8abb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 562 additions and 488 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Update `activate-and-setup` e2e tests, so they are passing against Pressable env.

View File

@ -7,7 +7,11 @@ config = {
{
name: 'default pressable',
use: { ...devices[ 'Desktop Chrome' ] },
testMatch: '**basic.spec.js',
testMatch: [
'**/basic.spec.js',
'**/activate-and-setup/**/*.spec.js',
],
grepInvert: /@skip-on-default-pressable/,
},
],
};

View File

@ -1,10 +1,26 @@
const { test, expect } = require( '@playwright/test' );
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
test.describe(
'Store owner can finish initial store setup',
{ tag: [ '@gutenberg', '@payments', '@services' ] },
() => {
test.use( { storageState: process.env.ADMINSTATE } );
test.beforeAll( async ( { baseURL } ) => {
const api = new wcApi( {
url: baseURL,
consumerKey: process.env.CONSUMER_KEY,
consumerSecret: process.env.CONSUMER_SECRET,
version: 'wc/v3',
} );
await api.put( 'settings/general/woocommerce_calc_taxes', {
data: {
value: 'no',
},
} );
} );
test( 'can enable tax rates and calculations', async ( { page } ) => {
await page.goto( 'wp-admin/admin.php?page=wc-settings' );
// Check the enable taxes checkbox
@ -28,9 +44,7 @@ test.describe(
.fill( '/product/' );
await page.locator( '#submit' ).click();
// Verify that settings have been saved
await expect(
page.locator( '#setting-error-settings_updated' )
).toContainText( 'Permalink structure updated.' );
await page.reload();
await expect( page.locator( '#permalink_structure' ) ).toHaveValue(
'/%postname%/'
);

View File

@ -1,6 +1,15 @@
const { test, expect } = require( '@playwright/test' );
const { test, expect, request } = require( '@playwright/test' );
const { logIn } = require( '../utils/login' );
const { admin, customer } = require( '../test-data/data' );
const { setOption } = require( '../utils/options' );
test.beforeAll( async ( { baseURL } ) => {
try {
await setOption( request, baseURL, 'woocommerce_coming_soon', 'no' );
} catch ( error ) {
console.log( error );
}
} );
test( 'Load the home page', async ( { page } ) => {
await page.goto( '/' );