-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
75 lines (68 loc) · 2.05 KB
/
playwright.config.ts
File metadata and controls
75 lines (68 loc) · 2.05 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { defineConfig, devices } from '@playwright/test';
import { fileURLToPath } from 'url';
import path from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const AUTH_DIR = path.join(__dirname, 'tests', '.auth');
export default defineConfig({
testDir: './tests',
outputDir: './test-results',
timeout: 30000,
fullyParallel: true,
retries: 0,
reporter: 'list',
use: {
baseURL: 'http://localhost:8099',
trace: 'on-first-retry',
screenshot: 'on',
},
projects: [
// 1. Setup — логинимся и сохраняем storageState для каждой роли
{
name: 'setup',
testDir: './tests/setup',
testMatch: /auth\.setup\.ts/,
},
// 2. Тесты логина — без аутентификации
{
name: 'login',
testDir: './tests/auth',
use: { ...devices['Desktop Chrome'] },
},
// 3. Основные тесты — запускаются от admin (owner)
{
name: 'chromium',
testDir: './tests/pages',
use: {
...devices['Desktop Chrome'],
storageState: path.join(AUTH_DIR, 'admin.json'),
},
dependencies: ['setup'],
},
// 4. Role-specific тесты (файлы с .role-*.spec.ts)
{
name: 'role-tests',
testDir: './tests/roles',
use: { ...devices['Desktop Chrome'] },
dependencies: ['setup'],
},
// 5. Functional setup — логин admin для функциональных тестов
{
name: 'functional-setup',
testDir: './tests/functional/setup',
testMatch: /functional\.setup\.ts/,
},
// 6. Функциональные тесты — строго последовательно
{
name: 'functional',
testDir: './tests/functional',
testMatch: /\d{2}-.*\.spec\.ts/,
fullyParallel: false,
use: {
...devices['Desktop Chrome'],
storageState: path.join(AUTH_DIR, 'func-admin.json'),
},
dependencies: ['functional-setup'],
},
],
});