refactor: Improve time and use waitForSelector in auto-login tests (#4603)
* improve usage of waitForSelector * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7d9315b356
commit
349a1fe284
1 changed files with 47 additions and 41 deletions
|
|
@ -47,7 +47,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
await page.locator('input[name="password"]').fill(randomPassword);
|
await page.locator('input[name="password"]').fill(randomPassword);
|
||||||
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
|
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector("#is_active", {
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
|
||||||
await page.locator("#is_active").click();
|
await page.locator("#is_active").click();
|
||||||
|
|
||||||
|
|
@ -55,22 +57,19 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
|
|
||||||
await page.waitForSelector("text=new user added", { timeout: 30000 });
|
await page.waitForSelector("text=new user added", { timeout: 30000 });
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
|
||||||
|
timeout: 2000,
|
||||||
expect(await page.getByText(randomName, { exact: true }).isVisible()).toBe(
|
});
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
await page.getByTestId("icon-Trash2").last().click();
|
await page.getByTestId("icon-Trash2").last().click();
|
||||||
await page.getByText("Delete", { exact: true }).last().click();
|
await page.getByText("Delete", { exact: true }).last().click();
|
||||||
|
|
||||||
await page.waitForSelector("text=user deleted", { timeout: 30000 });
|
await page.waitForSelector("text=user deleted", { timeout: 30000 });
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
|
||||||
|
timeout: 2000,
|
||||||
expect(await page.getByText(randomName, { exact: true }).isVisible()).toBe(
|
visible: false,
|
||||||
false,
|
});
|
||||||
);
|
|
||||||
|
|
||||||
await page.getByText("New User", { exact: true }).click();
|
await page.getByText("New User", { exact: true }).click();
|
||||||
|
|
||||||
|
|
@ -78,7 +77,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
await page.locator('input[name="password"]').fill(randomPassword);
|
await page.locator('input[name="password"]').fill(randomPassword);
|
||||||
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
|
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector("#is_active", {
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
|
||||||
await page.locator("#is_active").click();
|
await page.locator("#is_active").click();
|
||||||
|
|
||||||
|
|
@ -96,11 +97,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
|
|
||||||
await page.waitForSelector("text=user edited", { timeout: 30000 });
|
await page.waitForSelector("text=user edited", { timeout: 30000 });
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await expect(page.getByText(secondRandomName, { exact: true })).toBeVisible({
|
||||||
|
timeout: 2000,
|
||||||
expect(
|
});
|
||||||
await page.getByText(secondRandomName, { exact: true }).isVisible(),
|
|
||||||
).toBe(true);
|
|
||||||
|
|
||||||
//user must see just your own flows
|
//user must see just your own flows
|
||||||
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
|
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
|
||||||
|
|
@ -125,7 +124,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
|
|
||||||
while (modalCount === 0) {
|
while (modalCount === 0) {
|
||||||
await page.getByText("New Flow", { exact: true }).click();
|
await page.getByText("New Flow", { exact: true }).click();
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForSelector('[data-testid="modal-title"]', {
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
modalCount = await page.getByTestId("modal-title")?.count();
|
modalCount = await page.getByTestId("modal-title")?.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +152,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
state: "visible",
|
state: "visible",
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
|
||||||
await page.getByTestId("icon-ChevronLeft").first().click();
|
await page.getByTestId("icon-ChevronLeft").first().click();
|
||||||
|
|
||||||
|
|
@ -160,13 +163,13 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
state: "visible",
|
state: "visible",
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForTimeout(2000);
|
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
|
||||||
|
timeout: 2000,
|
||||||
|
});
|
||||||
|
|
||||||
expect(
|
await page.waitForSelector("[data-testid='user-profile-settings']", {
|
||||||
await page.getByText(randomFlowName, { exact: true }).last().isVisible(),
|
timeout: 1500,
|
||||||
).toBe(true);
|
});
|
||||||
|
|
||||||
await page.waitForTimeout(500);
|
|
||||||
|
|
||||||
await page.getByTestId("user-profile-settings").click();
|
await page.getByTestId("user-profile-settings").click();
|
||||||
|
|
||||||
|
|
@ -176,7 +179,10 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
|
|
||||||
await page.getByPlaceholder("Username").fill(secondRandomName);
|
await page.getByPlaceholder("Username").fill(secondRandomName);
|
||||||
await page.getByPlaceholder("Password").fill(randomPassword);
|
await page.getByPlaceholder("Password").fill(randomPassword);
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
await page.waitForSelector("text=Sign in", {
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Sign In" }).click();
|
await page.getByRole("button", { name: "Sign In" }).click();
|
||||||
|
|
||||||
|
|
@ -197,7 +203,9 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
|
|
||||||
while (modalCount === 0) {
|
while (modalCount === 0) {
|
||||||
await page.getByText("New Flow", { exact: true }).click();
|
await page.getByText("New Flow", { exact: true }).click();
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForSelector('[data-testid="modal-title"]', {
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
modalCount = await page.getByTestId("modal-title")?.count();
|
modalCount = await page.getByTestId("modal-title")?.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,17 +242,16 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await expect(
|
||||||
|
page.getByText(secondRandomFlowName, { exact: true }),
|
||||||
|
).toBeVisible({
|
||||||
|
timeout: 2000,
|
||||||
|
});
|
||||||
|
|
||||||
expect(
|
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
|
||||||
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
|
timeout: 2000,
|
||||||
).toBe(true);
|
visible: false,
|
||||||
|
});
|
||||||
await page.waitForTimeout(500);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
await page.getByText(randomFlowName, { exact: true }).isVisible(),
|
|
||||||
).toBe(false);
|
|
||||||
|
|
||||||
await page.getByTestId("user-profile-settings").click();
|
await page.getByTestId("user-profile-settings").click();
|
||||||
|
|
||||||
|
|
@ -268,9 +275,8 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
|
||||||
expect(
|
expect(
|
||||||
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
|
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
|
||||||
).toBe(false);
|
).toBe(false);
|
||||||
await page.waitForTimeout(500);
|
|
||||||
|
|
||||||
expect(
|
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
|
||||||
await page.getByText(randomFlowName, { exact: true }).isVisible(),
|
timeout: 2000,
|
||||||
).toBe(true);
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue