2022-01-04 17:18:49 +00:00
|
|
|
import { expect, test } from "@playwright/test";
|
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
test.describe("Change Passsword Test", () => {
|
|
|
|
// Using logged in state from globalSteup
|
|
|
|
test.use({ storageState: "playwright/artifacts/proStorageState.json" });
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
test("change password", async ({ page }) => {
|
|
|
|
// Try to go homepage
|
|
|
|
await page.goto("/");
|
|
|
|
// It should redirect you to the event-types page
|
|
|
|
await page.waitForSelector("[data-testid=event-types]");
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
// Go to http://localhost:3000/settings/security
|
|
|
|
await page.goto("/settings/security");
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
// Fill form
|
|
|
|
await page.fill('[name="current_password"]', "pro");
|
|
|
|
await page.fill('[name="new_password"]', "pro1");
|
|
|
|
await page.press('[name="new_password"]', "Enter");
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
await expect(page.locator(`text=Your password has been successfully changed.`)).toBeVisible();
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
// Let's revert back to prevent errors on other tests
|
|
|
|
await page.fill('[name="current_password"]', "pro1");
|
|
|
|
await page.fill('[name="new_password"]', "pro");
|
|
|
|
await page.press('[name="new_password"]', "Enter");
|
2022-01-04 17:18:49 +00:00
|
|
|
|
2022-03-17 19:36:11 +00:00
|
|
|
await expect(page.locator(`text=Your password has been successfully changed.`)).toBeVisible();
|
|
|
|
});
|
2022-01-04 17:18:49 +00:00
|
|
|
});
|