diff --git a/apps/e2e/.env b/apps/e2e/.env new file mode 100644 index 000000000..a28d17eb4 --- /dev/null +++ b/apps/e2e/.env @@ -0,0 +1,2 @@ +ENABLE_TEAM_ACCOUNT_TESTS=true +ENABLE_BILLING_TESTS=false \ No newline at end of file diff --git a/apps/e2e/package.json b/apps/e2e/package.json index 6bf0a43d4..6219a0fd4 100644 --- a/apps/e2e/package.json +++ b/apps/e2e/package.json @@ -14,6 +14,7 @@ "devDependencies": { "@playwright/test": "^1.51.1", "@types/node": "^22.14.0", + "dotenv": "16.5.0", "node-html-parser": "^7.0.1", "totp-generator": "^1.0.0" } diff --git a/apps/e2e/playwright.config.ts b/apps/e2e/playwright.config.ts index b51aab9f7..769864f50 100644 --- a/apps/e2e/playwright.config.ts +++ b/apps/e2e/playwright.config.ts @@ -1,6 +1,11 @@ import { defineConfig, devices } from '@playwright/test'; +import { config as dotenvConfig } from 'dotenv'; + +dotenvConfig(); +dotenvConfig({ path: '.env.local' }); const enableBillingTests = process.env.ENABLE_BILLING_TESTS === 'true'; +const enableTeamAccountTests = (process.env.ENABLE_TEAM_ACCOUNT_TESTS ?? 'true') === 'true'; const testIgnore: string[] = []; @@ -13,6 +18,17 @@ if (!enableBillingTests) { testIgnore.push('*-billing.spec.ts'); } +if (!enableTeamAccountTests) { + console.log( + `Team account tests are disabled. To enable them, set the environment variable ENABLE_TEAM_ACCOUNT_TESTS=true.`, + `Current value: "${process.env.ENABLE_TEAM_ACCOUNT_TESTS}"`, + ); + + testIgnore.push('*team-accounts.spec.ts'); + testIgnore.push('*invitations.spec.ts'); + testIgnore.push('*team-billing.spec.ts'); +} + /** * Read environment variables from file. * https://github.com/motdotla/dotenv diff --git a/apps/e2e/tests/admin/admin.spec.ts b/apps/e2e/tests/admin/admin.spec.ts index b03c4fd59..fef90dd8a 100644 --- a/apps/e2e/tests/admin/admin.spec.ts +++ b/apps/e2e/tests/admin/admin.spec.ts @@ -231,6 +231,8 @@ test.describe('Admin', () => { }); test.describe('Team Account Management', () => { + test.skip(process.env.ENABLE_TEAM_ACCOUNT_TESTS !== 'true', 'Team account tests are disabled'); + let testUserEmail: string; let teamName: string; let slug: string; diff --git a/apps/e2e/tests/utils/mailbox.ts b/apps/e2e/tests/utils/mailbox.ts index 729292eda..968e53ec0 100644 --- a/apps/e2e/tests/utils/mailbox.ts +++ b/apps/e2e/tests/utils/mailbox.ts @@ -102,7 +102,7 @@ export class Mailbox { const json = await this.getEmail(email, { deleteAfter, - subject: `One-time password for Makerkit`, + subject: `One-time password for`, }); if (!json) { @@ -152,7 +152,7 @@ export class Mailbox { const message = params.subject ? (() => { const filtered = messagesResponse.messages.filter( - (item) => item.Subject === params.subject, + (item) => item.Subject.includes(params.subject!), ); console.log( diff --git a/apps/web/lib/dev-mock-modules.ts b/apps/web/lib/dev-mock-modules.ts index 7ef4ec2ba..48126cd0d 100644 --- a/apps/web/lib/dev-mock-modules.ts +++ b/apps/web/lib/dev-mock-modules.ts @@ -14,7 +14,7 @@ export const useBaselimeRum = undefined; export const BaselimeRum = undefined; // Sentry -export const captureException =() => ({}); +export const captureException = () => ({}); export const captureEvent = () => ({}); export const setUser = () => ({}); export const init = () => ({}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4b5de1c1..cedc96b5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,6 +115,9 @@ importers: '@types/node': specifier: ^22.14.0 version: 22.14.0 + dotenv: + specifier: 16.5.0 + version: 16.5.0 node-html-parser: specifier: ^7.0.1 version: 7.0.1 @@ -5242,8 +5245,8 @@ packages: resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==} engines: {node: '>=12'} - dotenv@16.4.7: - resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + dotenv@16.5.0: + resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==} engines: {node: '>=12'} dunder-proto@1.0.1: @@ -11298,7 +11301,7 @@ snapshots: '@babel/core': 7.26.10 '@sentry/babel-plugin-component-annotate': 3.2.4 '@sentry/cli': 2.42.2 - dotenv: 16.4.7 + dotenv: 16.5.0 find-up: 5.0.0 glob: 9.3.5 magic-string: 0.30.8 @@ -12778,7 +12781,7 @@ snapshots: dotenv@16.0.3: {} - dotenv@16.4.7: {} + dotenv@16.5.0: {} dunder-proto@1.0.1: dependencies: