From 45371176247889e7245f3b0d84f832f55d7216ba Mon Sep 17 00:00:00 2001 From: Flemming Date: Tue, 4 Jan 2022 18:18:49 +0100 Subject: [PATCH] [WIP] Create password change test (#1333) --- playwright/change-password.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 playwright/change-password.test.ts diff --git a/playwright/change-password.test.ts b/playwright/change-password.test.ts new file mode 100644 index 0000000000..6dbd520f08 --- /dev/null +++ b/playwright/change-password.test.ts @@ -0,0 +1,28 @@ +import { expect, test } from "@playwright/test"; + +// Using logged in state from globalSteup +test.use({ storageState: "playwright/artifacts/proStorageState.json" }); + +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]"); + + // Go to http://localhost:3000/settings/security + await page.goto("/settings/security"); + + // Fill form + await page.fill('[name="current_password"]', "pro"); + await page.fill('[name="new_password"]', "pro1"); + await page.press('[name="new_password"]', "Enter"); + + expect(page.locator(`text=Your password has been successfully changed.`)).toBeTruthy(); + + // 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"); + + expect(page.locator(`text=Your password has been successfully changed.`)).toBeTruthy(); +});