Skip to content

Commit

Permalink
Merge pull request #99 from adobecom/geo-popup-tests-fix
Browse files Browse the repository at this point in the history
Fix: tests adjusted to run on circle ci
  • Loading branch information
KristijanVizi authored Oct 21, 2024
2 parents 9149de6 + 2fb2983 commit 6c40c9d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
36 changes: 18 additions & 18 deletions nala/blocks/popups/popups.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {
{
tcid: '1',
name: '@desc-regression-geo-pop-up-german-locale',
path: '/channelpartners/?akamaiLocale=de',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=de&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Diese Adobe-Site passt nicht zu Ihrem Standort',
buttonType: 'Switch:de-us|Geo_Routing_Modal',
Expand All @@ -15,8 +15,8 @@ export default {
{
tcid: '2',
name: '@desc-regression-geo-pop-up-spanish-locale',
path: '/channelpartners/?akamaiLocale=es',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=es&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Este sitio de Adobe no coincide con tu ubicación',
buttonType: 'Switch:es-us|Geo_Routing_Modal',
Expand All @@ -26,8 +26,8 @@ export default {
{
tcid: '3',
name: '@desc-regression-geo-pop-up-french-locale',
path: '/channelpartners/?akamaiLocale=fr',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=fr&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Ce site Adobe ne correspond pas à votre zone géographique',
buttonType: 'Switch:fr-us|Geo_Routing_Modal',
Expand All @@ -37,8 +37,8 @@ export default {
{
tcid: '4',
name: '@desc-regression-geo-pop-up-italian-locale',
path: '/channelpartners/?akamaiLocale=it',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=it&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Questo sito Adobe non corrisponde alla tua posizione geografica',
buttonType: 'Switch:it-us|Geo_Routing_Modal',
Expand All @@ -48,8 +48,8 @@ export default {
{
tcid: '5',
name: '@desc-regression-geo-pop-up-japanese-locale',
path: '/channelpartners/?akamaiLocale=jp',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=jp&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'アドビwebサイトの地域設定がお客様の位置情報と一致しません',
buttonType: 'Switch:jp-us|Geo_Routing_Modal',
Expand All @@ -59,8 +59,8 @@ export default {
{
tcid: '6',
name: '@desc-regression-geo-pop-up-chinese-locale',
path: '/channelpartners/?akamaiLocale=cn',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=cn&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: '此 Adobe 网站与您的位置不匹配',
buttonType: 'Switch:cn-us|Geo_Routing_Modal',
Expand All @@ -70,8 +70,8 @@ export default {
{
tcid: '7',
name: '@desc-regression-geo-pop-up-brazilian-locale',
path: '/channelpartners/?akamaiLocale=br',
tags: '@dme-popups @geo-popups @regression',
path: '/channelpartners/?akamaiLocale=br&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Este sitio de Adobe no coincide con tu ubicación',
buttonType: 'Switch:la-us|Geo_Routing_Modal',
Expand All @@ -81,8 +81,8 @@ export default {
{
tcid: '8',
name: '@desc-regression-accessing-german-public-page-switch-to-spanish-locale',
path: '/de/channelpartners/?akamaiLocale=es',
tags: '@dme-popups @geo-popups @regression',
path: '/de/channelpartners/?akamaiLocale=es&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Este sitio de Adobe no coincide con tu ubicación',
switchLocaleButton: 'Switch:es-de|Geo_Routing_Modal',
Expand All @@ -96,8 +96,8 @@ export default {
{
tcid: '9',
name: '@desc-regression-accessing-german-public-page-stay-on-german-locale',
path: '/de/channelpartners/?akamaiLocale=es',
tags: '@dme-popups @geo-popups @regression',
path: '/de/channelpartners/?akamaiLocale=es&martech=off',
tags: '@dme-popups @geo-popups @regression @circleCi',
data: {
geoPopUpText: 'Este sitio de Adobe no coincide con tu ubicación',
switchLocaleButton: 'Switch:es-de|Geo_Routing_Modal',
Expand Down
19 changes: 13 additions & 6 deletions nala/blocks/popups/popups.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const switchLocaleCases = features.slice(7, 9);
test.describe('Validate popups', () => {
test.beforeEach(async ({ page, baseURL, browserName, context }) => {
popupsPage = new PopupsPage(page);
page.on('console', (msg) => {
console.log(`${msg.type()}: ${msg.text()}`, msg.type() === 'error' ? msg.location().url : null);
});
if (!baseURL.includes('partners.stage.adobe.com')) {
await context.setExtraHTTPHeaders({ authorization: `token ${process.env.HLX_API_KEY}` });
}
Expand All @@ -25,17 +28,21 @@ test.describe('Validate popups', () => {
}
});

async function getGeoPopUpSelector(popUpText) {
return `div.georouting-wrapper:has-text("${popUpText}")`;
}

differentLocaleCases.forEach((feature) => {
test(`${feature.name},${feature.tags}`, async ({ page, baseURL }) => {
const newBaseUrl = baseURL.includes('adobecom.hlx.live') ? 'https://partners.stage.adobe.com' : baseURL;
await test.step('Go to public page', async () => {
await page.goto(`${newBaseUrl}${feature.path}`);
await page.waitForLoadState();
await page.waitForLoadState('domcontentloaded');
});

await test.step('Verify geo pop-up appeared', async () => {
const geoPopUp = await popupsPage.getGeoPopUpElement(feature.data.geoPopUpText);
await expect(geoPopUp).toBeVisible();
const geoPopUpSelector = await getGeoPopUpSelector(feature.data.geoPopUpText);
await page.waitForSelector(geoPopUpSelector, { timeout: 4000 });
const switchLocaleButton = await popupsPage.getGeoLocaleButton(feature.data.buttonType);
await expect(switchLocaleButton).toBeVisible();
const href = await switchLocaleButton.getAttribute('href');
Expand All @@ -49,12 +56,12 @@ test.describe('Validate popups', () => {
const newBaseUrl = baseURL.includes('adobecom.hlx.live') ? 'https://partners.stage.adobe.com' : baseURL;
await test.step('Go to public page', async () => {
await page.goto(`${newBaseUrl}${feature.path}`);
await page.waitForLoadState();
await page.waitForLoadState('domcontentloaded');
});

await test.step('Verify geo pop-up appeared', async () => {
const geoPopUp = await popupsPage.getGeoPopUpElement(feature.data.geoPopUpText);
await expect(geoPopUp).toBeVisible();
const geoPopUpSelector = await getGeoPopUpSelector(feature.data.geoPopUpText);
await page.waitForSelector(geoPopUpSelector, { timeout: 4000 });
const switchLocaleButton = await popupsPage.getGeoLocaleButton(feature.data.switchLocaleButton);
await expect(switchLocaleButton).toBeVisible();
const hrefSwitch = await switchLocaleButton.getAttribute('href');
Expand Down

0 comments on commit 6c40c9d

Please sign in to comment.