Avoid reusing user1234
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -6,16 +6,25 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
|||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { expect, test } from "../../element-web-test";
|
import { expect, test as base } from "../../element-web-test";
|
||||||
import { selectHomeserver } from "../utils";
|
import { selectHomeserver } from "../utils";
|
||||||
import { emailHomeserver } from "../../plugins/homeserver/synapse/emailHomeserver.ts";
|
import { emailHomeserver } from "../../plugins/homeserver/synapse/emailHomeserver.ts";
|
||||||
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
||||||
|
import { Credentials } from "../../plugins/homeserver";
|
||||||
|
|
||||||
const username = "user1234";
|
|
||||||
// this has to be password-like enough to please zxcvbn. Needless to say it's just from pwgen.
|
|
||||||
const password = "oETo7MPf0o";
|
|
||||||
const email = "user@nowhere.dummy";
|
const email = "user@nowhere.dummy";
|
||||||
|
|
||||||
|
const test = base.extend<{ credentials: Pick<Credentials, "username" | "password"> }>({
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
|
credentials: async ({}, use, testInfo) => {
|
||||||
|
await use({
|
||||||
|
username: `user_${testInfo.testId}`,
|
||||||
|
// this has to be password-like enough to please zxcvbn. Needless to say it's just from pwgen.
|
||||||
|
password: "oETo7MPf0o",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
test.use(emailHomeserver);
|
test.use(emailHomeserver);
|
||||||
test.use({
|
test.use({
|
||||||
config: {
|
config: {
|
||||||
@@ -45,31 +54,35 @@ test.describe("Forgot Password", () => {
|
|||||||
await expect(page.getByRole("main")).toMatchScreenshot("forgot-password.png");
|
await expect(page.getByRole("main")).toMatchScreenshot("forgot-password.png");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("renders email verification dialog properly", { tag: "@screenshot" }, async ({ page, homeserver }) => {
|
test(
|
||||||
const user = await homeserver.registerUser(username, password);
|
"renders email verification dialog properly",
|
||||||
|
{ tag: "@screenshot" },
|
||||||
|
async ({ page, homeserver, credentials }) => {
|
||||||
|
const user = await homeserver.registerUser(credentials.username, credentials.password);
|
||||||
|
|
||||||
await homeserver.setThreepid(user.userId, "email", email);
|
await homeserver.setThreepid(user.userId, "email", email);
|
||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
|
|
||||||
await page.getByRole("link", { name: "Sign in" }).click();
|
await page.getByRole("link", { name: "Sign in" }).click();
|
||||||
await selectHomeserver(page, homeserver.baseUrl);
|
await selectHomeserver(page, homeserver.baseUrl);
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Forgot password?" }).click();
|
await page.getByRole("button", { name: "Forgot password?" }).click();
|
||||||
|
|
||||||
await page.getByRole("textbox", { name: "Email address" }).fill(email);
|
await page.getByRole("textbox", { name: "Email address" }).fill(email);
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Send email" }).click();
|
await page.getByRole("button", { name: "Send email" }).click();
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Next" }).click();
|
await page.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
await page.getByRole("textbox", { name: "New Password", exact: true }).fill(password);
|
await page.getByRole("textbox", { name: "New Password", exact: true }).fill(credentials.password);
|
||||||
await page.getByRole("textbox", { name: "Confirm new password", exact: true }).fill(password);
|
await page.getByRole("textbox", { name: "Confirm new password", exact: true }).fill(credentials.password);
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Reset password" }).click();
|
await page.getByRole("button", { name: "Reset password" }).click();
|
||||||
|
|
||||||
await expect(page.getByRole("button", { name: "Resend" })).toBeInViewport();
|
await expect(page.getByRole("button", { name: "Resend" })).toBeInViewport();
|
||||||
|
|
||||||
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("forgot-password-verify-email.png");
|
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("forgot-password-verify-email.png");
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ const test = base.extend<{
|
|||||||
test.describe("1:1 chat room", () => {
|
test.describe("1:1 chat room", () => {
|
||||||
test.use({
|
test.use({
|
||||||
displayName: "Jeff",
|
displayName: "Jeff",
|
||||||
user2: async ({ homeserver }, use) => {
|
user2: async ({ homeserver }, use, testInfo) => {
|
||||||
const credentials = await homeserver.registerUser("user1234", "p4s5W0rD", "Timmy");
|
const credentials = await homeserver.registerUser(`user2_${testInfo.testId}`, "p4s5W0rD", "Timmy");
|
||||||
await use(credentials);
|
await use(credentials);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user