Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
58 lines (53 loc) · 2.17 KB
/
Copy pathplaywright.config.ts
File metadata and controls
58 lines (53 loc) · 2.17 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
import { existsSync } from 'node:fs';
import { defineConfig, devices } from '@playwright/test';
import { UPLOAD_MAX_FILESIZE_MB } from './e2e/support/environment';
// Same .env the PHP side reads (see .env.sample); variables already set in the environment take precedence.
if (existsSync('.env')) {
process.loadEnvFile('.env');
}
const baseURL = 'http://127.0.0.1:9876';
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
/* The PHP built-in server handles one request at a time and the tests share one database,
so the tests run one after another. */
fullyParallel: false,
workers: 1,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
globalTeardown: './e2e/global-teardown.ts',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* A server-rendered page in iframes gains little from cross-browser runs; Chromium only keeps the suite fast. */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Writes the test configuration (Tests/test-environment.php), then starts the PHP built-in server.
The setup runs here and not in globalSetup, because Playwright starts the web server first.
With an upload_max_filesize other than the default, the tests see whether the SQL window takes it from PHP. */
webServer: {
command:
'php Tests/test-environment.php setup'
+ ` && php -d upload_max_filesize=${UPLOAD_MAX_FILESIZE_MB}M -S 127.0.0.1:9876 > /dev/null 2>&1`,
url: baseURL,
env: {
PHPPGADMIN_CONFIG_YAML_FILE: 'config-test.yml',
PHPPGADMIN_CONFIG_INC_PHP_FILE: 'config-test.inc.php',
},
/* Never reuse a running server: it would not have the test configuration. */
reuseExistingServer: false,
},
});