-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): fix overlapping e2e reports
- Loading branch information
1 parent
940d474
commit d8f0b21
Showing
10 changed files
with
157 additions
and
150 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,16 @@ const consentCheckbox = 'Yes, I want to receive Blender updates by email'; | |
const firstName = 'John Q.'; | ||
const lastName = 'Tester'; | ||
|
||
Feature(`account`).retry(Number(process.env.TEST_RETRY_COUNT) || 0); | ||
|
||
runTestSuite(testConfigs.jwpSvod, 'JW Player', 'direct', false); | ||
runTestSuite(testConfigs.svod, 'Cleeng', 'resetLink', true); | ||
|
||
function runTestSuite(config: typeof testConfigs.svod, providerName: string, resetPasswordType: string, canEditEmail: boolean) { | ||
let loginContext: LoginContext; | ||
|
||
Feature(`account - ${providerName}`).retry(Number(process.env.TEST_RETRY_COUNT) || 0); | ||
|
||
Before(async ({ I }) => { | ||
async function beforeScenario(I: CodeceptJS.I) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
I.useConfig(config); | ||
|
||
loginContext = await I.registerOrLogin(loginContext, () => { | ||
|
@@ -34,9 +35,11 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
|
||
I.clickCloseButton(); | ||
}); | ||
}); | ||
} | ||
|
||
Scenario(`I can see my account data - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
I.seeInCurrentUrl(constants.baseUrl); | ||
await I.openMainMenu(); | ||
|
||
|
@@ -73,6 +76,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I can cancel Edit account - ${providerName}`, async ({ I }) => { | ||
if (!canEditEmail) return; | ||
|
||
await beforeScenario(I); | ||
|
||
editAndCancel(I, editAccount, [ | ||
{ name: emailField, startingValue: loginContext.email, newValue: '[email protected]' }, | ||
{ name: passwordField, startingValue: '', newValue: 'pass123!?' }, | ||
|
@@ -82,6 +87,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I get a duplicate email warning - ${providerName}`, async ({ I }) => { | ||
if (!canEditEmail) return; | ||
|
||
await beforeScenario(I); | ||
|
||
editAndCancel(I, editAccount, [ | ||
{ | ||
name: emailField, | ||
|
@@ -100,6 +107,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I get a wrong password warning - ${providerName}`, async ({ I }) => { | ||
if (!canEditEmail) return; | ||
|
||
await beforeScenario(I); | ||
|
||
editAndCancel(I, editAccount, [ | ||
{ | ||
name: emailField, | ||
|
@@ -118,6 +127,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I can toggle to view/hide my password - ${providerName}`, async ({ I }) => { | ||
if (!canEditEmail) return; | ||
|
||
await beforeScenario(I); | ||
|
||
I.amOnPage(constants.accountsUrl); | ||
I.click(editAccount); | ||
await passwordUtils.testPasswordToggling(I, 'confirmationPassword'); | ||
|
@@ -126,6 +137,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I can reset my password (reset link) - ${providerName}`, async ({ I }) => { | ||
if (resetPasswordType !== 'resetlink') return; | ||
|
||
await beforeScenario(I); | ||
|
||
I.amOnPage(constants.accountsUrl); | ||
|
||
I.click('Edit password'); | ||
|
@@ -154,6 +167,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
}); | ||
|
||
Scenario(`I can update firstName - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
editAndSave(I, editDetails, [ | ||
{ | ||
name: firstNameField, | ||
|
@@ -177,6 +192,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
}); | ||
|
||
Scenario(`I can update lastName - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
editAndSave(I, editDetails, [ | ||
{ | ||
name: lastNameField, | ||
|
@@ -200,6 +217,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
}); | ||
|
||
Scenario(`I can update details - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
editAndSave(I, editDetails, [ | ||
{ | ||
name: firstNameField, | ||
|
@@ -235,6 +254,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
}); | ||
|
||
Scenario(`I see name limit errors - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
editAndCancel(I, editDetails, [ | ||
{ | ||
name: firstNameField, | ||
|
@@ -252,6 +273,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
}); | ||
|
||
Scenario(`I can update my consents - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
I.amOnPage(constants.accountsUrl); | ||
I.waitForText('Account info', longTimeout); | ||
I.scrollTo('//*[text() = "Legal & Marketing"]', undefined, -100); | ||
|
@@ -288,6 +311,8 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
Scenario(`I can change email - ${providerName}`, async ({ I }) => { | ||
if (!canEditEmail) return; | ||
|
||
await beforeScenario(I); | ||
|
||
const newEmail = passwordUtils.createRandomEmail(); | ||
|
||
editAndSave(I, editAccount, [ | ||
|
@@ -305,7 +330,15 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
]); | ||
}); | ||
|
||
function editAndSave(I: CodeceptJS.I, editButton: string, fields: { name: string; newValue: string; expectedError?: string }[]) { | ||
function editAndSave( | ||
I: CodeceptJS.I, | ||
editButton: string, | ||
fields: { | ||
name: string; | ||
newValue: string; | ||
expectedError?: string; | ||
}[], | ||
) { | ||
I.amOnPage(constants.accountsUrl); | ||
I.waitForElement(`//*[text() = "${editButton}"]`, normalTimeout); | ||
I.scrollTo(`//*[text() = "${editButton}"]`); | ||
|
@@ -354,7 +387,16 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string, res | |
I.click('Cancel'); | ||
} | ||
|
||
function editAndCancel(I: CodeceptJS.I, editButton: string, fields: { name: string; startingValue: string; newValue: string; expectedError?: string }[]) { | ||
function editAndCancel( | ||
I: CodeceptJS.I, | ||
editButton: string, | ||
fields: { | ||
name: string; | ||
startingValue: string; | ||
newValue: string; | ||
expectedError?: string; | ||
}[], | ||
) { | ||
I.amOnPage(constants.accountsUrl); | ||
I.click(editButton); | ||
|
||
|
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 |
---|---|---|
|
@@ -2,35 +2,39 @@ import { testConfigs } from '@jwp/ott-testing/constants'; | |
|
||
import constants, { normalTimeout } from '#utils/constants'; | ||
import passwordUtils from '#utils/password_utils'; | ||
import { tryToSubmitForm, fillAndCheckField, checkField } from '#utils/login'; | ||
import { checkField, fillAndCheckField, tryToSubmitForm } from '#utils/login'; | ||
|
||
const fieldRequired = 'This field is required'; | ||
const invalidEmail = 'Please re-enter your email details and try again.'; | ||
const incorrectLogin = 'Incorrect email/password combination'; | ||
const formFeedback = 'div[class*=formFeedback]'; | ||
|
||
Feature('login - account').retry(Number(process.env.TEST_RETRY_COUNT) || 0); | ||
|
||
runTestSuite(testConfigs.jwpAuth, 'JW Player'); | ||
runTestSuite(testConfigs.cleengAuthvod, 'Cleeng'); | ||
|
||
function runTestSuite(config: typeof testConfigs.svod, providerName: string) { | ||
Feature(`login - account - ${providerName}`).retry(Number(process.env.TEST_RETRY_COUNT) || 0); | ||
|
||
Before(async ({ I }) => { | ||
async function beforeScenario(I: CodeceptJS.I) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
I.useConfig(config); | ||
|
||
await I.openSignInModal(); | ||
|
||
I.waitForElement(constants.loginFormSelector, normalTimeout); | ||
}); | ||
} | ||
|
||
Scenario(`I can close the modal - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
I.clickCloseButton(); | ||
I.dontSee('Email'); | ||
I.dontSee('Password'); | ||
I.dontSeeElement(constants.loginFormSelector); | ||
}); | ||
|
||
Scenario(`I can close the modal by clicking outside - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
|
||
I.forceClick('div[data-testid="backdrop"]'); | ||
|
||
I.dontSee('Email'); | ||
|
@@ -39,17 +43,20 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string) { | |
}); | ||
|
||
Scenario(`I can toggle to view password - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
await passwordUtils.testPasswordToggling(I); | ||
}); | ||
|
||
Scenario(`I get a warning when the form is incompletely filled in - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
tryToSubmitForm(I); | ||
|
||
checkField(I, 'email', fieldRequired); | ||
checkField(I, 'password', fieldRequired); | ||
}); | ||
|
||
Scenario(`I see email warnings - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
I.fillField('email', '[email protected]'); | ||
I.fillField('password', 'Password'); | ||
|
||
|
@@ -81,6 +88,7 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string) { | |
}); | ||
|
||
Scenario(`I see empty password warnings - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
I.fillField('email', '[email protected]'); | ||
I.fillField('password', 'Password'); | ||
|
||
|
@@ -105,6 +113,7 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string) { | |
}); | ||
|
||
Scenario(`I see a login error message - ${providerName}`, async ({ I }) => { | ||
await beforeScenario(I); | ||
I.fillField('email', '[email protected]'); | ||
I.fillField('password', 'Password'); | ||
|
||
|
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
Oops, something went wrong.