Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: added additional sign in tests to verify reseller logins #85

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
});
});
Loading