8000 Stabilize test execution to work with and without users by ahus1 · Pull Request #52432 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions js/apps/admin-ui/test/realm-settings/userprofile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
clickAddValidator,
clickCancelAttribute,
clickCreateAttribute,
clickCreateUser,
clickSaveAttribute,
clickSaveValidator,
fillAttributeForm,
Expand Down Expand Up @@ -146,7 +147,7 @@ test.describe.serial("User profile tabs", () => {
await switchOn(page, "#kc-edit-username-switch");

await goToUsers(page);
await page.getByTestId("no-users-found-empty-action").click();
await clickCreateUser(page);
await expect(page.getByTestId(attrName)).toBeHidden();
await page.getByTestId("username").fill("testuser7");
await page.getByTestId("user-creation-save").click();
Expand All @@ -168,7 +169,7 @@ test.describe.serial("User profile tabs", () => {
await switchOn(page, "#kc-email-as-username-switch");

await goToUsers(page);
await page.getByTestId("no-users-found-empty-action").click();
await clickCreateUser(page);
await page.getByTestId("email").fill("testuser8@gmail.com");
await expect(page.getByTestId(attrName)).toBeHidden();
await page.getByTestId("user-creation-save").click();
Expand Down Expand Up @@ -196,7 +197,7 @@ test.describe.serial("User profile tabs", () => {
await switchOffIfOn(page, "#kc-email-as-username-switch");

await goToUsers(page);
await page.getByTestId("no-users-found-empty-action").click();
await clickCreateUser(page);
await expect(page.getByTestId(attrName)).toBeVisible();
await page.getByTestId("username").fill("testuser10");
await page.getByTestId("user-creation-save").click();
Expand All @@ -221,7 +222,7 @@ test.describe.serial("User profile tabs", () => {
await clickSaveAttribute(page);

await goToUsers(page);
await page.getByTestId("no-users-found-empty-action").click();
await clickCreateUser(page);
await expect(page.getByTestId(attrName)).toBeVisible();
await page.getByTestId("username").fill("testuser11");
await page.getByTestId("user-creation-save").click();
Expand Down Expand Up @@ -255,7 +256,7 @@ test.describe.serial("User profile tabs", () => {
);

await goToUsers(page);
await page.getByTestId("no-users-found-empty-action").click();
await clickCreateUser(page);

await expect(page.getByRole("heading", { name: group })).toBeVisible();
});
Expand Down
7 changes: 7 additions & 0 deletions js/apps/admin-ui/test/realm-settings/userprofile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export async function goToAttributeGroupsTab(page: Page) {
await page.getByTestId("attributesGroupTab").click();
}

export async function clickCreateUser(page: Page) {
await page
.getByTestId("no-users-found-empty-action")
.or(page.getByTestId("add-user"))
.click({ timeout: 15_000 });
}

export async function switchOffIfOn(page: Page, selector: string) {
if (await page.isChecked(selector)) {
await page.locator(selector).click({ force: true });
Expand Down
Loading
0