mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-06-10 11:54:14 +08:00
216 lines
5.4 KiB
TypeScript
216 lines
5.4 KiB
TypeScript
/**
|
|
* External dependencies
|
|
*/
|
|
import { defineConfig, devices, ViewportSize } from '@playwright/test';
|
|
import { WpCliEnvType } from '@inpsyde/playwright-utils/build/@types/wp-cli';
|
|
import dotenv from 'dotenv';
|
|
import path from 'path';
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
import { BaseExtend } from './tests/qa/utils';
|
|
|
|
const dotenvPath = process.env.CI
|
|
? path.resolve( __dirname, '.env.ci' )
|
|
: undefined;
|
|
dotenv.config( { path: dotenvPath } );
|
|
|
|
const viewportSize: ViewportSize = { width: 1280, height: 850 };
|
|
|
|
export default defineConfig< BaseExtend >( {
|
|
testDir: 'tests/qa/tests',
|
|
expect: {
|
|
timeout: 20 * 1000,
|
|
},
|
|
timeout: 2 * 60_000,
|
|
/* Run tests in files in parallel */
|
|
fullyParallel: false,
|
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
forbidOnly: !! process.env.CI,
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 2 : 0,
|
|
/* Opt out of parallel tests on CI. */
|
|
workers: process.env.CI ? 1 : 1,
|
|
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot */
|
|
snapshotDir: './snapshots',
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
reporter: [
|
|
[ 'list' ],
|
|
[ 'html', { outputFolder: 'playwright-report' } ],
|
|
[
|
|
'@inpsyde/playwright-utils/build/integration/jira/xray-reporter.js',
|
|
{
|
|
apiClient: {
|
|
client_id: process.env.XRAY_CLIENT_ID,
|
|
client_secret: process.env.XRAY_CLIENT_SECRET,
|
|
},
|
|
testExecutionKey: process.env.XRAY_TEST_EXEC_KEY,
|
|
},
|
|
],
|
|
],
|
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
|
|
globalSetup: require.resolve( './tests/qa/global-setup' ),
|
|
|
|
use: {
|
|
baseURL: process.env.WP_BASE_URL,
|
|
|
|
storageState: process.env.STORAGE_STATE_PATH_ADMIN,
|
|
|
|
ignoreHTTPSErrors: process.env.IGNORE_HTTPS_ERRORS === 'true',
|
|
|
|
/**
|
|
* For envs with Basic Auth. Omit when both are empty (e.g. wp-env).
|
|
*/
|
|
...( process.env.WP_BASIC_AUTH_USER &&
|
|
process.env.WP_BASIC_AUTH_PASS && {
|
|
httpCredentials: {
|
|
username: process.env.WP_BASIC_AUTH_USER,
|
|
password: process.env.WP_BASIC_AUTH_PASS,
|
|
},
|
|
} ),
|
|
|
|
...devices[ 'Desktop Chrome' ],
|
|
|
|
launchOptions: {
|
|
// Put your chromium-specific args here
|
|
args: [ '--disable-web-security' ],
|
|
},
|
|
|
|
viewport: viewportSize,
|
|
|
|
trace: process.env.CI
|
|
? 'off'
|
|
: 'retain-on-failure', //process.env.CI ? 'off' : 'on-first-retry',//'on',//
|
|
|
|
screenshot: {
|
|
mode: 'only-on-failure',
|
|
fullPage: true, // Captures entire scrollable page
|
|
},
|
|
|
|
video: process.env.CI
|
|
? 'off'
|
|
: {
|
|
mode: 'retain-on-failure', //'on',//
|
|
size: viewportSize,
|
|
},
|
|
|
|
recordVideoOptions: process.env.CI
|
|
? undefined
|
|
: {
|
|
mode: 'retain-on-failure',
|
|
size: viewportSize,
|
|
},
|
|
|
|
cliConfig: {
|
|
envType: process.env.WPCLI_ENV_TYPE as WpCliEnvType,
|
|
path: process.env.WPCLI_PATH,
|
|
ssh: {
|
|
login: process.env.SSH_LOGIN,
|
|
host: process.env.SSH_HOST,
|
|
port: process.env.SSH_PORT,
|
|
path: process.env.SSH_PATH,
|
|
},
|
|
},
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: 'setup-woocommerce',
|
|
testMatch: /woocommerce\.setup\.ts/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp',
|
|
testMatch: /pcp\.setup\.ts/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp-usa-for-transactions',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /pcp\.setup\.ts/,
|
|
grep: /setup:pcp:usa:transactions;/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp-usa-for-transactions-googlepay',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /pcp\.setup\.ts/,
|
|
grep: /setup:pcp:usa:transactions:googlepay;/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp-usa-for-refund',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /pcp\.setup\.ts/,
|
|
grep: /setup:pcp:usa:refund;/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp-vaulting',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /pcp\.setup\.ts/,
|
|
grep: /setup:pcp:usa:vaulting;/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'setup-pcp-subscription',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /pcp\.setup\.ts/,
|
|
grep: /setup:pcp:usa:subscription;/,
|
|
fullyParallel: false,
|
|
},
|
|
{
|
|
name: 'plugin-foundation',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /plugin-foundation\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'all',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testIgnore: [ /stress\.spec\.ts/, /plugin-foundation\.spec\.ts/ ],
|
|
},
|
|
{
|
|
name: 'stress',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /stress\.spec\.ts/,
|
|
},
|
|
|
|
// Parallel CI
|
|
{
|
|
name: 'shard:plugin-foundation',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /01-plugin-foundation\/.*\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:onboarding-settings',
|
|
dependencies: [ 'setup-woocommerce' ],
|
|
testMatch: /(02-onboarding|03-plugin-settings)\/.*\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:transactions',
|
|
dependencies: [ 'setup-pcp-usa-for-transactions' ],
|
|
testMatch: /05-transactions\/transaction-usa.*\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:transactions-googlepay',
|
|
dependencies: [ 'setup-pcp-usa-for-transactions-googlepay' ],
|
|
testMatch: /05-transactions\/transaction-googlepay\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:refund',
|
|
dependencies: [ 'setup-pcp-usa-for-refund' ],
|
|
testMatch: /06-refund\/.*\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:vaulting',
|
|
dependencies: [ 'setup-pcp-vaulting' ],
|
|
testMatch: /07-vaulting\/.*\.spec\.ts/,
|
|
},
|
|
{
|
|
name: 'shard:subscription',
|
|
dependencies: [ 'setup-pcp-subscription' ],
|
|
testMatch: /08-subscription\/.*\.spec\.ts/,
|
|
},
|
|
],
|
|
} );
|