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

Optimized the code based on the review comments given for PR - 381 #382

Merged
merged 10 commits into from
Jun 25, 2024
198 changes: 99 additions & 99 deletions selectors/feds/feds.illustratorsanity.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,67 @@ export default class IllustratorPageSanity {
this.privacySection = page.locator('.feds-footer-privacySection:nth-child(2)');
}

// U-NAV
async validatingUnavElements(country) {
await this.page.waitForLoadState('domcontentloaded');

const elements = [
this.adobe, this.creativityAndDesign, this.illustrator, this.features, this.comparePlans,
this.freeTrialDetails, this.tryItForFree, this.appSwitcher, this.signInButton, this.signInButtonTwo,
];

await Promise.all(elements.map(async (element) => {
switch (element) {
case this.tryItForFree:
if (country === 'Germany') {
await expect(element).toBeVisible();
}
break;
case this.appSwitcher:
case this.signInButton: {
const excludedCountries = [
'United Kingdom', 'India', 'Canada English', 'Canada French', 'Mexico', 'Australia', 'Indonesia',
'Indonesia English', 'Thailand English', 'Thailand', 'Singapore', 'Philippines', 'Philippines English',
'Middle East And North Africa',
];
if (excludedCountries.includes(country)) {
await expect(element).not.toBeVisible();
}
}
break;
case this.signInButtonTwo: {
const includedCountries = [
'United Kingdom', 'India', 'Canada English', 'Canada French', 'Mexico', 'Australia', 'Indonesia',
'Indonesia English', 'Thailand English', 'Thailand', 'Singapore', 'Philippines', 'Philippines English',
'Middle East And North Africa',
];
if (includedCountries.includes(country)) {
await expect(element).toBeVisible();
}
}
break;
default:
await expect(element).toBeVisible();
break;
}
}));
}

// Creativity & Design
async validatingCreativityAndDesignElements(country) {
await this.creativityAndDesign.click();
await this.page.waitForLoadState('networkidle');

const elements = [this.whatIsCC, this.photographers, this.studentsAndTeachers, this.individuals,
this.business, this.schoolsAndUniversities, this.viewPlansAndPricing, this.photoshop, this.adobeExpress,
this.lightroom, this.illustratorCd, this.premierePro, this.adobeStock, this.viewAllProducts, this.photo,
this.graphicDesign, this.Video, this.illustration, this.socialMedia, this.threeDAndAR, this.pdf,
this.aiOverviewCC, this.adobeFirefly, this.adobecom, this.pdfAndESignatures, this.marketingAndCommerce,
this.helpAndSupport, this.seeSpecialOffers, this.adobeFireflyMp];
await this.page.waitForLoadState('domcontentloaded');

const elements = [
this.whatIsCC, this.photographers, this.studentsAndTeachers, this.individuals, this.business,
this.schoolsAndUniversities, this.viewPlansAndPricing, this.photoshop, this.adobeExpress,
this.lightroom, this.illustratorCd, this.premierePro, this.adobeStock, this.viewAllProducts,
this.photo, this.graphicDesign, this.Video, this.illustration, this.socialMedia, this.threeDAndAR,
this.pdf, this.aiOverviewCC, this.adobeFirefly, this.adobecom, this.pdfAndESignatures,
this.marketingAndCommerce, this.helpAndSupport, this.seeSpecialOffers, this.adobeFireflyMp,
this.governmentAgencies, this.benifitsForCC, this.acrobatPro, this.adobeStockEs, this.seeAllProducts,
this.seePlansAndPricingEs,
];

await Promise.all(elements.map(async (element) => {
switch (element) {
Expand All @@ -130,62 +180,60 @@ export default class IllustratorPageSanity {
}
break;
case this.adobeFirefly:
if (country !== 'Poland') {
return;
if (country === 'Poland' || country === 'Japan') {
await expect(element).not.toBeVisible();
}
await expect(element).toBeVisible();
break;
case this.adobeFireflyMp:
if (country === 'Poland') {
if (country === 'Poland' || country === 'Japan') {
await expect(element).toBeVisible();
}
break;
case this.individuals:
if (country === 'Germany' || country === 'France' || country === 'Italy') {
await expect(element).not.toBeVisible();
}
break;
case this.governmentAgencies:
case this.benifitsForCC:
if (country === 'Japan') {
await expect(element).toBeVisible();
}
break;
case this.aiOverviewCC:
if (country === 'Japan') {
await expect(element).not.toBeVisible();
}
break;
case this.acrobatPro:
case this.adobeStockEs:
case this.seeAllProducts:
case this.seePlansAndPricingEs:
if (country === 'Spain') {
await expect(element).toBeVisible();
}
break;
case this.schoolsAndUniversities:
case this.viewPlansAndPricing:
case this.illustratorCd:
case this.viewAllProducts:
case this.lightroom:
case this.adobeStock:
if (country === 'Spain') {
await expect(element).not.toBeVisible();
}
break;
default:
await expect(element).toBeVisible();
break;
}
}));

await this.creativityAndDesign.click();
}

async validatingCreativityAndDesignElementsSecondSet() {
await this.creativityAndDesign.click();
await this.page.waitForLoadState('networkidle');

const elements = [this.whatIsCC, this.photographers, this.studentsAndTeachers, this.schoolsAndUniversities,
this.business, this.viewPlansAndPricing, this.photoshop, this.adobeExpress, this.premierePro,
this.illustratorCd, this.lightroom, this.adobeStock, this.viewAllProducts, this.photo, this.graphicDesign,
this.Video, this.illustration, this.socialMedia, this.threeDAndAR, this.pdf, this.aiOverviewCC,
this.adobeFirefly, this.adobecom, this.pdfAndESignatures, this.marketingAndCommerce, this.helpAndSupport];

await Promise.all(elements.map(async (element) => {
await expect(element).toBeVisible();
}));

await this.creativityAndDesign.click();
}

async validatingCreativityAndDesignElementsThirdSet() {
await this.creativityAndDesign.click();
await this.page.waitForLoadState('networkidle');

const elements = [this.whatIsCC, this.photographers, this.studentsAndTeachers, this.individuals, this.business,
this.schoolsAndUniversities, this.governmentAgencies, this.benifitsForCC, this.viewPlansAndPricing,
this.photoshop, this.adobeExpress, this.lightroom, this.illustratorCd, this.premierePro, this.adobeStock,
this.adobeFireflyMp, this.viewAllProducts, this.photo, this.graphicDesign, this.Video, this.illustration,
this.socialMedia, this.threeDAndAR, this.pdf, this.adobeFirefly, this.adobecom, this.pdfAndESignatures,
this.marketingAndCommerce, this.helpAndSupport];

await Promise.all(elements.map(async (element) => {
await expect(element).toBeVisible();
}));

await this.creativityAndDesign.click();
}

async validatingCreativityAndDesignElementsFourthSet() {
await this.creativityAndDesign.click();
await this.page.waitForLoadState('networkidle');
await this.page.waitForLoadState('domcontentloaded');

const elements = [this.removeBackground, this.resizeImage, this.covertImageToSVG, this.covertVideoToGIF,
this.createQRCode, this.seeAllQuickActions, this.resume, this.posters, this.card, this.instagramPost,
Expand All @@ -200,57 +248,9 @@ export default class IllustratorPageSanity {
await this.creativityAndDesign.click();
}

async validatingCreativityAndDesignElementsFifthSet() {
await this.creativityAndDesign.click();
await this.page.waitForLoadState('networkidle');

const elements = [this.whatIsCC, this.photoshop, this.adobeExpress, this.acrobatPro, this.illustratorCd,
this.premierePro, this.adobeStockEs, this.seeAllProducts, this.individuals, this.photographers,
this.studentsAndTeachers, this.business, this.seePlansAndPricingEs, this.photo, this.graphicDesign,
this.Video, this.illustration, this.socialMedia, this.threeDAndAR, this.pdf, this.aiOverviewCC,
this.adobeFirefly, this.adobecom, this.pdfAndESignatures, this.marketingAndCommerce, this.helpAndSupport];

await Promise.all(elements.map(async (element) => {
await expect(element).toBeVisible();
}));

await this.creativityAndDesign.click();
}

// U-NAV
async validatingunavElements(country) {
await this.page.waitForLoadState('networkidle');
const elements = [this.adobe, this.creativityAndDesign, this.illustrator, this.features, this.comparePlans,
this.freeTrialDetails, this.tryItForFree, this.appSwitcher, this.signInButton];

await Promise.all(elements.map(async (element) => {
switch (element) {
case this.tryItForFree:
if (country === 'Germany') {
await expect(element).toBeVisible();
}
break;
default:
await expect(element).toBeVisible();
break;
}
}));
}

async validatingunavElementsSecondSet() {
await this.page.waitForLoadState('networkidle');

const elements = [this.adobe, this.creativityAndDesign, this.illustrator, this.features,
this.comparePlans, this.freeTrialDetails, this.signInButtonTwo];

await Promise.all(elements.map(async (element) => {
await expect(element).toBeVisible();
}));
}

// Footer
async validatingfooterElements(country) {
await this.page.waitForLoadState('networkidle');
async validatingFooterElements(country) {
await this.changeRegion.scrollIntoViewIfNeeded();
const elements = [this.footerCreativeCloud, this.footerCreativeCloudForBusiness,
this.footerdiscountForStudentsAndTeachers, this.footerappsForiOS, this.footerWhatIsExperienceCloud,
this.footerDownloadAndInstall, this.footerAdobeBlog, this.footerLoginToYourAccount, this.footerAbout,
Expand Down
Loading
Loading