forked from NDLANO/ndla-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaywright.config.ts
58 lines (53 loc) · 1.5 KB
/
playwright.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright (c) 2023-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "@playwright/test";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export const STORAGE_STATE = join(__dirname, "e2e/.auth/teacher.json");
export default defineConfig({
testDir: "./e2e",
fullyParallel: true,
maxFailures: process.env.CI ? 10 : undefined,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: 2,
reporter: "html",
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:3000",
trace: "on-first-retry",
viewport: {
width: 2560,
height: 1440,
},
},
projects: [
{ name: "setup", testMatch: "e2e/auth.setup.ts" },
{
name: "NDLA specs",
testMatch: "e2e/specs/unauthenticated/*.spec.ts",
},
{
name: "MyNdla specs",
testMatch: "e2e/specs/authenticated/*.spec.ts",
dependencies: ["setup"],
use: {
storageState: STORAGE_STATE,
},
},
],
// Automatically run against prod-build on CI for speed and accuracy.
webServer: process.env.CI
? {
command: "cross-env NODE_ENV=production node build/server.mjs",
port: 3000,
}
: undefined,
});