Skip to content

Commit ddd097d

Browse files
committed
chore: playwright global setup 세팅
1 parent 041055a commit ddd097d

File tree

4 files changed

+38
-23
lines changed

4 files changed

+38
-23
lines changed

playwright.config.ts

+30-10
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,50 @@ export default defineConfig({
2222
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2323
reporter: "html",
2424
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25+
globalSetup: "./tests/e2eTests/global.setup.ts",
2526
use: {
2627
/* Base URL to use in actions like `await page.goto('/')`. */
27-
// baseURL: 'http://127.0.0.1:3000',
28-
28+
baseURL: "http://localhost:5173/",
29+
storageState: "./tests/e2eTests/auth.json",
2930
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3031
trace: "on-first-retry",
3132
},
3233

3334
/* Configure projects for major browsers */
3435
projects: [
3536
{
36-
name: "chromium",
37-
use: { ...devices["Desktop Chrome"] },
37+
name: "setup",
38+
testMatch: /global\.setup\.ts/,
3839
},
39-
4040
{
41-
name: "firefox",
42-
use: { ...devices["Desktop Firefox"] },
41+
name: "logged in chromium",
42+
dependencies: ["setup"],
43+
use: {
44+
...devices["Desktop Chrome"],
45+
storageState: "./tests/e2eTests/auth.json",
46+
},
47+
testIgnore: ["**/authentication/**/*.ts"],
4348
},
44-
4549
{
46-
name: "webkit",
47-
use: { ...devices["Desktop Safari"] },
50+
name: "authentication",
51+
use: { ...devices["Desktop Chrome"] },
52+
testMatch: "**/authentication/**/*.ts",
53+
testIgnore: ["**/global.setup.ts"],
4854
},
55+
// {
56+
// name: "chromium",
57+
// use: { ...devices["Desktop Chrome"] },
58+
// },
59+
//
60+
// {
61+
// name: "firefox",
62+
// use: { ...devices["Desktop Firefox"] },
63+
// },
64+
//
65+
// {
66+
// name: "webkit",
67+
// use: { ...devices["Desktop Safari"] },
68+
// },
4969

5070
/* Test against mobile viewports. */
5171
// {

tests/e2eTests/example.spec.ts

-8
This file was deleted.

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"@routes/*": ["./src/routes/*"],
3737
"@utils/*": ["./src/utils/*"],
3838
"@type/*": ["./src/types/*"],
39-
"@store/*": ["./src/store/*"]
39+
"@store/*": ["./src/store/*"],
40+
"@tests/*": ["./tests/*"],
4041
}
4142
},
4243
"include": ["src", "tests"],

vite.config.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/// <reference types="vitest" />
22

3-
import react from '@vitejs/plugin-react'
4-
import path from 'path'
5-
import {defineConfig} from 'vite'
6-
import svgr from 'vite-plugin-svgr'
3+
import path from "path";
4+
5+
import react from "@vitejs/plugin-react";
6+
import { defineConfig } from "vite";
7+
import svgr from "vite-plugin-svgr";
78

89
// https://vitejs.dev/config/
910
export default defineConfig({
@@ -29,6 +30,7 @@ export default defineConfig({
2930
"@utils": path.resolve(__dirname, "./src/utils"),
3031
"@type": path.resolve(__dirname, "./src/types"),
3132
"@store": path.resolve(__dirname, "./src/store"),
33+
"@tests": path.resolve(__dirname, "./tests"),
3234
},
3335
},
3436
});

0 commit comments

Comments
 (0)