Skip to content

Commit 2e0d85b

Browse files
committed
Properly extract URL
1 parent 55fa279 commit 2e0d85b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/main.spec.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,21 @@ test('register an account', async ({ page }) => {
4343
// 1. Remove soft line breaks (quoted-printable)
4444
const cleanedBody = body.replace(/=\r?\n/g, '');
4545

46-
// 2. Extract the URL
47-
const match = cleanedBody.match(/\[Verify\]\((http[^\s\)]+)\)/);
48-
const verifyLink = match ? match[1] : null;
46+
const match = cleanedBody.match(/\[Verify\]\((.*)\)/i);
4947

50-
console.log(verifyLink);
48+
const cleanedVerifyLink = match ? match[1] : null;
49+
50+
console.log(cleanedVerifyLink);
51+
52+
// thread sleep
53+
await new Promise(resolve => setTimeout(resolve, 30000));
5154

5255
// Go to the verification link
53-
await page.goto(verifyLink);
56+
await page.goto(cleanedVerifyLink);
5457

5558
// Check if the verification was successful, page should include a div with the text "Email address verified. You can now log in."
56-
await page.waitForURL(new RegExp(`${host}/auth/login`));
59+
await page.waitForURL(new RegExp(`${host}/auth/login?__flash=.+`));
60+
5761
const loginMessage = await page.locator('div').filter({ hasText: /Your account has been verified*/i });
5862

5963
expect(await successMessage.count()).toBe(1);

0 commit comments

Comments
 (0)