UNPKG

qajin

Version:

Playwright Test Runner Library

91 lines (79 loc) 2.36 kB
// playwright.config.ts import path from 'path'; import { config as loadEnv } from 'dotenv'; import { defineConfig, devices, PlaywrightTestConfig } from '@playwright/test'; import { testPlanFilter } from 'allure-playwright/dist/testplan'; // 1️⃣ Determine which env file to load (default to 'development') const env = process.env.NODE_ENV ?? 'uat'; const envFile = path.resolve( __dirname, `.env.${ env }` ); loadEnv( { path: envFile } ); // 2️⃣ Your storage state stays the same // const storageState = { // cookies: [], // origins: [ // { // origin: 'https://www.google.com', // localStorage: [ { name: 'ga_debug_mode', value: 'true' } ], // }, // ], // }; const config: PlaywrightTestConfig = { use: { trace: 'on', permissions: [ 'geolocation' ], geolocation: { latitude: 37.7749, longitude: -122.4194 }, locale: 'en-US', // You can now also pull in env vars, e.g.: baseURL: process.env.url, headless: process.env.headless === 'true', }, grep: testPlanFilter(), reporter: [ // [ 'html', { outputFolder: 'report/playwright-report' } ], // [ 'list' ], [ 'allure-playwright', { outputFolder: './allure-results', suiteTitle: false, detail: true, environmentInfo: {}, }, ], ], globalSetup: './utils/global-setup.ts', globalTeardown: './utils/global-teardown.ts', //outputDir: 'report/test-results', testDir: 'src/com/cuddlynest/tests', timeout: 30_000, expect: { timeout: 30_000 }, retries: 0, workers: 4, fullyParallel: true, forbidOnly: !!process.env.CI, projects: [ { name: 'Chrome', use: { ignoreHTTPSErrors: true, browserName: 'chromium', channel: 'chrome', viewport: null, screenshot: 'only-on-failure', video: 'retain-on-failure', trace: 'retain-on-failure', launchOptions: { slowMo: 0, args: [ '--start-maximized', '--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream', '--disable-geolocation-disclosure', '--enable-geolocation', ], }, }, }, ], }; export default defineConfig( config );