Files
iot-dc3/playwright.config.ts
T

62 lines
1.8 KiB
TypeScript

/*
* Copyright 2016-present the IoT DC3 original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { defineConfig, devices } from '@playwright/test';
const baseURL = process.env.E2E_BASE_URL || 'http://localhost:8080';
const startServer = process.env.E2E_START_SERVER !== '0';
export default defineConfig({
testDir: './tests/e2e/specs',
timeout: 60_000,
expect: {
timeout: 10_000,
},
fullyParallel: false,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['list'],
['html', { open: 'never', outputFolder: 'playwright-report' }],
['json', { outputFile: 'test-results/e2e-results.json' }],
],
use: {
baseURL,
headless: process.env.E2E_HEADLESS !== 'false',
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: 15_000,
navigationTimeout: 30_000,
},
webServer: startServer
? {
command: 'pnpm dev',
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
}
: undefined,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
outputDir: 'test-results/e2e-artifacts',
});