-
Notifications
You must be signed in to change notification settings - Fork 1
/
playwright.global-setup.ts
42 lines (36 loc) · 1.64 KB
/
playwright.global-setup.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
import { FullConfig } from "@playwright/test";
// See https://playwright.dev/docs/test-global-setup-teardown#option-2-configure-globalsetup-and-globalteardown
type PlaywrightCliOptions = {
UIMode: boolean;
};
export const playwrightCliOptions: PlaywrightCliOptions = {
UIMode: process.argv.includes("--ui"),
};
function startupLog(config: FullConfig) {
console.log(""); // just for the new line
console.log("Starting playwright tests:");
console.log(`- Playwright version: ${config.version}`);
console.log(`- UI mode: ${playwrightCliOptions.UIMode}`);
console.log(`- update snapshots: ${config.updateSnapshots}`);
console.log(`- webServer.command: ${config.webServer?.command}`);
console.log(`- webServer.url: ${config.webServer?.url}`);
// prettier-ignore
console.log(`- webServer.reuseExistingServer: ${config.webServer?.reuseExistingServer}`);
console.log(`- testDir: ${config.projects[0].testDir}`);
console.log(`- outputDir: ${config.projects[0].outputDir}`);
const monocartReporter = config.reporter[1];
if (monocartReporter) {
const monocartReporterOptions = monocartReporter[1];
// prettier-ignore
console.log(`- monocart-reporter outputFile: ${monocartReporterOptions.outputFile}`);
// prettier-ignore
console.log(`- monocart-reporter coverage.outputDir: ${monocartReporterOptions.coverage.outputDir}`);
// prettier-ignore
console.log(`- monocart-reporter coverage.reportPath: ${monocartReporterOptions.coverage.reportPath}`);
}
console.log(""); // just for the new line
}
async function globalSetup(config: FullConfig): Promise<void> {
startupLog(config);
}
export default globalSetup;