Skip to content

Commit

Permalink
Test admins can update user passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyUnderStars committed May 22, 2024
1 parent 5c78fc8 commit 1db3f76
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion system/modules/admin/tests/acceptance/playwright/admin.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
import { expect, test } from "@playwright/test";
import { GLOBAL_TIMEOUT, CmfiveHelper } from "@utils/cmfive";
import { AdminHelper } from "@utils/admin";
import { CmfiveHelper, GLOBAL_TIMEOUT, HOST } from "@utils/cmfive";

test.describe.configure({mode: 'parallel'});

test("Admin can update password of user", async ({ page }) => {
test.setTimeout(GLOBAL_TIMEOUT);
CmfiveHelper.acceptDialog(page);

await CmfiveHelper.login(page, "admin", "admin");

const user = CmfiveHelper.randomID("user_");
await AdminHelper.createUser(
page,
user,
user + "_password",
user + "_firstName",
user + "_lastName",
user + "@localhost.com"
);

await page.goto(`${HOST}/admin/users`);

const row = CmfiveHelper.getRowByText(page, user);
const edit = row.getByRole("button", { name: "Edit" });
await edit.click();

const security = page.getByRole('link', { name: 'Security' });
await security.waitFor();
await security.click();

await page.getByLabel('New Password', { exact: true }).fill("test password");
await page.getByLabel('Repeat New Password', { exact: true }).fill("test password");
await page.getByRole('button', { name: 'Update Password' }).click();

await CmfiveHelper.logout(page);

await CmfiveHelper.login(page, user, "test password");
});

test("Test that an admin can create and delete a user", async ({ page }) => {
test.setTimeout(GLOBAL_TIMEOUT);
CmfiveHelper.acceptDialog(page);
Expand Down

0 comments on commit 1db3f76

Please sign in to comment.