From e833a8dff7b2d9839a8799d1fa530e6c4c5ebcfe Mon Sep 17 00:00:00 2001 From: John Pratt Date: Thu, 16 Jan 2025 13:49:52 -0700 Subject: [PATCH 1/4] create target-on test --- .../personalization/target-on.spec.js | 17 +++++++++ .../personalization/target-on.test.js | 35 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 nala/features/personalization/target-on.spec.js create mode 100644 nala/features/personalization/target-on.test.js diff --git a/nala/features/personalization/target-on.spec.js b/nala/features/personalization/target-on.spec.js new file mode 100644 index 0000000000..573b3ba026 --- /dev/null +++ b/nala/features/personalization/target-on.spec.js @@ -0,0 +1,17 @@ +module.exports = { + name: 'check for Target enablement via page metadata and via URL parameter', + features: [ + { + tcid: '0', + name: '@check for running Target tests', + desc: 'there should be 2 running Target tests, one enabled by a URL parameter and one enabled by page metadata', + path: '', + data: { + defaultURL: '/drafts/nala/features/personalization/target-on/target-on2?target=on&mep=%2Fdrafts%2Fnala%2Ffeatures%2Fpersonalization%2Ftarget-on%2Fmanifest.json--default', + metadataURL: '/drafts/nala/features/personalization/target-on/target-on', + parameterURL: '/drafts/nala/features/personalization/target-on/target-on2?target=on', + }, + tags: '@targeton0 @smoke @regression @milo ', + }, + ], +}; diff --git a/nala/features/personalization/target-on.test.js b/nala/features/personalization/target-on.test.js new file mode 100644 index 0000000000..605ba5cc0a --- /dev/null +++ b/nala/features/personalization/target-on.test.js @@ -0,0 +1,35 @@ +// to run the test: npm run nala stage target-on.test.js + +// Note: this test deliberately skips checking for the global metadata spreadsheet because one does not exist in the milo repository + +import { expect, test } from '@playwright/test'; +import { features } from './target-on.spec.js'; +import MarqueeBlock from '../../blocks/marquee/marquee.page.js'; + +const miloLibs = process.env.MILO_LIBS || ''; + +// Test 0: check for running Target tests +test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { + const defaultURL = `${baseURL}${features[0].data.defaultURL}${miloLibs}`; + const metadataURL = `${baseURL}${features[0].data.metadataURL}${miloLibs}`; + const parameterURL = `${baseURL}${features[0].data.parameterURL}${miloLibs}`; + const marquee = new MarqueeBlock(page); + + await test.step('step-1: verify default test page', async () => { + console.info(`[Test Page]: ${defaultURL}`); + await page.goto(defaultURL); + await expect(marquee.headingXL).toHaveText('Heading XL Marquee standard medium left'); + }); + + await test.step('step-2: verify default test page', async () => { + console.info(`[Test Page]: ${metadataURL}`); + await page.goto(metadataURL); + await expect(marquee.headingXL).toHaveText('Target is running'); + }); + + await test.step('step-3: verify default test page', async () => { + console.info(`[Test Page]: ${parameterURL}`); + await page.goto(parameterURL); + await expect(marquee.headingXL).toHaveText('Target is running'); + }); +}); From 3a1b9ebbc5f48c7204bc309c8a4b7a11d83d7b8a Mon Sep 17 00:00:00 2001 From: John Pratt Date: Thu, 16 Jan 2025 14:37:37 -0700 Subject: [PATCH 2/4] fix comment messaging --- nala/features/personalization/target-on.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nala/features/personalization/target-on.test.js b/nala/features/personalization/target-on.test.js index 605ba5cc0a..ab865e873e 100644 --- a/nala/features/personalization/target-on.test.js +++ b/nala/features/personalization/target-on.test.js @@ -21,13 +21,13 @@ test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { await expect(marquee.headingXL).toHaveText('Heading XL Marquee standard medium left'); }); - await test.step('step-2: verify default test page', async () => { + await test.step('step-2: verify metadata test page', async () => { console.info(`[Test Page]: ${metadataURL}`); await page.goto(metadataURL); await expect(marquee.headingXL).toHaveText('Target is running'); }); - await test.step('step-3: verify default test page', async () => { + await test.step('step-3: verify parameter test page', async () => { console.info(`[Test Page]: ${parameterURL}`); await page.goto(parameterURL); await expect(marquee.headingXL).toHaveText('Target is running'); From a88f83a4e323a31ca0f6a69d7b9e9371bc5e1fc9 Mon Sep 17 00:00:00 2001 From: John Pratt Date: Thu, 16 Jan 2025 14:59:13 -0700 Subject: [PATCH 3/4] add 1-second timeout --- nala/features/personalization/target-on.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nala/features/personalization/target-on.test.js b/nala/features/personalization/target-on.test.js index ab865e873e..e067e1c733 100644 --- a/nala/features/personalization/target-on.test.js +++ b/nala/features/personalization/target-on.test.js @@ -18,18 +18,21 @@ test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { await test.step('step-1: verify default test page', async () => { console.info(`[Test Page]: ${defaultURL}`); await page.goto(defaultURL); + await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Heading XL Marquee standard medium left'); }); await test.step('step-2: verify metadata test page', async () => { console.info(`[Test Page]: ${metadataURL}`); await page.goto(metadataURL); + await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Target is running'); }); await test.step('step-3: verify parameter test page', async () => { console.info(`[Test Page]: ${parameterURL}`); await page.goto(parameterURL); + await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Target is running'); }); }); From 69c474b28a88f014b5e668fcad3dccf766e03388 Mon Sep 17 00:00:00 2001 From: John Pratt Date: Thu, 16 Jan 2025 15:20:14 -0700 Subject: [PATCH 4/4] remove time delays --- nala/features/personalization/target-on.test.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/nala/features/personalization/target-on.test.js b/nala/features/personalization/target-on.test.js index e067e1c733..ab865e873e 100644 --- a/nala/features/personalization/target-on.test.js +++ b/nala/features/personalization/target-on.test.js @@ -18,21 +18,18 @@ test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { await test.step('step-1: verify default test page', async () => { console.info(`[Test Page]: ${defaultURL}`); await page.goto(defaultURL); - await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Heading XL Marquee standard medium left'); }); await test.step('step-2: verify metadata test page', async () => { console.info(`[Test Page]: ${metadataURL}`); await page.goto(metadataURL); - await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Target is running'); }); await test.step('step-3: verify parameter test page', async () => { console.info(`[Test Page]: ${parameterURL}`); await page.goto(parameterURL); - await page.waitForTimeout(1000); await expect(marquee.headingXL).toHaveText('Target is running'); }); });