added eslint to admin-ui (#38226)

fixes: #38064

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2025-03-19 08:16:59 +01:00 committed by GitHub
parent 5073266039
commit fdc3632c8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 21 additions and 18 deletions

View File

@ -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) {

View File

@ -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 =

View File

@ -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(),
);
}

View File

@ -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();
}
}

View File

@ -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");

View File

@ -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) {

View File

@ -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/**"],