From a0b6b5631bc5733448a8008f747b0148868b564b Mon Sep 17 00:00:00 2001 From: sigadamramesh <130433161+sigadamvenkata@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:19:34 +0530 Subject: [PATCH] CC regression - accordion feature (#334) * CC Merchtable block automation CC Merchtable block automation (JIra: MWPW-140978) * CC sticky promo bar, promo with close action automated test cases CC sticky promo bar, promo with close action automated test cases Jira : MWPW-140982, MWPW-142252 * CC Regression automated cases for media rounded corners, breadcrumb features CC Regression automated cases for media rounded corners, breadcrumb features (MWPW-140976, MWPW-142543) * Update roundedcorners-mediablock.test.js * CC home page tabs, fragment reference , merch pod AU tests CC home page tabs, fragment reference , merch pod AU tests Jiras: https://jira.corp.adobe.com/browse/MWPW-143230 https://jira.corp.adobe.com/browse/MWPW-142599 https://jira.corp.adobe.com/browse/MWPW-143231 * CC , CCT product pages sanity checks automation for EN Key CC , CCT product pages sanity checks automation for EN https://jira.corp.adobe.com/browse/MWPW-146289 * CC Tier1 locales production sanity tests CC Tier1 locales production sanity tests https://jira.corp.adobe.com/browse/MWPW-146289 * Update productionsanity.spec.js removed the lengthy URL * Update productionsanity.page.js removed the space * Update productionsanity.test.js removed tailing spaces from given lines * CC page Accordion features regression automated cases CC page Accordion features regression automated cases https://jira.corp.adobe.com/browse/MWPW-147151 https://jira.corp.adobe.com/browse/MWPW-147152 https://jira.corp.adobe.com/browse/MWPW-147153 https://jira.corp.adobe.com/browse/MWPW-147154 * Update accordion.test.js corrected the typo * Update accordion.test.js fixed indentations issue at line 14,15,16 Also removed wait from line number 81 --------- Co-authored-by: Aaron Mauchley --- features/cc/accordion.spec.js | 30 ++++++++++++ selectors/cc/accordion.page.js | 15 ++++++ tests/cc/accordion.test.js | 84 ++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 features/cc/accordion.spec.js create mode 100644 selectors/cc/accordion.page.js create mode 100644 tests/cc/accordion.test.js diff --git a/features/cc/accordion.spec.js b/features/cc/accordion.spec.js new file mode 100644 index 00000000..f1ab3159 --- /dev/null +++ b/features/cc/accordion.spec.js @@ -0,0 +1,30 @@ +module.exports = { + name: 'accordion', + features: [ + { + tcid: '0', + name: '@accordion-display', + path: '/drafts/Automation-PW/accordion-faqs?georouting=off', + tags: '@cc @cc-accordion @cc-accordionUI', + }, + { + tcid: '1', + name: '@accordion-questionexpand', + path: '/drafts/Automation-PW/accordion-faqs?georouting=off', + tags: '@cc @cc-accordion @cc-accordionexpandfeature', + }, + { + tcid: '2', + name: '@accordion-questioncollapse', + path: '/drafts/Automation-PW/accordion-faqs?georouting=off', + tags: '@cc @cc-accordion @cc-accordioncollapsefeature', + }, + { + tcid: '3', + name: '@accordion-innterlinks', + path: '/drafts/Automation-PW/accordion-faqs?georouting=off', + tags: '@cc @cc-accordion @cc-accordionlinkscheck', + url: 'https://www.adobe.com/creativecloud/plans.html', + }, + ], +}; diff --git a/selectors/cc/accordion.page.js b/selectors/cc/accordion.page.js new file mode 100644 index 00000000..0950b502 --- /dev/null +++ b/selectors/cc/accordion.page.js @@ -0,0 +1,15 @@ +export default class accordion { + constructor(page) { + this.page = page; + // Accordion UI elements in page + this.accordionSection = page.locator('.accordion-container.seo.static-links.con-block.max-width-10-desktop'); + this.accordionName = this.accordionSection.locator('#accordion-1'); + this.accordionQuestion1 = this.accordionName.locator('//dt[@role="heading"]').nth(0); + this.accordionDefinition1 = this.accordionName.locator('#accordion-1-trigger-1'); + this.accordionQuestion2 = this.accordionName.locator('//dt[@role="heading"]').nth(1); + this.accordionDefinition2 = this.accordionName.locator('#accordion-1-trigger-2'); + this.DefaultState = this.accordionName.locator('//button[@id="accordion-1-trigger-1" and @aria-expanded="false"]'); + this.accordexpanded = this.accordionName.locator('//button[@id="accordion-1-trigger-1" and @aria-expanded="true"]'); + this.firstQuestionLink = page.locator('//a[@daa-ll="Learn more about the-2--What is Adobe Creati"]'); + } +} diff --git a/tests/cc/accordion.test.js b/tests/cc/accordion.test.js new file mode 100644 index 00000000..e46c084b --- /dev/null +++ b/tests/cc/accordion.test.js @@ -0,0 +1,84 @@ +import { expect, test } from '@playwright/test'; +import { features } from '../../features/cc/accordion.spec.js'; +import Accordion from '../../selectors/cc/accordion.page.js'; + +let accordion; +test.describe('verify accordion showing up with authored question and answers with expand/collapse features', () => { + test.beforeEach(async ({ page }) => { + accordion = new Accordion(page); + }); + // Verify accordion showing up with authored question and answers and UI + test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { + console.info(`[Test Page]: ${baseURL}${features[0].path}`); + await test.step('accordion UI', async () => { + await page.goto(`${baseURL}${features[0].path}`); + await page.waitForLoadState('domcontentloaded'); + await expect(page).toHaveURL(`${baseURL}${features[0].path}`); + }); + await test.step('accordion ui with expected elements', async () => { + await page.waitForLoadState(); + expect(await accordion.accordionSection).toBeTruthy(); + expect(await accordion.accordionName).toBeTruthy(); + expect(await accordion.accordionQuestion1).toBeTruthy(); + expect(await accordion.accordionDefinition1).toBeTruthy(); + expect(await accordion.accordionQuestion2).toBeTruthy(); + expect(await accordion.accordionDefinition2).toBeTruthy(); + expect(await accordion.DefaultState).toBeTruthy(); + }); + }); + // check the expand feature when click on first question + test(`${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => { + console.info(`[Test Page]: ${baseURL}${features[1].path}`); + await test.step('accordion expand on first question click', async () => { + await page.goto(`${baseURL}${features[1].path}`); + await page.waitForLoadState('domcontentloaded'); + await expect(page).toHaveURL(`${baseURL}${features[1].path}`); + }); + await test.step('accordion expand when first question clicked', async () => { + await page.waitForLoadState(); + expect(await accordion.accordionName).toBeTruthy(); + expect(await accordion.accordionQuestion1).toBeTruthy(); + expect(await accordion.accordionDefinition1).toBeTruthy(); + await accordion.accordionQuestion1.click(); + expect(await accordion.accordexpanded).toBeTruthy(); + }); + }); + // check the collapse feature when click on first question + test(`${features[2].name},${features[2].tags}`, async ({ page, baseURL }) => { + console.info(`[Test Page]: ${baseURL}${features[2].path}`); + await test.step('accordion collapse on first question click', async () => { + await page.goto(`${baseURL}${features[2].path}`); + await page.waitForLoadState('domcontentloaded'); + await expect(page).toHaveURL(`${baseURL}${features[2].path}`); + }); + await test.step('accordion collapse when first question in expanded form', async () => { + await page.waitForLoadState(); + expect(await accordion.accordionName).toBeTruthy(); + expect(await accordion.accordionQuestion1).toBeTruthy(); + expect(await accordion.accordionDefinition1).toBeTruthy(); + await accordion.accordionQuestion1.click(); + expect(await accordion.accordexpanded).toBeTruthy(); + await accordion.accordionQuestion1.click(); + expect(await accordion.DefaultState).toBeTruthy(); + }); + }); + // check the links are functional in the question summary + test(`${features[3].name},${features[3].tags}`, async ({ page, baseURL }) => { + console.info(`[Test Page]: ${baseURL}${features[3].path}`); + const { url } = features[3]; + await test.step('links are functional in the question summary', async () => { + await page.goto(`${baseURL}${features[3].path}`); + await page.waitForLoadState('domcontentloaded'); + await expect(page).toHaveURL(`${baseURL}${features[3].path}`); + }); + await test.step('links are functional in the given answers', async () => { + await page.waitForLoadState(); + expect(await accordion.accordionQuestion1).toBeTruthy(); + expect(await accordion.accordionDefinition1).toBeTruthy(); + await accordion.accordionQuestion1.click(); + expect(await accordion.accordexpanded).toBeTruthy(); + await accordion.firstQuestionLink.click(); + await expect(page).toHaveURL(url); + }); + }); +});