forked from adobecom/nala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from KristijanVizi/MWPW-154523-implement-mapc-…
…sign-in-test-cases New: added mapc sign in flow tests
- Loading branch information
Showing
4 changed files
with
151 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module.exports = { | ||
FeatureName: 'DME sign in flow page', | ||
features: [ | ||
{ | ||
tcid: '1', | ||
name: '@login-sign-in-sign-out-public-page', | ||
path: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/public-page', | ||
tags: '@dme-signin @regression @login @nopr', | ||
data: { | ||
partnerLevel: 'cpp-spain-platinum:', | ||
expectedProtectedHomeURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
expectedPublicPageURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/public-page', | ||
}, | ||
}, | ||
{ | ||
tcid: '2', | ||
name: '@login-accessing-public-home-page-with-member-user-logged-in-to-adobe', | ||
path: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/public-page', | ||
baseURL: 'https://www.stage.adobe.com/partners.html', | ||
tags: '@dme-signin @regression @login @nopr', | ||
data: { | ||
partnerLevel: 'cpp-spain-platinum:', | ||
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
page: 'public page', | ||
}, | ||
}, | ||
{ | ||
tcid: '3', | ||
name: '@login-accessing-restricted-home-page-with-member-user-logged-in-to-adobe', | ||
path: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
baseURL: 'https://www.stage.adobe.com/partners.html', | ||
tags: '@dme-signin @regression @login @nopr', | ||
data: { | ||
partnerLevel: 'cpp-spain-platinum:', | ||
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
page: 'restricted page', | ||
}, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export default class SignInPage { | ||
constructor(page) { | ||
this.page = page; | ||
this.signInButton = page.locator('button[daa-ll="Sign In"].feds-signIn'); | ||
this.signInButtonStageAdobe = page.locator('.profile-comp.secondary-button'); | ||
this.profileIconButton = page.locator('.feds-profile-button'); | ||
this.userNameDisplay = page.locator('.user-name'); | ||
this.logoutButton = page.locator('[daa-ll="Sign Out"]'); | ||
|
||
this.emailField = page.locator('#EmailPage-EmailField'); | ||
this.emailPageContinueButton = page.locator('//button[@data-id="EmailPage-ContinueButton"]'); | ||
this.passwordField = page.locator('#PasswordPage-PasswordField'); | ||
this.passwordPageContinueButton = page.locator('//button[@data-id="PasswordPage-ContinueButton"]'); | ||
} | ||
|
||
async signIn(page, partnerLevel) { | ||
const email = process.env.IMS_EMAIL.split(partnerLevel)[1].split(';')[0]; | ||
await page.waitForLoadState('networkidle'); | ||
await this.emailField.fill(email); | ||
await this.emailPageContinueButton.click(); | ||
await this.passwordField.fill(process.env.IMS_PASS); | ||
await this.passwordPageContinueButton.click(); | ||
} | ||
|
||
async verifyRedirectAfterLogin({ | ||
page, test, expect, newTab, newTabPage, feature, | ||
}) { | ||
await test.step('Go to stage.adobe.com', async () => { | ||
const url = `${feature.baseURL}`; | ||
await page.evaluate((navigationUrl) => { | ||
window.location.href = navigationUrl; | ||
}, url); | ||
|
||
await this.signInButtonStageAdobe.click(); | ||
await page.waitForLoadState('domcontentloaded'); | ||
}); | ||
|
||
await test.step('Sign in with cpp spain platinum user', async () => { | ||
await this.signIn(page, `${feature.data.partnerLevel}`); | ||
await this.userNameDisplay.waitFor({ state: 'visible', timeout: 20000 }); | ||
}); | ||
|
||
await test.step(`Open ${feature.data.page} in a new tab`, async () => { | ||
await newTab.goto(`${feature.path}`); | ||
await newTabPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 }); | ||
const pages = await page.context().pages(); | ||
await expect(pages[1].url()) | ||
.toContain(`${feature.data.expectedToSeeInURL}`); | ||
}); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import SignInPage from '../../selectors/dme/signin.page.js'; | ||
|
||
let signInPage; | ||
const signin = require('../../features/dme/signin.spec.js'); | ||
|
||
const { features } = signin; | ||
const redirectionFeatures = features.slice(1, 3); | ||
|
||
test.describe('MAPC sign in flow', () => { | ||
test.beforeEach(async ({ page }) => { | ||
signInPage = new SignInPage(page); | ||
}); | ||
|
||
test(`${features[0].name},${features[0].tags}`, async ({ page }) => { | ||
await test.step('Go to the home page', async () => { | ||
await page.goto(`${features[0].path}`); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await signInPage.signInButton.click(); | ||
}); | ||
|
||
await test.step('Sign in', async () => { | ||
await signInPage.signIn(page, `${features[0].data.partnerLevel}`); | ||
}); | ||
|
||
await test.step('Verify redirection to restricted home after successful login', async () => { | ||
await signInPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 }); | ||
const pages = await page.context().pages(); | ||
await expect(pages[0].url()).toContain(`${features[0].data.expectedProtectedHomeURL}`); | ||
}); | ||
|
||
await test.step('Logout', async () => { | ||
await signInPage.profileIconButton.click(); | ||
await signInPage.logoutButton.click(); | ||
}); | ||
|
||
await test.step('Verify redirection to public page after logout', async () => { | ||
await signInPage.signInButton.waitFor({ state: 'visible', timeout: 10000 }); | ||
const pages = await page.context().pages(); | ||
await expect(pages[0].url()) | ||
.toContain(`${features[0].data.expectedPublicPageURL}`); | ||
}); | ||
}); | ||
|
||
redirectionFeatures.forEach((feature) => { | ||
test(`${feature.name},${feature.tags}`, async ({ page, context }) => { | ||
const newTab = await context.newPage(); | ||
const newTabPage = new SignInPage(newTab); | ||
await signInPage.verifyRedirectAfterLogin({ | ||
page, | ||
test, | ||
expect, | ||
newTab, | ||
newTabPage, | ||
feature, | ||
}); | ||
}); | ||
}); | ||
}); |