Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-164967 [NALA] test for Target enablement #3509

Open
wants to merge 7 commits into
base: stage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions nala/features/personalization/target-on.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
name: 'check for Target enablement via page metadata and via URL parameter',
features: [
{
tcid: '0',
name: '@check the default page for its default text',
desc: 'the default page should NOT say "Target is running"',
path: '/drafts/nala/features/personalization/target-on/target-on?mep=%2Fdrafts%2Fnala%2Ffeatures%2Fpersonalization%2Ftarget-on%2Fmanifest.json--default',
data: {},
tags: '@targeton0 @smoke @regression @milo ',
},
{
tcid: '1',
name: '@check for Target enablement via page metadata',
desc: 'Target should be enabled by page metadata',
path: '/drafts/nala/features/personalization/target-on/target-on',
data: {},
tags: '@targeton1 @smoke @regression @milo ',
},
{
tcid: '2',
name: '@check for Target enablement via URL parameter',
desc: 'Target should be enabled by a URL parameter',
path: '/drafts/nala/features/personalization/target-on/target-on2?target=on',
data: {},
tags: '@targeton2 @smoke @regression @milo ',
},
],
};
35 changes: 35 additions & 0 deletions nala/features/personalization/target-on.test.js
Original file line number Diff line number Diff line change
@@ -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 the default page
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
const defaultURL = `${baseURL}${features[0].path}${miloLibs}`;
const marquee = new MarqueeBlock(page);
console.info(`[Test Page]: ${defaultURL}`);
await page.goto(defaultURL);
await expect(marquee.headingXL).toHaveText('Heading XL Marquee standard medium left');
});

// Test 1: check for Target enablement via page metadata
test(`${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => {
const metadataURL = `${baseURL}${features[1].path}${miloLibs}`;
const marquee = new MarqueeBlock(page);
console.info(`[Test Page]: ${metadataURL}`);
await page.goto(metadataURL);
await expect(marquee.headingXL).toHaveText('Target is running');

Check failure on line 25 in nala/features/personalization/target-on.test.js

View workflow job for this annotation

GitHub Actions / Running Nala E2E UI Tests (20.x)

[milo-live-chromium] › features/personalization/target-on.test.js:20:5 › @check for Target enablement via page metadata

1) [milo-live-chromium] › features/personalization/target-on.test.js:20:5 › @check for Target enablement via page metadata,@targeton1 @smoke @regression @milo Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('.marquee').first().locator('.heading-xl').first() Expected string: "Target is running" Received string: "Heading XL Marquee standard medium left" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('.marquee').first().locator('.heading-xl').first() - locator resolved to <h2 class="heading-xl" id="heading-xl-marquee-standard-medium-left">…</h2> - unexpected value "Heading XL Marquee standard medium left" 23 | console.info(`[Test Page]: ${metadataURL}`); 24 | await page.goto(metadataURL); > 25 | await expect(marquee.headingXL).toHaveText('Target is running'); | ^ 26 | }); 27 | 28 | // Test 2: check for Target enablement via URL parameter at /home/runner/work/milo/milo/nala/features/personalization/target-on.test.js:25:35

Check failure on line 25 in nala/features/personalization/target-on.test.js

View workflow job for this annotation

GitHub Actions / Running Nala E2E UI Tests (20.x)

[milo-live-chromium] › features/personalization/target-on.test.js:20:5 › @check for Target enablement via page metadata

1) [milo-live-chromium] › features/personalization/target-on.test.js:20:5 › @check for Target enablement via page metadata,@targeton1 @smoke @regression @milo Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('.marquee').first().locator('.heading-xl').first() Expected string: "Target is running" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('.marquee').first().locator('.heading-xl').first() 23 | console.info(`[Test Page]: ${metadataURL}`); 24 | await page.goto(metadataURL); > 25 | await expect(marquee.headingXL).toHaveText('Target is running'); | ^ 26 | }); 27 | 28 | // Test 2: check for Target enablement via URL parameter at /home/runner/work/milo/milo/nala/features/personalization/target-on.test.js:25:35
});

// Test 2: check for Target enablement via URL parameter
test(`${features[2].name},${features[2].tags}`, async ({ page, baseURL }) => {
const parameterURL = `${baseURL}${features[2].path}${miloLibs}`;
const marquee = new MarqueeBlock(page);
console.info(`[Test Page]: ${parameterURL}`);
await page.goto(parameterURL);
await expect(marquee.headingXL).toHaveText('Target is running');

Check failure on line 34 in nala/features/personalization/target-on.test.js

View workflow job for this annotation

GitHub Actions / Running Nala E2E UI Tests (20.x)

[milo-live-chromium] › features/personalization/target-on.test.js:29:5 › @check for Target enablement via URL parameter

2) [milo-live-chromium] › features/personalization/target-on.test.js:29:5 › @check for Target enablement via URL parameter,@targeton2 @smoke @regression @milo Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('.marquee').first().locator('.heading-xl').first() Expected string: "Target is running" Received string: "Heading XL Marquee standard medium left" Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('.marquee').first().locator('.heading-xl').first() - locator resolved to <h2 class="heading-xl" id="heading-xl-marquee-standard-medium-left">…</h2> - unexpected value "Heading XL Marquee standard medium left" 32 | console.info(`[Test Page]: ${parameterURL}`); 33 | await page.goto(parameterURL); > 34 | await expect(marquee.headingXL).toHaveText('Target is running'); | ^ 35 | }); 36 | at /home/runner/work/milo/milo/nala/features/personalization/target-on.test.js:34:35

Check failure on line 34 in nala/features/personalization/target-on.test.js

View workflow job for this annotation

GitHub Actions / Running Nala E2E UI Tests (20.x)

[milo-live-chromium] › features/personalization/target-on.test.js:29:5 › @check for Target enablement via URL parameter

2) [milo-live-chromium] › features/personalization/target-on.test.js:29:5 › @check for Target enablement via URL parameter,@targeton2 @smoke @regression @milo Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: locator('.marquee').first().locator('.heading-xl').first() Expected string: "Target is running" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for locator('.marquee').first().locator('.heading-xl').first() 32 | console.info(`[Test Page]: ${parameterURL}`); 33 | await page.goto(parameterURL); > 34 | await expect(marquee.headingXL).toHaveText('Target is running'); | ^ 35 | }); 36 | at /home/runner/work/milo/milo/nala/features/personalization/target-on.test.js:34:35
});
Loading