-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplaywright.config.ts
58 lines (53 loc) · 1.7 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
import { defineConfig, devices } from '@playwright/test';
process.env['SHOPWARE_ADMIN_USERNAME'] = process.env['SHOPWARE_ADMIN_USERNAME'] || 'admin';
process.env['SHOPWARE_ADMIN_PASSWORD'] = process.env['SHOPWARE_ADMIN_PASSWORD'] || 'shopware';
process.env['MAILPIT_BASE_URL'] = process.env['MAILPIT_BASE_URL'] || 'http://localhost:8013';
const defaultAppUrl = 'http://localhost:8011/';
process.env['APP_URL'] = process.env['APP_URL'] ?? defaultAppUrl;
// make sure APP_URL ends with a slash
process.env['APP_URL'] = (process.env['APP_URL'] ?? '').replace(/\/+$/, '') + '/';
if (process.env['ADMIN_URL']) {
process.env['ADMIN_URL'] = process.env['ADMIN_URL'].replace(/\/+$/, '') + '/';
} else {
process.env['ADMIN_URL'] = process.env['APP_URL'] + 'admin/';
}
if (!process.env['WEBSERVER_COMMAND']) {
if (process.env['WEBSERVER_COMMAND'] === defaultAppUrl) {
process.env['WEBSERVER_COMMAND'] = 'docker compose up --pull=always --quiet-pull shopware';
} else {
process.env['WEBSERVER_COMMAND'] = 'sleep 1h';
}
}
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
timeout: 60000,
expect: {
timeout: 10_000,
},
retries: 0,
workers: process.env.CI ? 2 : 1,
reporter: process.env.CI ? [
['html'],
['github'],
] : 'html',
use: {
baseURL: process.env['APP_URL'],
trace: 'retain-on-failure',
video: 'off',
},
// We abuse this to wait for the external webserver
webServer: {
command: process.env['WEBSERVER_COMMAND'] ?? 'sleep 1h',
url: process.env['APP_URL'],
reuseExistingServer: true,
timeout: 180000,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});