forked from baron/baron-sso
orgfront playwrite 설정
This commit is contained in:
@@ -3,6 +3,11 @@ import { defineConfig, devices } from "@playwright/test";
|
|||||||
const configuredWorkers = process.env.PLAYWRIGHT_WORKERS
|
const configuredWorkers = process.env.PLAYWRIGHT_WORKERS
|
||||||
? Number.parseInt(process.env.PLAYWRIGHT_WORKERS, 10)
|
? Number.parseInt(process.env.PLAYWRIGHT_WORKERS, 10)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
const port = Number.parseInt(process.env.PORT ?? "4175", 10);
|
||||||
|
const defaultBaseUrl = `http://127.0.0.1:${port}`;
|
||||||
|
const baseURL = process.env.BASE_URL ?? defaultBaseUrl;
|
||||||
|
const reuseExistingServer = !process.env.CI && !process.env.PORT;
|
||||||
|
const testOidcAuthority = "http://localhost:5000/oidc";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read environment variables from file.
|
* Read environment variables from file.
|
||||||
@@ -35,7 +40,7 @@ export default defineConfig({
|
|||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
baseURL: "http://localhost:5175",
|
baseURL,
|
||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: "on-first-retry",
|
trace: "on-first-retry",
|
||||||
@@ -60,11 +65,14 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
/* Run your local dev server before starting the tests */
|
||||||
webServer: {
|
webServer: process.env.BASE_URL
|
||||||
command: process.env.CI
|
? undefined
|
||||||
? "npm run build && npm run preview -- --host 0.0.0.0 --port 5175"
|
: {
|
||||||
: "npm run dev -- --host 0.0.0.0 --port 5175",
|
command: process.env.CI
|
||||||
url: "http://localhost:5175",
|
? `VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run build && VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run preview -- --host 127.0.0.1 --port ${port}`
|
||||||
reuseExistingServer: !process.env.CI,
|
: `VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run dev -- --host 127.0.0.1 --port ${port}`,
|
||||||
},
|
url: defaultBaseUrl,
|
||||||
|
reuseExistingServer,
|
||||||
|
timeout: 120 * 1000,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ test("orgfront login auto parameter starts OIDC authorization", async ({
|
|||||||
const parsed = new URL(oidc.authorizationURL());
|
const parsed = new URL(oidc.authorizationURL());
|
||||||
expect(parsed.searchParams.get("client_id")).toBe("orgfront");
|
expect(parsed.searchParams.get("client_id")).toBe("orgfront");
|
||||||
expect(parsed.searchParams.get("redirect_uri")).toBe(
|
expect(parsed.searchParams.get("redirect_uri")).toBe(
|
||||||
"http://localhost:5175/auth/callback",
|
"http://127.0.0.1:4175/auth/callback",
|
||||||
);
|
);
|
||||||
expect(parsed.searchParams.get("response_type")).toBe("code");
|
expect(parsed.searchParams.get("response_type")).toBe("code");
|
||||||
expect(parsed.searchParams.get("scope") ?? "").toContain("openid");
|
expect(parsed.searchParams.get("scope") ?? "").toContain("openid");
|
||||||
|
|||||||
Reference in New Issue
Block a user