Disable Team tests if required (#234)

1. Add env variables loader using dotenv to e2e tests
2. Skip Team account tests based on variable
3. Remove hardcoded instance of Makerkit in tests
This commit is contained in:
Giancarlo Buomprisco
2025-04-13 09:20:31 +07:00
committed by GitHub
parent 765cef8736
commit 53b09fcb8e
7 changed files with 31 additions and 7 deletions

2
apps/e2e/.env Normal file
View File

@@ -0,0 +1,2 @@
ENABLE_TEAM_ACCOUNT_TESTS=true
ENABLE_BILLING_TESTS=false

View File

@@ -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"
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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(

View File

@@ -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 = () => ({});