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.
- Loading branch information
Kristijan Vizi
authored and
Kristijan Vizi
committed
Jul 23, 2024
1 parent
4dc9f26
commit 305aed8
Showing
4 changed files
with
160 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,38 @@ | ||
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: 'distributor-apac:', | ||
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: 'reseller-us-gold:', | ||
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
}, | ||
}, | ||
{ | ||
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: 'distributor-na-gold:', | ||
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-home', | ||
}, | ||
}, | ||
], | ||
}; |
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,24 @@ | ||
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(); | ||
} | ||
} |
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,97 @@ | ||
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; | ||
|
||
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}`); | ||
}); | ||
}); | ||
|
||
test(`${features[1].name},${features[1].tags}`, async ({ page, context }) => { | ||
await test.step('Go to stage.adobe.com', async () => { | ||
const url = `${features[1].baseURL}`; | ||
await page.evaluate((navigationUrl) => { | ||
window.location.href = navigationUrl; | ||
}, url); | ||
|
||
await signInPage.signInButtonStageAdobe.click(); | ||
await page.waitForLoadState('domcontentloaded'); | ||
}); | ||
|
||
await test.step('Sign in with Reseller Gold US user', async () => { | ||
await signInPage.signIn(page, `${features[1].data.partnerLevel}`); | ||
await signInPage.userNameDisplay.waitFor({ state: 'visible', timeout: 15000 }); | ||
}); | ||
|
||
await test.step('Open public page in a new tab', async () => { | ||
const newTab = await context.newPage(); | ||
await newTab.goto(`${features[1].path}`); | ||
const newTabPage = new SignInPage(newTab); | ||
await newTabPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 }); | ||
const pages = await page.context().pages(); | ||
await expect(pages[1].url()) | ||
.toContain(`${features[1].data.expectedToSeeInURL}`); | ||
}); | ||
}); | ||
|
||
test(`${features[2].name},${features[2].tags}`, async ({ page, context }) => { | ||
await test.step('Go to stage.adobe.com', async () => { | ||
const url = `${features[2].baseURL}`; | ||
await page.evaluate((navigationUrl) => { | ||
window.location.href = navigationUrl; | ||
}, url); | ||
|
||
await signInPage.signInButtonStageAdobe.click(); | ||
await page.waitForLoadState('domcontentloaded'); | ||
}); | ||
|
||
await test.step('Sign in with Distributor Gold NA user', async () => { | ||
await signInPage.signIn(page, `${features[2].data.partnerLevel}`); | ||
await signInPage.userNameDisplay.waitFor({ state: 'visible', timeout: 15000 }); | ||
}); | ||
|
||
await test.step('Open restricted page in a new tab', async () => { | ||
const newTab = await context.newPage(); | ||
await newTab.goto(`${features[2].path}`); | ||
const newTabPage = new SignInPage(newTab); | ||
await newTabPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 }); | ||
const pages = await page.context().pages(); | ||
await expect(pages[1].url()) | ||
.toContain(`${features[2].data.expectedToSeeInURL}`); | ||
}); | ||
}); | ||
}); |