@@ -27,15 +27,11 @@ export async function registerAccountMas(
|
|||||||
await page.getByRole("textbox", { name: "Confirm Password" }).fill(password);
|
await page.getByRole("textbox", { name: "Confirm Password" }).fill(password);
|
||||||
await page.getByRole("button", { name: "Continue" }).click();
|
await page.getByRole("button", { name: "Continue" }).click();
|
||||||
|
|
||||||
let summary: MailpitMessagesSummaryResponse;
|
let code: string;
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
summary = await mailpit.listMessages();
|
const text = await mailpit.renderMessageText();
|
||||||
expect(summary.messages_count).toBe(1);
|
[, code] = text.match(/Your verification code to confirm this email address is: (\d{6})/);
|
||||||
}).toPass();
|
}).toPass();
|
||||||
expect(summary.messages[0].To[0].Address).toEqual(email);
|
|
||||||
const [, code] = summary.messages[0].Snippet.match(
|
|
||||||
/Your verification code to confirm this email address is: (\d{6})/,
|
|
||||||
);
|
|
||||||
|
|
||||||
await page.getByRole("textbox", { name: "6-digit code" }).fill(code);
|
await page.getByRole("textbox", { name: "6-digit code" }).fill(code);
|
||||||
await page.getByRole("button", { name: "Continue" }).click();
|
await page.getByRole("button", { name: "Continue" }).click();
|
||||||
|
|||||||
@@ -51,10 +51,9 @@ test.describe("Email Registration", async () => {
|
|||||||
|
|
||||||
await expect(page.getByText("An error was encountered when sending the email")).not.toBeVisible();
|
await expect(page.getByText("An error was encountered when sending the email")).not.toBeVisible();
|
||||||
|
|
||||||
const summary = await mailpitClient.listMessages();
|
const { Links: links } = await mailpitClient.linkCheck();
|
||||||
expect(summary.messages_count).toBe(1);
|
expect(links).toHaveLength(1);
|
||||||
expect(summary.messages[0].To[0].Address).toEqual("alice@email.com");
|
const emailLink = links[0].URL;
|
||||||
const [emailLink] = summary.messages[0].Snippet.match(/http.+/);
|
|
||||||
await request.get(emailLink); // "Click" the link in the email
|
await request.get(emailLink); // "Click" the link in the email
|
||||||
|
|
||||||
await expect(page.getByText("Welcome alice")).toBeVisible();
|
await expect(page.getByText("Welcome alice")).toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user