Skip to content

Commit

Permalink
refactoring for paid user entitlement (#283)
Browse files Browse the repository at this point in the history
Co-authored-by: Reuben Royce Noronha <[email protected]>
Co-authored-by: Aaron Mauchley <[email protected]>
  • Loading branch information
3 people authored Mar 5, 2024
1 parent 94e52c6 commit 266d219
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion selectors/acom/entitlement.commerce.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default class EntitlementCommerce {
this.ccAllAppsCTA = page.locator('//*[contains(@daa-ll,"CC All Apps")]');
this.photoshopBuyCTA = page.locator('//*[contains(@daa-ll,"Buy now-1--Photoshop")]');
this.photoshopFreeCTA = page.locator('//*[contains(@daa-ll,"Free trial-2--Photoshop")]');
this.switchModalIframe = page.locator('#upgrade-modal > iframe');
this.switchModalIframe = page.locator('#switch-modal > div > iframe');
}
}
24 changes: 14 additions & 10 deletions tests/acom/entitlement.commerce.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ test.describe('Acom Loggedin Entitlements test suite', () => {
await test.step('Login with a valid Adobe account', async () => {
await Header.signInButton.waitFor({ state: 'visible', timeout: 5000 });
await Header.signInButton.click();
await entitlementCommerce.loginType.waitFor({ state: 'visible', timeout: 5000 });
await entitlementCommerce.loginType.click();
await Login.loginOnAppForm(process.env.IMS_EMAIL, process.env.IMS_PASS);
if (entitlementCommerce.loginType.isVisible()) {
await entitlementCommerce.loginType.waitFor({ state: 'visible', timeout: 5000 });
await entitlementCommerce.loginType.click();
}
await Login.loginOnAppForm(process.env.IMS_EMAIL_PAID_PS, process.env.IMS_PASS_PAID_PS);
});

// Validate Upgrade eligibility check w.r.t Buy CTA
Expand All @@ -38,7 +40,7 @@ test.describe('Acom Loggedin Entitlements test suite', () => {
// Validate Upgrade eligibility check w.r.t Switch modal
await test.step('Verify Switch modal launch for Upgrade', async () => {
await entitlementCommerce.ccAllAppsCTA.click();
await entitlementCommerce.switchModalIframe.waitFor({ state: 'visible', timeout: 9000 });
await entitlementCommerce.switchModalIframe.waitFor({ state: 'visible', timeout: 30000 });
await expect(entitlementCommerce.switchModalIframe).toBeVisible();
});
});
Expand All @@ -61,21 +63,23 @@ test.describe('Acom Loggedin Entitlements test suite', () => {
await test.step('Login with a valid Adobe account', async () => {
await Header.signInButton.waitFor({ state: 'visible', timeout: 5000 });
await Header.signInButton.click();
await entitlementCommerce.loginType.waitFor({ state: 'visible', timeout: 5000 });
await entitlementCommerce.loginType.click();
await Login.loginOnAppForm(process.env.IMS_EMAIL, process.env.IMS_PASS);
if (entitlementCommerce.loginType.isVisible()) {
await entitlementCommerce.loginType.waitFor({ state: 'visible', timeout: 5000 });
await entitlementCommerce.loginType.click();
}
await Login.loginOnAppForm(process.env.IMS_EMAIL_PAID_PS, process.env.IMS_PASS_PAID_PS);
});

// Validate Download eligibility check w.r.t Buy CTA
await test.step('Verify cc all apps card cta title', async () => {
await test.step('Verify photoshop card cta title', async () => {
await page.waitForLoadState('domcontentloaded');
await entitlementCommerce.photoshopBuyCTA.waitFor({ state: 'visible', timeout: 5000 });
await expect(entitlementCommerce.photoshopBuyCTA).toHaveText(data.DownloadCTATitle);
await expect(entitlementCommerce.photoshopFreeCTA).toHaveText(data.TrialCTATitle);
});

// Validate Download eligibility check w.r.t Switch modal
await test.step('Verify Switch modal launch for Upgrade', async () => {
// Validate Download eligibility check w.r.t download link
await test.step('Verify download link for download', async () => {
await entitlementCommerce.photoshopBuyCTA.click();
await page.waitForLoadState('domcontentloaded');
await expect(page.url()).toContain(data.DownloadUrl);
Expand Down

0 comments on commit 266d219

Please sign in to comment.