Adding login tests using test user 09111111111
Some checks failed
Playwright Tests / test (push) Has been cancelled
Some checks failed
Playwright Tests / test (push) Has been cancelled
This commit is contained in:
30
tests/auth/login.spec.ts
Normal file
30
tests/auth/login.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { test, expect, type Page } from "@playwright/test";
|
||||||
|
|
||||||
|
const LOGIN_URL = "/auth/login?returnUrl=/admin";
|
||||||
|
|
||||||
|
const getPhoneInput = (page: Page) =>
|
||||||
|
page.getByRole("spinbutton", { name: "شماره موبایل" });
|
||||||
|
const getContinueButton = (page: Page) =>
|
||||||
|
page.getByRole("button", { name: "ادامه" });
|
||||||
|
const getPasswordInput = (page: Page) =>
|
||||||
|
page.getByRole("textbox", { name: "کلمه عبور" });
|
||||||
|
const getLoginButton = (page: Page) =>
|
||||||
|
page.getByRole("button", { name: "ورود" });
|
||||||
|
|
||||||
|
test.describe("login tests - 09111111111", () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto(LOGIN_URL);
|
||||||
|
await getPhoneInput(page).fill("09111111111");
|
||||||
|
await getContinueButton(page).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should have password", async ({ page }) => {
|
||||||
|
await expect(getPasswordInput(page)).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should redirect to /admin on successful login", async ({ page }) => {
|
||||||
|
await getPasswordInput(page).fill("123456");
|
||||||
|
await getLoginButton(page).click();
|
||||||
|
await expect(page).toHaveURL("https://dev-gate.raysa.app/admin");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user