feat(e2e): add default test setup, update playwright config

This commit is contained in:
QAComet
2024-04-21 17:17:27 -06:00
parent b8d7bd57c8
commit 7c14cf7bf1
3 changed files with 50 additions and 8 deletions
+23 -8
View File
@@ -1,11 +1,8 @@
import { defineConfig, devices } from "@playwright/test";
import path from "path";
import "dotenv/config.js";
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
export const STORAGE_STATE = path.join(__dirname, "playwright/.auth/user.json");
/**
* See https://playwright.dev/docs/test-configuration.
*/
@@ -24,7 +21,7 @@ export default defineConfig({
/* 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('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: "http://127.0.0.1:3000",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
@@ -33,10 +30,27 @@ export default defineConfig({
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
name: "setup dashboard",
testMatch: /global\/setup\.dashboard\.ts/,
},
{
name: "setup public",
testMatch: /global\/setup\.public\.ts/,
},
{
name: "chromium dashboard",
dependencies: ["setup dashboard"],
testMatch: "dashboard/*.spec.ts",
use: { ...devices["Desktop Chrome"], storageState: STORAGE_STATE },
},
{
name: "chromium public",
dependencies: ["setup public"],
testMatch: "public/*.spec.ts",
use: { ...devices["Desktop Chrome"] },
},
/*
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
@@ -46,6 +60,7 @@ export default defineConfig({
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
*/
/* Test against mobile viewports. */
// {