mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-28 04:13:22 -04:00
add assertRealmsSorted to admin ui test functions
This commit is contained in:
parent
48a8ab9a6e
commit
d9f026057d
2 changed files with 13 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { test, expect } from "@playwright/test";
|
||||
import { test } from "@playwright/test";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import adminClient from "../utils/AdminClient.ts";
|
||||
import { DEFAULT_REALM } from "../utils/constants.ts";
|
||||
|
|
@ -21,6 +21,7 @@ import {
|
|||
goToRealmSection,
|
||||
getTextArea,
|
||||
assertTextAreaContains,
|
||||
assertRealmsSorted,
|
||||
} from "./realm.ts";
|
||||
|
||||
const testRealmName = `Test-realm-${uuid()}`;
|
||||
|
|
@ -123,12 +124,7 @@ test.describe.serial("Realm tests", () => {
|
|||
const realms = await page
|
||||
.locator(".pf-v5-c-table tr td:nth-child(2)")
|
||||
.allInnerTexts();
|
||||
expect(
|
||||
realms.every((value, index, realms) => {
|
||||
if (index === 0) return true;
|
||||
return realms[index - 1] <= value;
|
||||
}),
|
||||
).toBeTruthy();
|
||||
assertRealmsSorted(realms, 3);
|
||||
});
|
||||
|
||||
test("should disable preview if json very long", async ({ page }) => {
|
||||
|
|
|
|||
|
|
@ -50,3 +50,13 @@ export function getTextArea(page: Page) {
|
|||
export async function assertTextAreaContains(page: Page, content: string) {
|
||||
await expect(getTextArea(page)).toContainText(content);
|
||||
}
|
||||
|
||||
export function assertRealmsSorted(realms: string[], length: number) {
|
||||
expect(realms.length).toBeGreaterThanOrEqual(length);
|
||||
expect(
|
||||
realms.every((value, index, realms) => {
|
||||
if (index === 0) return true;
|
||||
return realms[index - 1] <= value;
|
||||
}),
|
||||
).toBeTruthy();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue