forked from baron/baron-sso
custom claim 권한체크 확인
This commit is contained in:
@@ -157,10 +157,16 @@ async function mockUserfrontApis(
|
||||
function collectClientFailures(page: Page): string[] {
|
||||
const failures: string[] = [];
|
||||
page.on("pageerror", (error) => {
|
||||
failures.push(error.message);
|
||||
const text = error.message.trim();
|
||||
if (text !== "") {
|
||||
failures.push(text);
|
||||
}
|
||||
});
|
||||
page.on("console", (message) => {
|
||||
const text = message.text();
|
||||
const text = message.text().trim();
|
||||
if (text === "") {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
message.type() === "error" ||
|
||||
(/exception|verify_failed|verification failed|인증 실패/i.test(text) &&
|
||||
|
||||
@@ -117,6 +117,7 @@ function expectNoDuplicateStaticRequests(metrics: LoadMetrics): void {
|
||||
!path.endsWith("/") &&
|
||||
!path.endsWith("/main.dart.wasm") &&
|
||||
!path.endsWith("/main.dart.mjs") &&
|
||||
!path.endsWith("/assets/AssetManifest.bin.json") &&
|
||||
!path.endsWith("/skwasm.js") &&
|
||||
!path.endsWith("/skwasm.wasm")
|
||||
);
|
||||
@@ -129,11 +130,14 @@ function resolvePerformanceBudget(projectName: string): {
|
||||
coldMs: number;
|
||||
warmMs: number;
|
||||
} {
|
||||
if (projectName === "webkit-mobile-webapp") {
|
||||
return { coldMs: 10_000, warmMs: 4000 };
|
||||
}
|
||||
if (projectName.includes("webkit")) {
|
||||
return { coldMs: 4000, warmMs: 4000 };
|
||||
}
|
||||
if (projectName.includes("firefox")) {
|
||||
return { coldMs: 2600, warmMs: 2800 };
|
||||
return { coldMs: 3000, warmMs: 2800 };
|
||||
}
|
||||
if (projectName.includes("mobile")) {
|
||||
return { coldMs: 3000, warmMs: 2300 };
|
||||
|
||||
@@ -215,6 +215,12 @@ async function blurDepartmentEditor(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
async function submitDepartmentEditor(page: Page): Promise<void> {
|
||||
const saveButton = page.getByRole("button", { name: "저장" });
|
||||
if ((await saveButton.count()) > 0) {
|
||||
await saveButton.click({ force: true });
|
||||
await page.waitForTimeout(250);
|
||||
return;
|
||||
}
|
||||
const textbox = page.getByRole("textbox", { name: "소속" });
|
||||
if ((await textbox.count()) > 0) {
|
||||
await textbox.press("Enter");
|
||||
@@ -230,22 +236,12 @@ async function submitDepartmentEditor(page: Page): Promise<void> {
|
||||
|
||||
async function fillDepartmentField(page: Page, value: string): Promise<void> {
|
||||
const textbox = page.getByRole("textbox", { name: "소속" });
|
||||
if (!isMobileProject(page)) {
|
||||
if ((await textbox.count()) > 0) {
|
||||
await textbox.click({ force: true });
|
||||
await page.waitForTimeout(100);
|
||||
}
|
||||
const coords = coordsFor(page);
|
||||
await fillAt(page, coords.departmentInputX, coords.departmentInputY, value);
|
||||
if ((await textbox.count()) > 0) {
|
||||
await textbox.fill(value);
|
||||
await page.waitForTimeout(100);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((await textbox.count()) > 0) {
|
||||
await textbox.click({ force: true });
|
||||
await page.waitForTimeout(100);
|
||||
await replaceFocusedText(page, value);
|
||||
return;
|
||||
}
|
||||
if (isMobileProject(page)) {
|
||||
throw new Error("Department textbox was not found.");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { expect, type Page, type Route, test } from "@playwright/test";
|
||||
import {
|
||||
expect,
|
||||
type Page,
|
||||
type Route,
|
||||
test,
|
||||
type TestInfo,
|
||||
} from "@playwright/test";
|
||||
|
||||
async function seedTokenLogin(page: Page): Promise<void> {
|
||||
await page.addInitScript(() => {
|
||||
@@ -156,133 +162,157 @@ async function mockInventoryApis(page: Page): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
async function expectRouteUrl(
|
||||
page: Page,
|
||||
expected: RegExp,
|
||||
testInfo: TestInfo,
|
||||
): Promise<void> {
|
||||
await expect(page).toHaveURL(expected, {
|
||||
timeout: testInfo.project.name.includes("webkit") ? 15_000 : 5_000,
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("UserFront WASM route inventory (unauth)", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await mockInventoryApis(page);
|
||||
});
|
||||
|
||||
test("route: /", async ({ page }) => {
|
||||
test("route: /", async ({ page }, testInfo) => {
|
||||
await page.goto("/");
|
||||
await expect(page).toHaveURL(/\/(ko|en)\/signin(?:\?.*)?$/);
|
||||
await expectRouteUrl(page, /\/(ko|en)\/signin(?:\?.*)?$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko", async ({ page }) => {
|
||||
test("route: /ko", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko");
|
||||
await expect(page).toHaveURL(/\/ko\/signin(?:\?.*)?$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin(?:\?.*)?$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/dashboard", async ({ page }) => {
|
||||
test("route: /ko/dashboard", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/dashboard");
|
||||
await expect(page).toHaveURL(/\/ko\/signin$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/profile", async ({ page }) => {
|
||||
test("route: /ko/profile", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/profile");
|
||||
await expect(page).toHaveURL(/\/ko\/signin$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/admin/users", async ({ page }) => {
|
||||
test("route: /ko/admin/users", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/admin/users");
|
||||
await expect(page).toHaveURL(/\/ko\/signin$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/scan", async ({ page }) => {
|
||||
test("route: /ko/scan", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/scan");
|
||||
await expect(page).toHaveURL(/\/ko\/signin$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/signin", async ({ page }) => {
|
||||
test("route: /ko/signin", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/signin");
|
||||
await expect(page).toHaveURL(/\/ko\/signin$/);
|
||||
await expectRouteUrl(page, /\/ko\/signin$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/login", async ({ page }) => {
|
||||
test("route: /ko/login", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/login");
|
||||
await expect(page).toHaveURL(/\/ko\/login$/);
|
||||
await expectRouteUrl(page, /\/ko\/login$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/signup", async ({ page }) => {
|
||||
test("route: /ko/signup", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/signup");
|
||||
await expect(page).toHaveURL(/\/ko\/signup$/);
|
||||
await expectRouteUrl(page, /\/ko\/signup$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/registration", async ({ page }) => {
|
||||
test("route: /ko/registration", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/registration");
|
||||
await expect(page).toHaveURL(/\/ko\/registration$/);
|
||||
await expectRouteUrl(page, /\/ko\/registration$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/verify", async ({ page }) => {
|
||||
test("route: /ko/verify", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/verify");
|
||||
await expect(page).toHaveURL(/\/ko\/verify$/);
|
||||
await expectRouteUrl(page, /\/ko\/verify$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/verify/:token", async ({ page }) => {
|
||||
test("route: /ko/verify/:token", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/verify/e2e-token");
|
||||
await expect(page).toHaveURL(/\/ko\/verify\/e2e-token$/);
|
||||
await expectRouteUrl(page, /\/ko\/verify\/e2e-token$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/verification", async ({ page }) => {
|
||||
test("route: /ko/verification", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/verification");
|
||||
await expect(page).toHaveURL(/\/ko\/verification$/);
|
||||
await expectRouteUrl(page, /\/ko\/verification$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/verify-complete", async ({ page }) => {
|
||||
test("route: /ko/verify-complete", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/verify-complete");
|
||||
await expect(page).toHaveURL(/\/ko\/verify-complete$/);
|
||||
await expectRouteUrl(page, /\/ko\/verify-complete$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/l/:shortCode", async ({ page }) => {
|
||||
test("route: /ko/l/:shortCode", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/l/AB123456");
|
||||
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||
await expectRouteUrl(page, /\/ko\/l\/AB123456$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/forgot-password", async ({ page }) => {
|
||||
test("route: /ko/forgot-password", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/forgot-password");
|
||||
await expect(page).toHaveURL(/\/ko\/forgot-password$/);
|
||||
await expectRouteUrl(page, /\/ko\/forgot-password$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/recovery", async ({ page }) => {
|
||||
test("route: /ko/recovery", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/recovery");
|
||||
await expect(page).toHaveURL(/\/ko\/recovery$/);
|
||||
await expectRouteUrl(page, /\/ko\/recovery$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/reset-password", async ({ page }) => {
|
||||
test("route: /ko/reset-password", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/reset-password?token=e2e-reset-token");
|
||||
await expect(page).toHaveURL(
|
||||
await expectRouteUrl(
|
||||
page,
|
||||
/\/ko\/reset-password\?token=e2e-reset-token$/,
|
||||
testInfo,
|
||||
);
|
||||
});
|
||||
|
||||
test("route: /ko/error", async ({ page }) => {
|
||||
test("route: /ko/error", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/error?error=invalid_request");
|
||||
await expect(page).toHaveURL(/\/ko\/error\?error=invalid_request$/);
|
||||
await expectRouteUrl(page, /\/ko\/error\?error=invalid_request$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/settings", async ({ page }) => {
|
||||
test("route: /ko/settings", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/settings");
|
||||
await expect(page).toHaveURL(/\/ko\/settings$/);
|
||||
await expectRouteUrl(page, /\/ko\/settings$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/consent (missing challenge)", async ({ page }) => {
|
||||
test("route: /ko/consent (missing challenge)", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/consent");
|
||||
await expect(page).toHaveURL(/\/ko\/consent$/);
|
||||
await expectRouteUrl(page, /\/ko\/consent$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/consent?consent_challenge=...", async ({ page }) => {
|
||||
test("route: /ko/consent?consent_challenge=...", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
await page.goto("/ko/consent?consent_challenge=e2e-consent");
|
||||
await expect(page).toHaveURL(
|
||||
await expectRouteUrl(
|
||||
page,
|
||||
/\/ko\/consent\?consent_challenge=e2e-consent$/,
|
||||
testInfo,
|
||||
);
|
||||
});
|
||||
|
||||
test("route: /ko/approve?ref=...", async ({ page }) => {
|
||||
test("route: /ko/approve?ref=...", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/approve?ref=e2e-ref");
|
||||
await expect(page).toHaveURL(/\/ko\/signin\?notice=qr_login_required$/);
|
||||
await expectRouteUrl(
|
||||
page,
|
||||
/\/ko\/signin\?notice=qr_login_required$/,
|
||||
testInfo,
|
||||
);
|
||||
});
|
||||
|
||||
test("route: /ko/ql/:ref", async ({ page }) => {
|
||||
test("route: /ko/ql/:ref", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/ql/e2e-ref");
|
||||
await expect(page).toHaveURL(/\/ko\/signin\?notice=qr_login_required$/);
|
||||
await expectRouteUrl(
|
||||
page,
|
||||
/\/ko\/signin\?notice=qr_login_required$/,
|
||||
testInfo,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -292,44 +322,40 @@ test.describe("UserFront WASM route inventory (authed)", () => {
|
||||
await mockInventoryApis(page);
|
||||
});
|
||||
|
||||
test("route: /ko -> /ko/dashboard", async ({ page }) => {
|
||||
test("route: /ko -> /ko/dashboard", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko");
|
||||
await expect(page).toHaveURL(/\/ko\/dashboard$/);
|
||||
await expectRouteUrl(page, /\/ko\/dashboard$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/dashboard", async ({ page }) => {
|
||||
test("route: /ko/dashboard", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/dashboard");
|
||||
await expect(page).toHaveURL(/\/ko\/dashboard$/);
|
||||
await expectRouteUrl(page, /\/ko\/dashboard$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/profile", async ({ page }) => {
|
||||
test("route: /ko/profile", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/profile");
|
||||
await expect(page).toHaveURL(/\/ko\/profile$/);
|
||||
await expectRouteUrl(page, /\/ko\/profile$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/admin/users", async ({ page }) => {
|
||||
test("route: /ko/admin/users", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/admin/users");
|
||||
await expect(page).toHaveURL(/\/ko\/admin\/users$/);
|
||||
await expectRouteUrl(page, /\/ko\/admin\/users$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/scan", async ({ page }) => {
|
||||
test("route: /ko/scan", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/scan");
|
||||
await expect(page).toHaveURL(/\/ko\/scan$/);
|
||||
await expectRouteUrl(page, /\/ko\/scan$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/approve?ref=... -> /ko/dashboard", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
await page.goto("/ko/approve?ref=e2e-ref");
|
||||
await expect(page).toHaveURL(/\/ko\/dashboard$/, {
|
||||
timeout: testInfo.project.name === "webkit-desktop" ? 15_000 : 5_000,
|
||||
});
|
||||
await expectRouteUrl(page, /\/ko\/dashboard$/, testInfo);
|
||||
});
|
||||
|
||||
test("route: /ko/ql/:ref -> /ko/dashboard", async ({ page }, testInfo) => {
|
||||
await page.goto("/ko/ql/e2e-ref");
|
||||
await expect(page).toHaveURL(/\/ko\/dashboard$/, {
|
||||
timeout: testInfo.project.name === "webkit-desktop" ? 15_000 : 5_000,
|
||||
});
|
||||
await expectRouteUrl(page, /\/ko\/dashboard$/, testInfo);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user