Skip to content

Commit

Permalink
add nala tests
Browse files Browse the repository at this point in the history
  • Loading branch information
3ch023 committed Dec 17, 2024
1 parent 43475cf commit 4f8b385
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nala/features/mas/docs/docs.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable max-len */

module.exports = {
FeatureName: 'Merch CCD Card Feature',
features: [
// Checkout Link Page
{
tcid: '0',
name: '@MAS-DOCS-checkout-link',
path: '/libs/features/mas/docs/checkout-link.html',
browserParams: '?theme=dark',
tags: '@mas-docs @checkout-link @commerce @smoke @regression @milo',
},
],
};
40 changes: 40 additions & 0 deletions nala/features/mas/docs/docs.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { expect, test } from '@playwright/test';
import { features } from './docs.spec.js';

const miloLibs = process.env.MILO_LIBS || '';

test.describe('CCD Merchcard feature test suite', () => {
test.beforeEach(async ({ page, browserName }) => {
test.skip(browserName !== 'chromium', 'Not supported to run on multiple browsers.');

if (browserName === 'chromium') {
await page.setExtraHTTPHeaders({ 'sec-ch-ua': '"Chromium";v="123", "Not:A-Brand";v="8"' });
}
});

// *** Checkout Link Page: ***

// @MAS-DOCS-checkout-link
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
const testPage = `${baseURL}${features[0].path}${miloLibs}`;
console.info('[Test Page]: ', testPage);

await test.step('step-1: Go to MAS Checkout Link Docs page', async () => {
await page.goto(testPage);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[0].path}`);
});

await test.step('step-2: Verify on load pending & resolved events', async () => {
const eventsLog = page.locator('#log');
await expect(eventsLog).toHaveText('checkout-link resolvedcheckout-link resolvedcheckout-link pendingcheckout-link pending');
});

await test.step('step-3: Verify on click pending & resolved events', async () => {
const btnRefresh = page.locator('#btnRefresh');
const eventsLog = page.locator('#log');
await btnRefresh.click();
await expect(eventsLog).toHaveText('checkout-link resolvedcheckout-link resolvedcheckout-link pendingcheckout-link pendingcheckout-link resolvedcheckout-link resolvedcheckout-link pendingcheckout-link pending');
});
});
});

0 comments on commit 4f8b385

Please sign in to comment.