mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
added eslint to admin-ui (#38226)
fixes: #38064 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
5073266039
commit
fdc3632c8f
@ -10,10 +10,8 @@ export async function assertSupportedApplications(
|
||||
page: Page,
|
||||
applications: string[],
|
||||
) {
|
||||
const supportedApplications = await page
|
||||
.getByTestId("supportedApplications")
|
||||
.textContent();
|
||||
expect(supportedApplications).toEqual(applications.join(""));
|
||||
const supportedApplications = page.getByTestId("supportedApplications");
|
||||
await expect(supportedApplications).toHaveText(applications.join(""));
|
||||
}
|
||||
|
||||
export async function setPolicyType(page: Page, type: string) {
|
||||
|
||||
@ -27,7 +27,11 @@ export async function assertTestClusterAvailability(
|
||||
expected: boolean = true,
|
||||
) {
|
||||
const button = page.getByTestId("test-cluster-availability");
|
||||
expect(await button.isDisabled()).toBe(!expected);
|
||||
if (expected) {
|
||||
await expect(button).toBeEnabled();
|
||||
} else {
|
||||
await expect(button).toBeDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteClusterNode(page: Page, host: string) {
|
||||
@ -91,11 +95,12 @@ export async function assertTokenLifespanClientOfflineSessionMaxVisible(
|
||||
page: Page,
|
||||
visible: boolean,
|
||||
) {
|
||||
expect(
|
||||
await page
|
||||
.getByTestId("token-lifespan-clientOfflineSessionMax")
|
||||
.isVisible(),
|
||||
).toBe(visible);
|
||||
const locator = page.getByTestId("token-lifespan-clientOfflineSessionMax");
|
||||
if (visible) {
|
||||
await expect(locator).toBeVisible();
|
||||
} else {
|
||||
await expect(locator).toBeHidden();
|
||||
}
|
||||
}
|
||||
|
||||
const oAuthMutualSwitch =
|
||||
|
||||
@ -128,7 +128,7 @@ export async function assertClipboardHasText(page: Page) {
|
||||
const clipboardText = await page.evaluateHandle(() =>
|
||||
navigator.clipboard.readText(),
|
||||
);
|
||||
expect(page.getByTestId("authorization-export-code-editor")).toHaveText(
|
||||
await expect(page.getByTestId("authorization-export-code-editor")).toHaveText(
|
||||
await clipboardText.jsonValue(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -82,9 +82,9 @@ async function assertElementExists(
|
||||
exist: boolean = true,
|
||||
) {
|
||||
if (exist) {
|
||||
expect(page.locator(locator)).toBeVisible();
|
||||
await expect(page.locator(locator)).toBeVisible();
|
||||
} else {
|
||||
expect(page.locator(locator)).not.toBeVisible();
|
||||
await expect(page.locator(locator)).toBeHidden();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ test.describe("Realm settings general tab tests", () => {
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
|
||||
test("Test all general tab switches", async ({ page }) => {
|
||||
test("all general tab switches", async ({ page }) => {
|
||||
await switchOn(page, "#userManagedAccessAllowed");
|
||||
await clickSaveRealm(page);
|
||||
await assertNotificationMessage(page, "Realm successfully updated");
|
||||
@ -61,7 +61,7 @@ test.describe("Realm settings general tab tests", () => {
|
||||
await assertNotificationMessage(page, "Realm successfully updated");
|
||||
});
|
||||
|
||||
test("Test realm enable/disable switch", async ({ page }) => {
|
||||
test("realm enable/disable switch", async ({ page }) => {
|
||||
// Enable realm
|
||||
await switchOn(page, `#${realmName}-switch`);
|
||||
await assertNotificationMessage(page, "Realm successfully updated");
|
||||
|
||||
@ -23,8 +23,8 @@ export async function selectItem(
|
||||
}
|
||||
|
||||
export async function assertSelectValue(field: Locator, value: string) {
|
||||
const text = await field.textContent();
|
||||
expect(text).toBe(value);
|
||||
const text = field;
|
||||
await expect(text).toHaveText(value);
|
||||
}
|
||||
|
||||
export async function switchOn(page: Page, id: string | Locator) {
|
||||
|
||||
@ -138,7 +138,7 @@ export default tseslint.config(
|
||||
},
|
||||
{
|
||||
...playwright.configs["flat/recommended"],
|
||||
files: ["apps/account-ui/test/**"],
|
||||
files: ["apps/account-ui/test/**", "apps/admin-ui/test/**"],
|
||||
},
|
||||
{
|
||||
files: ["libs/keycloak-admin-client/test/**"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user