2024-05-31 11:01:10 +05:30
/ *
* Copyright 2024 Collate .
* 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
* http : //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' ;
import dotenv from 'dotenv' ;
/ * *
* Read environment variables from file .
* https : //github.com/motdotla/dotenv
* /
dotenv . config ( ) ;
/ * *
* See https : //playwright.dev/docs/test-configuration.
* /
export default defineConfig ( {
testDir : './playwright/e2e' ,
outputDir : './playwright/output/test-results' ,
/* Run tests in files in parallel */
fullyParallel : true ,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly : ! ! process . env . CI ,
/* Retry on CI only */
2024-08-13 18:43:03 +05:30
retries : process.env.CI ? 1 : 0 ,
2024-05-31 11:01:10 +05:30
/* Opt out of parallel tests on CI. */
2024-09-17 00:17:21 +05:30
workers : process.env.CI ? 4 : undefined ,
2024-08-13 18:43:03 +05:30
maxFailures : 30 ,
2024-05-31 11:01:10 +05:30
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter : [
[ 'list' ] ,
[ 'html' , { outputFolder : './playwright/output/playwright-report' } ] ,
2024-06-01 22:18:33 +05:30
[
'@estruyf/github-actions-reporter' ,
{
useDetails : true ,
showError : true ,
} ,
] ,
2025-05-19 21:19:29 +05:30
[ 'blob' ] ,
2024-05-31 11:01:10 +05:30
] ,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use : {
/* Base URL to use in actions like `await page.goto('/')`. */
2024-06-04 16:29:42 +05:30
baseURL : process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:8585' ,
2024-05-31 11:01:10 +05:30
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace : 'on-first-retry' ,
2024-06-09 19:51:11 +05:30
/* Screenshot on failure. */
screenshot : 'only-on-failure' ,
2024-05-31 11:01:10 +05:30
} ,
/* Configure projects for major browsers */
projects : [
2024-06-01 22:18:33 +05:30
// Admin authentication setup doc: https://playwright.dev/docs/auth#multiple-signed-in-roles
{
name : 'setup' ,
testMatch : '**/*.setup.ts' ,
2025-01-17 09:08:54 +05:30
teardown : 'restore-policies' ,
} ,
{
name : 'restore-policies' ,
testMatch : '**/auth.teardown.ts' ,
2024-06-01 22:18:33 +05:30
} ,
2024-05-31 11:01:10 +05:30
{
name : 'chromium' ,
use : { . . . devices [ 'Desktop Chrome' ] } ,
2024-06-01 22:18:33 +05:30
// Added admin setup as a dependency. This will authorize the page with an admin user before running the test. doc: https://playwright.dev/docs/auth#multiple-signed-in-roles
dependencies : [ 'setup' ] ,
2024-08-20 13:01:00 +05:30
grepInvert : /data-insight/ ,
} ,
{
name : 'data-insight-application' ,
dependencies : [ 'setup' ] ,
testMatch : '**/dataInsightApp.ts' ,
} ,
{
name : 'Data Insight' ,
use : { . . . devices [ 'Desktop Chrome' ] } ,
dependencies : [ 'data-insight-application' ] ,
grep : /data-insight/ ,
2024-05-31 11:01:10 +05:30
} ,
] ,
2024-09-13 02:18:24 +05:30
// Increase timeout for the test
timeout : 60000 ,
2024-05-31 11:01:10 +05:30
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
} ) ;