forked from adobecom/nala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/adobecom/nala
- Loading branch information
Showing
6 changed files
with
216 additions
and
65 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
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
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,11 @@ | ||
module.exports = { | ||
FeatureName: 'ckg-link-list block', | ||
features: [ | ||
{ | ||
tcid: '0', | ||
name: '@ckg-link-list', | ||
path: '/express/colors/red', | ||
tags: '@ckg-link-list @smoke @regression', | ||
}, | ||
], | ||
}; |
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
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,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'); | ||
} | ||
} |
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,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}/express/colors/${pageColor}`); | ||
} | ||
}); | ||
}); | ||
}); |