Skip to content

Commit

Permalink
New: added additional sign in tests to verify reseller logins
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristijan Vizi authored and Kristijan Vizi committed Oct 7, 2024
1 parent 6342a7c commit 36566fc
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
41 changes: 40 additions & 1 deletion nala/blocks/signin/signin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
partnerLevel: 'tpp-platinum:',
expectedPublicURL: 'https://partners.stage.adobe.com/channelpartners/',
restrictedHomePath: 'https://partners.stage.adobe.com/channelpartners/home/?akamaiLocale=na&martech=off',
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/404-content-not-found',
expectedToSeeInURL: 'https://partners.stage.adobe.com/channelpartners/error/404',
},
},
{
Expand All @@ -102,5 +102,44 @@ export default {
tags: '@dme-signin @regression @login @circleCi',
expectedToSeeInURL: 'https://auth-stg1.services.adobe.com/',
},
{
tcid: '10',
name: '@login-functionality-with-registered-member-user',
path: 'https://partners.stage.adobe.com/channelpartners/?akamaiLocale=na&martech=off',
tags: '@dme-signin @regression @login @circleCi',
data: { partnerLevel: 'cpp-china-registered:' },
},
{
tcid: '11',
name: '@login-functionality-with-certified-member-user',
path: 'https://partners.stage.adobe.com/channelpartners/?akamaiLocale=na&martech=off',
tags: '@dme-signin @regression @login @circleCi',
data: { partnerLevel: 'cpp-pacific-certified:' },
},
{
tcid: '12',
name: '@login-functionality-with-gold-member-user',
path: 'https://partners.stage.adobe.com/channelpartners/?akamaiLocale=na&martech=off',
tags: '@dme-signin @regression @login @circleCi',
data: { partnerLevel: 'cpp-latin-america-gold:' },
},
{
tcid: '13',
name: '@login-functionality-with-platinum-member-user',
path: 'https://partners.stage.adobe.com/channelpartners/?akamaiLocale=na&martech=off',
tags: '@dme-signin @regression @login @circleCi',
data: { partnerLevel: 'cpp-spain-platinum:' },
},
{
tcid: '14',
name: '@login-sign-in-sign-out-from-program-page-with-member-user',
path: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/public-program-page?akamaiLocale=na&martech=off',
tags: '@dme-signin @regression @login @circleCi',
data: {
partnerLevel: 'cpp-latin-america-na-platinum:',
landingPageAfterLoginURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/protected-program-page',
landingPageAfterLogoutURL: 'https://partners.stage.adobe.com/channelpartners/drafts/automation/regression/public-program-page',
},
},
],
};
65 changes: 65 additions & 0 deletions nala/blocks/signin/signin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const { features } = signin;
const redirectionFeatures = features.slice(1, 3);
const nonMemberRedirects = features.slice(3, 5);
const nonMemberLoggedInToAdobe = features.slice(5, 7);
const resellerMembersLogin = features.slice(9, 13);

test.describe('MAPC sign in flow', () => {
test.beforeEach(async ({ page, browserName, baseURL, context }) => {
Expand Down Expand Up @@ -199,4 +200,68 @@ test.describe('MAPC sign in flow', () => {
.toContain(`${expectedToSeeInURL}`);
});
});

resellerMembersLogin.forEach((feature) => {
test(`${feature.name},${feature.tags}`, async ({ page }) => {
await test.step('Go to the public page', async () => {
await page.goto(`${feature.path}`);
await page.waitForLoadState('domcontentloaded');
await signInPage.signInButton.click();
});

await test.step('Sign in', async () => {
await signInPage.signIn(page, `${feature.data.partnerLevel}`);
});

await test.step('Verify successful login', async () => {
await signInPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 });
});
});
});

test(`${features[13].name},${features[13].tags}`, async ({ page }) => {
const { data, path } = features[13];
await test.step('Go to public program page', async () => {
await page.goto(`${path}`);
await page.waitForLoadState('domcontentloaded');
const joinNowButton = await signInPage.joinNowButton;
await expect(joinNowButton).toBeVisible();
const signInButton = await signInPage.signInButton;
await expect(signInButton).toBeVisible();
await signInPage.signInButton.click();
});

await test.step('Sign in', async () => {
await signInPage.signIn(page, `${data.partnerLevel}`);
});

await test.step('After login user is redirected to protected program page', async () => {
await signInPage.profileIconButton.waitFor({ state: 'visible', timeout: 20000 });
const pages = await page.context().pages();
await expect(pages[0].url()).toContain(`${data.landingPageAfterLoginURL}`);
const joinNowButton = await signInPage.joinNowButton;
await expect(joinNowButton).toBeHidden();
const signInButton = await signInPage.signInButton;
await expect(signInButton).toBeHidden();
});

await test.step('Logout', async () => {
const currentUrl = page.url();
const newUrl = `${currentUrl.replace('#', '')}?akamaiLocale=na&martech=off`;
await page.goto(newUrl);
await signInPage.profileIconButton.click();
await signInPage.logoutButton.click();
});

await test.step('Verify redirection to public program page after logout', async () => {
await signInPage.signInButton.waitFor({ state: 'visible', timeout: 10000 });
const pages = await page.context().pages();
await expect(pages[0].url())
.toContain(`${data.landingPageAfterLogoutURL}`);
const joinNowButton = await signInPage.joinNowButton;
await expect(joinNowButton).toBeVisible();
const signInButton = await signInPage.signInButton;
await expect(signInButton).toBeVisible();
});
});
});

0 comments on commit 36566fc

Please sign in to comment.