generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MWPW-160961][NALA]Move and Update Nala Personalization feature autom…
…ation tests to Milo repo (#3087) * add personalization tests * fix eslint errors * remove commented lines --------- Co-authored-by: Santoshkumar Sharanappa Nateekar <[email protected]>
- Loading branch information
Showing
2 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
name: 'Personalization Feature', | ||
features: [ | ||
{ | ||
tcid: '0', | ||
name: '@Replace content', | ||
desc: 'Personalization with action=replaceContent', | ||
path: '/drafts/nala/features/personalization/pzn-replacecontent', | ||
data: { | ||
target: 'textpersonlization', | ||
pznExpName: 'param-target=textpersonlization', | ||
pznFileName: 'pzn1', | ||
h3Text: 'Text', | ||
}, | ||
tags: '@pzn @smoke @regression @milo ', | ||
}, | ||
{ | ||
tcid: '1', | ||
name: '@Insert Content Before', | ||
desc: 'Personalization with action=insertContentBefore', | ||
path: '/drafts/nala/features/personalization/pzn-insertcontent-before', | ||
data: { | ||
target: 'textpersonlization', | ||
pznExpName: 'param-target=textpersonlization', | ||
pznFileName: 'insert-content-before', | ||
h3Text: 'Text', | ||
}, | ||
tags: '@pzn @smoke @regression @milo ', | ||
}, | ||
{ | ||
tcid: '2', | ||
name: '@Insert Content After', | ||
desc: 'Personalization with action=insertContentAfter', | ||
path: '/drafts/nala/features/personalization/pzn-insertcontent-after', | ||
data: { | ||
target: 'textpersonlization', | ||
pznExpName: 'param-target=textpersonlization', | ||
pznFileName: 'insert-content-before', | ||
h3Text: 'Text', | ||
}, | ||
tags: '@pzn @smoke @regression @milo ', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import WebUtil from '../../libs/webutil.js'; | ||
import { features } from './personalization.spec.js'; | ||
import MarqueeBlock from '../../blocks/marquee/marquee.page.js'; | ||
import TextBlock from '../../blocks/text/text.page.js'; | ||
import Howto from '../../blocks/howto/howto.page.js'; | ||
|
||
let webUtil; | ||
let howto; | ||
let marquee; | ||
let text; | ||
let pznUrl; | ||
|
||
const miloLibs = process.env.MILO_LIBS || ''; | ||
|
||
test.describe('Milo Personalization feature test suite', () => { | ||
test.beforeEach(async ({ page }) => { | ||
webUtil = new WebUtil(page); | ||
}); | ||
|
||
test.beforeAll(async ({ baseURL }) => { | ||
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) | ||
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { | ||
console.info(`[Test Page]: ${baseURL}${features[0].path}${miloLibs}`); | ||
const { data } = features[0]; | ||
text = new TextBlock(page); | ||
marquee = new MarqueeBlock(page); | ||
pznUrl = `${baseURL}${features[0].path}${'?target='}${data.target}&${miloLibs}`; | ||
|
||
await test.step('step-1: Go to default test page', async () => { | ||
await page.goto(`${baseURL}${features[0].path}${miloLibs}`); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(`${baseURL}${features[0].path}${miloLibs}`); | ||
}); | ||
|
||
await test.step('step-2: Verify default test page content/specs', async () => { | ||
await expect(await marquee.marquee).toBeVisible(); | ||
}); | ||
|
||
await test.step('step-3: Navigate to personlized page and verify content/specs', async () => { | ||
await page.goto(pznUrl); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(pznUrl); | ||
console.info(`[Pzn Page]: ${pznUrl}`); | ||
|
||
await expect(await text.text).toBeVisible(); | ||
await expect(await text.headline).toContainText(data.h3Text); | ||
|
||
const blockDll = await webUtil.getPznBlockDaalh('text', 1, data.pznExpName, data.pznFileName); | ||
await expect(await text.text).toHaveAttribute('daa-lh', blockDll); | ||
}); | ||
}); | ||
|
||
// Test 1 : Personalization (Insert Content Before) | ||
test(`${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => { | ||
console.info(`[Test Page]: ${baseURL}${features[1].path}${miloLibs}`); | ||
const { data } = features[1]; | ||
text = new TextBlock(page); | ||
marquee = new MarqueeBlock(page); | ||
pznUrl = `${baseURL}${features[1].path}${'?target='}${data.target}&${miloLibs}`; | ||
|
||
await test.step('step-1: Go to default test page', async () => { | ||
await page.goto(`${baseURL}${features[1].path}${miloLibs}`); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(`${baseURL}${features[1].path}${miloLibs}`); | ||
}); | ||
|
||
await test.step('step-2: Verify default test page content/specs', async () => { | ||
await expect(await marquee.marquee).toBeVisible(); | ||
}); | ||
|
||
await test.step('step-3: Navigate to personlized page and verify content/specs', async () => { | ||
await page.goto(pznUrl); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(pznUrl); | ||
console.info(`[Pzn Page]: ${pznUrl}`); | ||
|
||
await expect(await text.text).toBeVisible(); | ||
await expect(await text.headline).toContainText(data.h3Text); | ||
|
||
// text block Dll analytics | ||
const textBlockDll = await webUtil.getPznBlockDaalh('text', 1, data.pznExpName, data.pznFileName); | ||
await expect(await text.text).toHaveAttribute('daa-lh', textBlockDll); | ||
|
||
// Marquee block Dll analytics | ||
await expect(await marquee.marquee).toBeVisible(); | ||
const marqueeBlockDll = await webUtil.getPznBlockDaalh('marquee', 2, data.pznExpName, data.pznFileName); | ||
await expect(await marquee.marquee).toHaveAttribute('daa-lh', marqueeBlockDll); | ||
}); | ||
}); | ||
|
||
// Test 2 : Personalization (Insert Content After) | ||
test(`${features[2].name},${features[2].tags}`, async ({ page, baseURL }) => { | ||
console.info(`[Test Page]: ${baseURL}${features[2].path}${miloLibs}`); | ||
const { data } = features[2]; | ||
text = new TextBlock(page); | ||
howto = new Howto(page); | ||
pznUrl = `${baseURL}${features[2].path}${'?target='}${data.target}&${miloLibs}`; | ||
|
||
await test.step('step-1: Go to default test page', async () => { | ||
await page.goto(`${baseURL}${features[2].path}${miloLibs}`); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(`${baseURL}${features[2].path}${miloLibs}`); | ||
}); | ||
|
||
await test.step('step-2: Verify default test page content/specs', async () => { | ||
await expect(await howto.howTo).toBeVisible(); | ||
}); | ||
|
||
await test.step('step-3: Navigate to personlized page and verify content/specs', async () => { | ||
await page.goto(pznUrl); | ||
await page.waitForLoadState('domcontentloaded'); | ||
await expect(page).toHaveURL(pznUrl); | ||
console.info(`[Pzn Page]: ${pznUrl}`); | ||
|
||
await expect(await text.text).toBeVisible(); | ||
await expect(await text.headline).toContainText(data.h3Text); | ||
|
||
// HowTo block Dll analytics | ||
await expect(await howto.howTo).toBeVisible(); | ||
const howtoBlockDll = await webUtil.getPznBlockDaalh('how-to', 1, data.pznExpName, data.pznFileName); | ||
await expect(await howto.howTo).toHaveAttribute('daa-lh', howtoBlockDll); | ||
|
||
// text block Dll analytics | ||
const textBlockDll = await webUtil.getPznBlockDaalh('text', 2, data.pznExpName, data.pznFileName); | ||
await expect(await text.text).toHaveAttribute('daa-lh', textBlockDll); | ||
}); | ||
}); | ||
}); |