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

ckg-link-list block automation #450

Merged
merged 9 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
43 changes: 43 additions & 0 deletions configs/express.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,49 @@ const config = {
baseURL: envs['@express_live'],
},
},

{
name: 'express-milo-main-chromium',
use: {
...devices['Desktop Chrome'],
baseURL: envs['@express_milo'],
viewport: { width: 1680, height: 1024 },
},
},

{
name: 'express-milo-main-firefox',
use: {
...devices['Desktop Firefox'],
baseURL: envs['@express_milo'],
viewport: { width: 1680, height: 720 },
},
},

{
name: 'express-milo-main-webkit',
use: {
...devices['Desktop Safari'],
baseURL: envs['@express_milo'],
viewport: { width: 1680, height: 720 },
},
},

{
name: 'express-milo-main-android',
use: {
...devices['Pixel 5'],
baseURL: envs['@express_milo'],
},
},

{
name: 'express-milo-main-iphone',
use: {
...devices['iPhone SE'],
baseURL: envs['@express_milo'],
},
},
],
};

Expand Down
1 change: 1 addition & 0 deletions envs/envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
'@dme_stage': 'https://stage--dme-partners--adobecom.hlx.live',
'@express_stage': 'https://stage--express--adobecom.hlx.live/express',
'@express_live': 'https://main--express--adobecom.hlx.live/express',
'@express_milo': 'https://main--express-milo--adobecom.hlx.live/express',
'@graybox_bacom': 'https://test.business-graybox.adobe.com',
'@graybox_dc': 'https://test.graybox.adobe.com',
};
11 changes: 11 additions & 0 deletions features/express/ckg-link-list.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
FeatureName: 'ckg-link-list block',
features: [
{
tcid: '0',
name: '@ckg-link-list',
path: '/colors/red',
tags: '@ckg-link-list @smoke @regression',
},
],
};
16 changes: 16 additions & 0 deletions selectors/express/ckg-link-list.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default class ckgLinkList {
constructor(page) {
this.page = page;
this.ckgLinkList = page.locator('.ckg-link-list');
this.pill = page.locator('.button-container.carousel-element');
this.pillLink = page.locator('.button-container.carousel-element > a');
this.carouselArrowLeftHidden = page.locator('.ckg-link-list .carousel-fader-left.arrow-hidden');
this.carouselArrowRightHidden = page.locator('.ckg-link-list .carousel-fader-right.arrow-hidden');
this.carouselArrowLeftShow = page.locator('.ckg-link-list .carousel-fader-left');
this.carouselArrowRightShow = page.locator('.ckg-link-list .carousel-fader-right');
this.carouselArrowLeft = page.locator('.ckg-link-list .carousel-fader-left');
this.carouselArrowRight = page.locator('.ckg-link-list .carousel-fader-right');
this.leftArrowBtn = page.locator('.ckg-link-list .button.carousel-arrow.carousel-arrow-left');
this.rightArrowBtn = page.locator('.ckg-link-list .button.carousel-arrow.carousel-arrow-right');
}
}
79 changes: 79 additions & 0 deletions tests/express/ckg-link-list.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* eslint-disable no-plusplus */
import { expect, test } from '@playwright/test';
import { features } from '../../features/express/ckg-link-list.spec.js';
import CkgLinkList from '../../selectors/express/ckg-link-list.page.js';

let ckgLinkList;

test.describe('Ckg Link List Block Test Suite', () => {
// before each test block
test.beforeEach(async ({ page }) => {
ckgLinkList = new CkgLinkList(page);
});

test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
console.info(`${baseURL}${features[0].path}`);

await test.step('Go to CLL block test page', async () => {
await page.goto(`${baseURL}${features[0].path}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[0].path}`);
await page.waitForTimeout(3000);
});

await test.step('Verify pills are displayed ', async () => {
await page.waitForLoadState();
await ckgLinkList.ckgLinkList.scrollIntoViewIfNeeded();
await expect(ckgLinkList.ckgLinkList).toBeVisible();
const totalPills = await ckgLinkList.pill.count();
expect(totalPills).toBeTruthy();

for (let i = 0; i < totalPills; i++) {
const text = await ckgLinkList.pill.nth(i).innerText();
expect(text.length).toBeTruthy();
}
});

await test.step('Verify arrow buttons', async () => {
await ckgLinkList.carouselArrowLeftHidden.waitFor();
await ckgLinkList.carouselArrowRightShow.waitFor();
await expect(ckgLinkList.carouselArrowRightShow).toHaveCount(1);
await expect(ckgLinkList.carouselArrowLeftHidden).toHaveCount(1);
});

await test.step('Verify scroll using buttons', async () => {
await page.waitForLoadState();
await ckgLinkList.ckgLinkList.scrollIntoViewIfNeeded();
const totalPills = await ckgLinkList.pill.count();
if (totalPills) {
await ckgLinkList.rightArrowBtn.click();
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(2000);
await ckgLinkList.carouselArrowLeftShow.waitFor();
await ckgLinkList.carouselArrowRightShow.waitFor();
expect(ckgLinkList.carouselArrowLeftShow).toHaveCount(1);
expect(ckgLinkList.carouselArrowRightShow).toHaveCount(1);

await ckgLinkList.leftArrowBtn.click();
await ckgLinkList.carouselArrowLeftHidden.waitFor();
await ckgLinkList.carouselArrowRightShow.waitFor();
await expect(ckgLinkList.carouselArrowRightShow).toHaveCount(1);
await expect(ckgLinkList.carouselArrowLeftHidden).toHaveCount(1);
}
});

await test.step('Click pill and go to page ', async () => {
await ckgLinkList.ckgLinkList.scrollIntoViewIfNeeded();
await page.waitForLoadState();
const totalPills = await ckgLinkList.pill.count();

if (totalPills) {
const btnText = await ckgLinkList.pill.nth(0).innerText();
const pageColor = btnText.toLowerCase().replace(' ', '-');
await ckgLinkList.pill.nth(0).click();
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}/colors/${pageColor}`);
}
});
});
});
Loading