2022-09-02 02:00:48 +00:00
|
|
|
import { expect } from "@playwright/test";
|
|
|
|
|
|
|
|
import { test } from "./lib/fixtures";
|
|
|
|
|
|
|
|
test.afterEach(({ users }) => users.deleteAll());
|
|
|
|
|
2022-09-07 23:29:24 +00:00
|
|
|
test.describe("Change Password Test", () => {
|
2022-09-02 02:00:48 +00:00
|
|
|
test("change password", async ({ page, users }) => {
|
|
|
|
const pro = await users.create();
|
2023-06-06 18:02:32 +00:00
|
|
|
await pro.apiLogin();
|
2022-09-02 02:00:48 +00:00
|
|
|
// Go to http://localhost:3000/settings/security
|
2022-09-15 16:59:48 +00:00
|
|
|
await page.goto("/settings/security/password");
|
2023-06-06 11:59:57 +00:00
|
|
|
|
|
|
|
expect(pro.username).toBeTruthy();
|
2022-09-02 02:00:48 +00:00
|
|
|
|
2022-09-15 16:59:48 +00:00
|
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
|
2022-09-02 02:00:48 +00:00
|
|
|
// Fill form
|
2023-06-06 11:59:57 +00:00
|
|
|
await page.locator('[name="oldPassword"]').fill(String(pro.username));
|
2022-09-15 16:59:48 +00:00
|
|
|
|
|
|
|
const $newPasswordField = page.locator('[name="newPassword"]');
|
|
|
|
$newPasswordField.fill(`${pro.username}Aa1111`);
|
|
|
|
|
|
|
|
await page.locator("text=Update").click();
|
2022-09-02 02:00:48 +00:00
|
|
|
|
2023-07-25 22:27:14 +00:00
|
|
|
const toast = await page.waitForSelector('[data-testid="toast-success"]');
|
2022-09-09 08:54:10 +00:00
|
|
|
|
2023-03-01 20:18:51 +00:00
|
|
|
expect(toast).toBeTruthy();
|
2022-09-02 02:00:48 +00:00
|
|
|
});
|
|
|
|
});
|