-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
152 lines (144 loc) · 3.93 KB
/
Copy pathplaywright.config.ts
File metadata and controls
152 lines (144 loc) · 3.93 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { defineConfig, devices } from '@playwright/test';
/**
* Конфигурация Playwright для тестирования адаптивности
*
* Включает проекты для разных viewport размеров:
* - Mobile (320px)
* - Tablet (768px)
* - Desktop (1024px)
* - XL (1280px)
* - 2XL (1536px)
* - 3XL (1920px)
* - 4XL (2560px)
* - 5XL (3840px) - 4K UHD мониторы
* - 6XL (5120px) - 5K и сверхбольшие экраны
*/
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list'],
],
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
// ============================================
// Адаптивные тесты (основные)
// ============================================
{
name: 'adaptive-mobile',
use: {
...devices['Desktop Chrome'],
viewport: { width: 320, height: 568 },
deviceScaleFactor: 2,
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-tablet',
use: {
...devices['Desktop Chrome'],
viewport: { width: 768, height: 1024 },
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-desktop',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1024, height: 768 },
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-xl',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-2xl',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1536, height: 864 },
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-3xl',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1920, height: 1080 },
},
testMatch: /adaptive\.spec\.ts/,
},
{
name: 'adaptive-4xl',
use: {
...devices['Desktop Chrome'],
viewport: { width: 2560, height: 1440 },
},
testMatch: /adaptive\.spec\.ts/,
},
// ============================================
// Кроссбраузерные тесты
// ============================================
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testIgnore: /adaptive\.spec\.ts/,
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
testIgnore: /adaptive\.spec\.ts/,
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
testIgnore: /adaptive\.spec\.ts/,
},
// ============================================
// Мобильные устройства
// ============================================
{
name: 'mobile-chrome',
use: { ...devices['Pixel 5'] },
testMatch: /mobile\.spec\.ts/,
},
{
name: 'mobile-safari',
use: { ...devices['iPhone 12'] },
testMatch: /mobile\.spec\.ts/,
},
// ============================================
// Тесты с высоким DPI
// ============================================
{
name: 'high-dpi',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
deviceScaleFactor: 1.5, // 150% масштабирование
},
testMatch: /adaptive\.spec\.ts/,
},
],
// Запуск dev сервера перед тестами
webServer: process.env.CI ? {
command: 'npm run start',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120000,
} : undefined,
});