-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
97 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,38 @@ | ||
// @ts-check | ||
import { test, expect } from '@playwright/test'; | ||
import { faker } from '@faker-js/faker'; | ||
import { login, registerUser } from './helpers/login.js'; | ||
import { forgotPassword, login, registerUser } from './helpers/login.js'; | ||
import { inviteUserToGroup, updateGroup } from './helpers/admin.js'; | ||
import { createDraftedGroup, createNewGroup } from './helpers/setup.js'; | ||
import { sendMessage } from './helpers/chat.js'; | ||
|
||
test.describe('email tests', () => { | ||
|
||
test.describe('admin tests', () => { | ||
test('user should receive an email when forgot password is triggered', async ({ | ||
page, | ||
}) => { | ||
const user = { | ||
email: faker.internet.email(), | ||
password: faker.internet.password(), | ||
}; | ||
await registerUser(page.request, user); | ||
const response = await forgotPassword(page.request, user.email); | ||
const responseJson = await response.json(); | ||
await expect(responseJson).toHaveProperty('emailUrl'); | ||
await page.goto(responseJson.emailUrl); | ||
|
||
await expect(page).toHaveScreenshot('forgot-password-email.png', { | ||
mask: [ | ||
page.locator('.mp_address_group').nth(1), | ||
page.locator('.datestring'), | ||
// Message-ID | ||
page.locator('#message-header div').nth(4).locator('span'), | ||
page.frameLocator('[style]').locator('#email-placeholder'), | ||
page.frameLocator('[style]').locator('#password-placeholder'), | ||
], | ||
fullPage: true, | ||
}); | ||
}); | ||
|
||
test('new user receives an email when invited to the group', async ({ | ||
page, | ||
|
@@ -44,7 +68,6 @@ test.describe('email tests', () => { | |
await page.goto(bodyWithUrl.emailUrl); | ||
|
||
await expect(page).toHaveScreenshot('invite-email.png', { | ||
maxDiffPixelRatio: 0.05, | ||
mask: [ | ||
page.locator('.mp_address_group').nth(1), | ||
page.locator('.datestring'), | ||
|
@@ -53,6 +76,7 @@ test.describe('email tests', () => { | |
page.frameLocator('[style]').locator('#group-placeholder'), | ||
page.frameLocator('[style]').locator('#password-placeholder'), | ||
], | ||
fullPage: true, | ||
}); | ||
}); | ||
|
||
|
@@ -88,7 +112,6 @@ test.describe('email tests', () => { | |
await page.goto(bodyWithUrl.emailUrl); | ||
|
||
await expect(page).toHaveScreenshot('invite-email.png', { | ||
maxDiffPixelRatio: 0.05, | ||
mask: [ | ||
page.locator('.mp_address_group').nth(1), | ||
page.locator('.datestring'), | ||
|
@@ -97,12 +120,12 @@ test.describe('email tests', () => { | |
page.frameLocator('[style]').locator('#group-placeholder'), | ||
page.frameLocator('[style]').locator('#password-placeholder'), | ||
], | ||
fullPage: true, | ||
}); | ||
}); | ||
}) | ||
}); | ||
|
||
test.describe('chat tests', () => { | ||
|
||
test('user should receive a chat email', async ({ page }) => { | ||
const groupData = await createDraftedGroup(page.request); | ||
const updatedGroupData = { | ||
|
@@ -131,7 +154,9 @@ test.describe('email tests', () => { | |
await expect(page.locator('#message-header')).toContainText( | ||
'<[email protected]>' | ||
); | ||
await expect(page.locator('#message-header')).toContainText(message.email); | ||
await expect(page.locator('#message-header')).toContainText( | ||
message.email | ||
); | ||
await expect( | ||
page.frameLocator('#message iframe').locator('body') | ||
).toContainText(message.message); | ||
|
@@ -152,5 +177,5 @@ test.describe('email tests', () => { | |
const messageData = await sendMessage(page.request, message); | ||
await expect(messageData).not.toHaveProperty('emailUrl'); | ||
}); | ||
}) | ||
}); | ||
}); |
Binary file added
BIN
+226 KB
tests/email.spec.js-snapshots/forgot-password-email-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
tests/email.spec.js-snapshots/invite-email-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters