Add conditional checks for E2E and billing tests (#34)

* Add conditional checks for E2E and billing tests

Added a conditional check to only run the End-to-End (E2E) workflow if the environment variable ENABLE_E2E_JOB is set to true. Also added a similar check in the Playwright configuration for running billing tests only if the ENABLE_BILLING_TESTS environment variable is 'true'. This will allow more control over the tests run in different environments.
This commit is contained in:
Giancarlo Buomprisco
2024-06-12 16:51:28 +08:00
committed by GitHub
parent cbd8941c37
commit ca5e02f509
3 changed files with 24 additions and 4 deletions

View File

@@ -1,5 +1,18 @@
import { defineConfig, devices } from '@playwright/test';
const enableBillingTests = process.env.ENABLE_BILLING_TESTS === 'true';
const testIgnore: string[] = [];
if (!enableBillingTests) {
console.log(
`Billing tests are disabled. To enable them, set the environment variable ENABLE_BILLING_TESTS=true.`,
`Current value: "${process.env.ENABLE_BILLING_TESTS}"`
);
testIgnore.push('*-billing.spec.ts');
}
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
@@ -20,6 +33,8 @@ export default defineConfig({
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Ignore billing tests if the environment variable is not set. */
testIgnore,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */