diff --git a/nala/blocks/signin/signin.spec.js b/nala/blocks/signin/signin.spec.js index 7fc3e0e..006c9be 100644 --- a/nala/blocks/signin/signin.spec.js +++ b/nala/blocks/signin/signin.spec.js @@ -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', + }, + }, ], }; diff --git a/nala/blocks/signin/signin.test.js b/nala/blocks/signin/signin.test.js index a6270f6..00c83d9 100644 --- a/nala/blocks/signin/signin.test.js +++ b/nala/blocks/signin/signin.test.js @@ -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 }) => { @@ -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(); + }); + }); });