Files
upstream-ory-kratos/test/e2e/playwright.config.ts
upstream-mirror c60cc7ca75
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 21:19:12 +05:00

109 lines
3.0 KiB
TypeScript

// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
import { defineConfig, devices } from "@playwright/test"
import * as dotenv from "dotenv"
dotenv.config({ path: __dirname + "/playwright/playwright.env" })
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./playwright/tests",
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 1,
workers: 1,
reporter: process.env.CI ? [["github"], ["html"], ["list"]] : "html",
globalSetup: "./playwright/setup/hydra-global-setup.ts",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
trace: process.env.CI ? "retain-on-failure" : "on",
},
/* Configure projects for major browsers */
projects: [
{
name: "mobile-chrome",
testMatch: /.*\/mobile\/.*\.spec\.ts/,
use: {
...devices["Pixel 5"],
baseURL: "http://localhost:19006",
},
},
{
name: "chromium",
testMatch: /.*\/desktop\/.*\.spec\.ts/,
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:4455",
},
},
],
webServer: [
{
command: [
"cp test/e2e/playwright/kratos.base-config.json test/e2e/playwright/kratos.config.json",
"go run . migrate sql -e --yes",
"go run . serve --watch-courier --dev -c test/e2e/playwright/kratos.config.json",
].join(" && "),
cwd: "../..",
url: "http://localhost:4433/health/ready",
env: {
DSN: dbToDsn(),
COURIER_SMTP_CONNECTION_URI:
"smtp://localhost:8026/?disable_starttls=true",
},
timeout: 7 * 60 * 1000, // 7 minutes
},
{
command: "go tool MailHog -smtp-bind-addr=localhost:8026",
cwd: "../..",
reuseExistingServer: false,
url: "http://localhost:8025/",
},
{
command: "go run test/e2e/mock/httptarget/main.go",
cwd: "../..",
reuseExistingServer: false,
url: "http://localhost:4471/health",
},
{
// env -u DB: Hydra v2 maps the DB env var to its `db` config key (expects an
// object), so any DB=sqlite from the shell would fail Hydra config validation.
command: "env -u DB .bin/hydra serve all -c test/e2e/hydra.yml --dev",
cwd: "../..",
reuseExistingServer: true,
url: "http://localhost:4444/health/ready",
},
{
command: "test/e2e/hydra-login-consent/hydra-login-consent",
cwd: "../..",
reuseExistingServer: true,
url: "http://localhost:4446/",
env: {
PORT: "4446",
HYDRA_ADMIN_URL: "http://localhost:4445",
},
},
],
})
function dbToDsn(): string {
switch (process.env.DB) {
case "postgres":
return process.env.TEST_DATABASE_POSTGRESQL!
case "cockroach":
return process.env.TEST_DATABASE_COCKROACHDB!
case "mysql":
return process.env.TEST_DATABASE_MYSQL!
case "sqlite":
return process.env.TEST_DATABASE_SQLITE!
default:
return "memory"
}
}