Skip to content

Commit

Permalink
Move E2E_SKIP_GLOBAL_SETUP logic to root Playwright config
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Jan 6, 2025
1 parent 3d69c41 commit e26344b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 6 additions & 2 deletions web-admin/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
dotenv.config({ path: path.resolve(__dirname, "../.env") });

const config: PlaywrightTestConfig = {
globalSetup: "./tests/setup/globalSetup.ts",
globalTeardown: "./tests/setup/globalTeardown.ts",
...(process.env.E2E_SKIP_GLOBAL_SETUP
? {}
: {
globalSetup: "./tests/setup/globalSetup.ts",
globalTeardown: "./tests/setup/globalTeardown.ts",
}),
webServer: {
command: "npm run build && npm run preview",
port: 3000,
Expand Down
3 changes: 0 additions & 3 deletions web-admin/tests/setup/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import path from "path";
import { fileURLToPath } from "url";
import { execAsync, spawnAndMatch } from "../utils/spawn";

const skipGlobalSetup = Boolean(process.env.E2E_SKIP_GLOBAL_SETUP);
const timeout = 120_000;

export default async function globalSetup() {
if (skipGlobalSetup) return;

// Get the repository root directory, the only place from which `rill devtool` is allowed to be run
const currentDir = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(currentDir, "../../../");
Expand Down
4 changes: 0 additions & 4 deletions web-admin/tests/setup/globalTeardown.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { execAsync } from "../utils/spawn";

const skipGlobalSetup = Boolean(process.env.E2E_SKIP_GLOBAL_SETUP);

export default async function globalTeardown() {
if (skipGlobalSetup) return;

// Stop the cloud services
await execAsync(
"docker compose -f ../cli/cmd/devtool/data/cloud-deps.docker-compose.yml down --volumes",
Expand Down

0 comments on commit e26344b

Please sign in to comment.