forked from baron/baron-sso
devfront RP 상세 탭 i18n 및 순서 일관화
This commit is contained in:
68
devfront/tests/devfront-client-tabs.spec.ts
Normal file
68
devfront/tests/devfront-client-tabs.spec.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { type Page, expect, test } from "@playwright/test";
|
||||
import {
|
||||
type ClientRelation,
|
||||
type Consent,
|
||||
installDevApiMock,
|
||||
makeClient,
|
||||
seedAuth,
|
||||
} from "./helpers/devfront-fixtures";
|
||||
|
||||
function expectClientTabsOrder(pagePath: string, expectedActive: RegExp) {
|
||||
return async ({ page }: { page: Page }) => {
|
||||
const state = {
|
||||
clients: [makeClient("client-tabs", { name: "탭 테스트 앱" })],
|
||||
consents: [] as Consent[],
|
||||
relations: {
|
||||
"client-tabs": [
|
||||
{
|
||||
relation: "config_editor",
|
||||
subject: "User:user-1",
|
||||
subjectType: "User",
|
||||
subjectId: "user-1",
|
||||
},
|
||||
] satisfies ClientRelation[],
|
||||
},
|
||||
auditLogsByCursor: undefined,
|
||||
};
|
||||
await installDevApiMock(page, state);
|
||||
|
||||
await page.goto(pagePath);
|
||||
|
||||
const header = page
|
||||
.locator("header")
|
||||
.filter({ hasText: "탭 테스트 앱" })
|
||||
.first();
|
||||
const tabs = header.locator(
|
||||
"div.border-b.border-border .whitespace-nowrap",
|
||||
);
|
||||
|
||||
await expect(tabs).toHaveText([
|
||||
"연동 설정",
|
||||
"동의 및 사용자",
|
||||
"설정",
|
||||
"관계",
|
||||
]);
|
||||
|
||||
await expect(
|
||||
header
|
||||
.locator("div.border-b.border-border .text-primary")
|
||||
.filter({ hasText: expectedActive }),
|
||||
).toHaveCount(1);
|
||||
};
|
||||
}
|
||||
|
||||
test.describe("DevFront client detail tabs", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await seedAuth(page, "rp_admin");
|
||||
});
|
||||
|
||||
test(
|
||||
"settings page keeps tab order and uses localized relationships label",
|
||||
expectClientTabsOrder("/clients/client-tabs/settings", /^설정$/),
|
||||
);
|
||||
|
||||
test(
|
||||
"relationships page keeps tab order and uses localized relationships label",
|
||||
expectClientTabsOrder("/clients/client-tabs/relationships", /^관계$/),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user