generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MWPW-162847 [MEP][nala] add ul-li selector test (#3238)
* add ul-li selector test * add test id --------- Co-authored-by: John Pratt <jpratt@adobe.com>
- Loading branch information
Showing
2 changed files
with
78 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,21 @@ | ||
module.exports = { | ||
name: 'Personalization Feature', | ||
features: [ | ||
{ | ||
tcid: '0', | ||
name: '@check ul selector', | ||
desc: 'Verify that ul selectors work (skipping ol selectors)', | ||
path: '/drafts/nala/features/personalization/ul-ol-li/ul-selector', | ||
data: { defaultURL: '/drafts/nala/features/personalization/ul-ol-li/ul-selector?mep=%2Fdrafts%2Fnala%2Ffeatures%2Fpersonalization%2Ful-ol-li%2Ful-selector.json--default' }, | ||
tags: '@ul0 @smoke @regression @milo ', | ||
}, | ||
{ | ||
tcid: '1', | ||
name: '@check li selectors', | ||
desc: 'Verify that li selectors work', | ||
path: '/drafts/nala/features/personalization/ul-ol-li/li-selectors', | ||
data: { defaultURL: '/drafts/nala/features/personalization/ul-ol-li/li-selectors?mep=%2Fdrafts%2Fnala%2Ffeatures%2Fpersonalization%2Ful-ol-li%2Fli-selectors.json--default' }, | ||
tags: '@ul1 @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,57 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { features } from './ul-ol-li.spec.js'; | ||
|
||
const miloLibs = process.env.MILO_LIBS || ''; | ||
|
||
// Test 0 : check ul selectors (skipping ol selectors) | ||
test(`[Test Id - ${features[0].tcid}] ${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { | ||
const pznUrl = `${baseURL}${features[0].path}${miloLibs}`; | ||
const defaultUrl = `${baseURL}${features[0].data.defaultURL}${miloLibs}`; | ||
const pznUpdateLocator = '[data-manifest-id="ul-selector.json"]'; | ||
const defaultUlLocator = 'ul.icon-list'; | ||
|
||
await test.step('step-1: verify the default test page has a regular ul list with 3 bullets', async () => { | ||
console.info(`[Test Page]: ${defaultUrl}`); | ||
await page.goto(defaultUrl); | ||
await expect(page.locator(pznUpdateLocator)).toHaveCount(0); | ||
await expect(page.locator(defaultUlLocator)).toHaveCount(1); | ||
const element = page.locator(defaultUlLocator); | ||
await expect(element.locator('li')).toHaveCount(3); | ||
}); | ||
|
||
await test.step('step-2: Verify personalized page has a text replacement for the ul list', async () => { | ||
console.info(`[Test Page]: ${pznUrl}`); | ||
await page.goto(pznUrl); | ||
const element = page.locator(pznUpdateLocator); | ||
const innerHtml = await element.innerHTML(); | ||
await expect(page.locator(pznUpdateLocator)).toHaveCount(1); | ||
await expect(page.locator(defaultUlLocator)).toHaveCount(0); | ||
await expect(innerHtml).toEqual('replacement for the ul'); | ||
}); | ||
}); | ||
|
||
// Test 1 : check li selectors | ||
test(`[Test Id - ${features[1].tcid}] ${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => { | ||
const pznUrl = `${baseURL}${features[1].path}${miloLibs}`; | ||
const defaultUrl = `${baseURL}${features[1].data.defaultURL}${miloLibs}`; | ||
const pznUpdateLocator = 'li[data-manifest-id="li-selectors.json"]'; | ||
const defaultUlLocator = 'ul.icon-list'; | ||
|
||
await test.step('step-1: verify the default test page has a regular ul list with 3 bullets', async () => { | ||
console.info(`[Test Page]: ${defaultUrl}`); | ||
await page.goto(defaultUrl); | ||
await expect(page.locator(pznUpdateLocator)).toHaveCount(0); | ||
await expect(page.locator(defaultUlLocator)).toHaveCount(1); | ||
const element = page.locator(defaultUlLocator); | ||
await expect(element.locator('li')).toHaveCount(3); | ||
}); | ||
|
||
await test.step('step-2: Verify that the personalized page has 3 replacements for the line items', async () => { | ||
console.info(`[Test Page]: ${pznUrl}`); | ||
await page.goto(pznUrl); | ||
const element = page.locator(pznUpdateLocator).first(); | ||
const innerHtml = await element.innerHTML(); | ||
await expect(page.locator(pznUpdateLocator)).toHaveCount(3); | ||
await expect(innerHtml).toEqual('replace all line items'); | ||
}); | ||
}); |