Merge pull request #2971 from mozilla/MNTOR-1356

MNTOR-1356: Add Settings E2E test
This commit is contained in:
mansaj 2023-04-07 10:19:04 -07:00 коммит произвёл GitHub
Родитель 96a18133e5 ec781761f2
Коммит ca1425ea4a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 35 добавлений и 4 удалений

Просмотреть файл

@ -7,7 +7,7 @@ import { LandingPage } from '../pages/landingPage.js'
import { AuthPage } from '../pages/authPage.js'
import { DashboardPage } from '../pages/dashBoardPage.js'
import { DataBreachPage } from '../pages/dataBreachPage.js'
import { SettingPage } from '../pages/settingsPage.js'
import { SettingsPage } from '../pages/settingsPage.js'
const test = base.extend({
authPage: async ({ page }, use) => {
@ -22,8 +22,8 @@ const test = base.extend({
dataBreachPage: async ({ page }, use) => {
await use(new DataBreachPage(page))
},
settingPage: async ({ page }, use) => {
await use(new SettingPage(page))
settingsPage: async ({ page }, use) => {
await use(new SettingsPage(page))
}
})

Просмотреть файл

@ -2,11 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
export class SettingPage {
export class SettingsPage {
constructor (page) {
this.page = page
this.settingsHeader = page.locator('.settings-title')
this.prefHeader = page.getByText(/Breach alert preferences/)
this.emailHeader = page.getByText(/Monitored email addresses/)
this.deactivateHeader = page.getByText(/Deactivate account/)
this.addEmailButton = page.getByText(/Add email address/)
}
async open () {

Просмотреть файл

@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { test, expect } from '../fixtures/basePage.js'
// bypass login
test.use({ storageState: './e2e/storageState.json' })
test.describe('Settings Page', () => {
test('Verify settings page loads', async ({
page,
settingsPage
}, testInfo) => {
// should go directly to data breach page
await settingsPage.open()
await expect(settingsPage.settingsHeader).toBeVisible()
await expect(settingsPage.prefHeader).toBeVisible()
await expect(settingsPage.emailHeader).toBeVisible()
await expect(settingsPage.deactivateHeader).toBeVisible()
await expect(settingsPage.addEmailButton).toBeVisible()
await testInfo.attach(`${process.env.E2E_TEST_ENV}-monitor-settings.png`, {
body: await page.screenshot(),
contentType: 'image/png'
})
})
})