From 353aac94e98835a0b2439dcf278aef8b848b77fb Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Wed, 14 Aug 2024 15:46:13 -0700 Subject: [PATCH] Updating tests to pass on bacom. --- features/milo/georouting.spec.js | 10 +++++----- features/milo/merchcard.block.spec.js | 6 +++--- tests/milo/commerce.feature.test.js | 20 +++++++++++++++----- tests/milo/personalization.feature.test.js | 9 ++++++++- tests/milo/promotions.feature.test.js | 10 +++++++++- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/features/milo/georouting.spec.js b/features/milo/georouting.spec.js index 72fd96da..d32b2013 100644 --- a/features/milo/georouting.spec.js +++ b/features/milo/georouting.spec.js @@ -9,7 +9,7 @@ module.exports = { desc: 'User accessing DE page from US locale.', path: '/de/drafts/nala/features/georouting/georouting', data: { - title: /This Adobe site doesn[' ’]t match your location./, + title: /This Adobe site doesn['’]t match your location\.?/, text: 'Based on your location, we think you may prefer the United States website', button: 'United States', link: 'Deutschland', @@ -25,7 +25,7 @@ module.exports = { desc: 'User is accessing the US page with a query parameter (akamaiLocale=DE).', path: '/drafts/nala/features/georouting/georouting?akamaiLocale=DE', data: { - title: 'Diese Adobe-Site passt nicht zu deinem Standort.', + title: /Diese Adobe-Site passt nicht zu deinem Standort\.?/, text: 'Basierend auf deiner IP-Adresse könnte die Website für Deutschland passender sein.', button: 'Deutschland', link: 'United States', @@ -59,7 +59,7 @@ module.exports = { data: { tab1: { name: 'Deutsch', - title: 'Diese Adobe-Site passt nicht zu deinem Standort.', + title: /Diese Adobe-Site passt nicht zu deinem Standort\.?/, text: 'Basierend auf deiner IP-Adresse könnte die Website für Schweiz passender sein.', button: 'Schweiz', link: 'United States', @@ -67,7 +67,7 @@ module.exports = { }, tab2: { name: 'Français', - title: 'Ce site Adobe ne correspond pas à votre zone géographique.', + title: /Ce site Adobe ne correspond pas à votre zone géographique\.?/, text: 'Pour accéder à du contenu, des offres et des tarifs correspondant davantage à votre zone géographique, rendez-vous plutôt sur le site web Suisse.', button: 'Suisse', link: 'United States', @@ -75,7 +75,7 @@ module.exports = { }, tab3: { name: 'Italiano', - title: 'Questo sito Adobe non corrisponde alla tua posizione geografica.', + title: /Questo sito Adobe non corrisponde alla tua posizione geografica\.?/, text: 'In base alla tua posizione, ti consigliamo di consultare il sito web di Adobe Svizzera, dove troverai contenuti, offerte e prezzi specifici per la tua area geografica.', button: 'Svizzera', link: 'United States', diff --git a/features/milo/merchcard.block.spec.js b/features/milo/merchcard.block.spec.js index 541672b4..bfc98221 100644 --- a/features/milo/merchcard.block.spec.js +++ b/features/milo/merchcard.block.spec.js @@ -106,7 +106,7 @@ module.exports = { description: 'The complete PDF solution for working anywhere (includes desktop, web, and mobile access).', link1Text: 'See plan & pricing details', checkboxLabel: 'Add a 30-day free trial of Adobe Stock.*', - secureLabel: 'Secure transaction', + secureLabel: /Secure transaction/i, footerBlueButton1Text: 'Buy now', footerBlueButton2Text: 'Buy now', footerOutlineButtonText: 'Free trial', @@ -125,8 +125,8 @@ module.exports = { description: 'Get 20+ Creative Cloud apps including Photoshop, Illustrator, Adobe Express, Premiere Pro, and Acrobat Pro. (Substance 3D apps are not included.)', link1Text: 'See plan & pricing details', checkboxLabel: 'Add a 30-day free trial of Adobe Stock.*', - secureLabel: 'Secure transaction', - footerBlueButton1Text: 'Buy now', + secureLabel: /Secure transaction/i, + footerBlueButton1Text: /Buy now/i, footerOutlineButtonText: 'Free trial', }, tags: '@merch-card @smoke @regression @milo', diff --git a/tests/milo/commerce.feature.test.js b/tests/milo/commerce.feature.test.js index a033c992..4283948a 100644 --- a/tests/milo/commerce.feature.test.js +++ b/tests/milo/commerce.feature.test.js @@ -8,7 +8,15 @@ import FedsHeader from '../../selectors/feds/feds.header.page.js'; const miloLibs = process.env.MILO_LIBS || ''; let COMM; -test.beforeEach(async ({ page }) => { COMM = new CommercePage(page); }); +test.beforeEach(async ({ page, baseURL }) => { + COMM = new CommercePage(page); + const skipOn = ['bacom', 'business']; + + skipOn.some((skip) => { + if (baseURL.includes(skip)) test.skip(true, `Skipping the commerce tests for ${baseURL}`); + return null; + }); +}); test.describe('Commerce feature test suite', () => { // @Commerce-Price-Term - Validate price with term display @@ -292,8 +300,9 @@ test.describe('Commerce feature test suite', () => { await webUtil.scrollPage('down', 'slow'); const unresolvedPlaceholders = await page.evaluate( () => [...document.querySelectorAll('[data-wcs-osi]')].filter( - (el) => !el.classList.contains('placeholder-resolved') - )); + (el) => !el.classList.contains('placeholder-resolved'), + ), + ); expect(unresolvedPlaceholders.length).toBe(0); }); @@ -301,8 +310,9 @@ test.describe('Commerce feature test suite', () => { await test.step('Validate checkout links', async () => { const invalidCheckoutLinks = await page.evaluate( () => [...document.querySelectorAll('[data-wcs-osi][is="checkout-link"]')].filter( - (el) => !el.getAttribute('href').includes('commerce') - )); + (el) => !el.getAttribute('href').includes('commerce'), + ), + ); expect(invalidCheckoutLinks.length).toBe(0); }); }); diff --git a/tests/milo/personalization.feature.test.js b/tests/milo/personalization.feature.test.js index d247805f..710d9965 100644 --- a/tests/milo/personalization.feature.test.js +++ b/tests/milo/personalization.feature.test.js @@ -18,10 +18,17 @@ test.describe('Milo Personalization feature test suite', () => { webUtil = new WebUtil(page); }); - test.beforeAll(async ({ browserName }) => { + test.beforeAll(async ({ browserName, baseURL }) => { if (browserName === 'chromium') { test.skip('Skipping tests for Chromium browser'); } + + const skipOn = ['bacom', 'business']; + + skipOn.some((skip) => { + if (baseURL.includes(skip)) test.skip(true, `Skipping the personalization tests for ${baseURL}`); + return null; + }); }); // Test 0 : Personalization (Replace content) diff --git a/tests/milo/promotions.feature.test.js b/tests/milo/promotions.feature.test.js index 12490b02..ac991f59 100644 --- a/tests/milo/promotions.feature.test.js +++ b/tests/milo/promotions.feature.test.js @@ -5,7 +5,15 @@ import PromoPage from '../../selectors/milo/promotions.feature.page.js'; const miloLibs = process.env.MILO_LIBS || ''; let PROMO; -test.beforeEach(async ({ page }) => { PROMO = new PromoPage(page); }); +test.beforeEach(async ({ page, baseURL }) => { + PROMO = new PromoPage(page); + const skipOn = ['bacom', 'business']; + + skipOn.some((skip) => { + if (baseURL.includes(skip)) test.skip(true, `Skipping the promo tests for ${baseURL}`); + return null; + }); +}); test.describe('Promotions feature test suite', () => { // @Promo-insert - Validate promo insert text after marquee and before text component