Skip to content

Commit

Permalink
[MWPW-158315][NALA][Accessibility] Add Accessibility automation tests…
Browse files Browse the repository at this point in the history
… scripts for milo blocks (#3079)

* add accessibility tests

* fix eslint errors

* fix eslint errors-1

---------

Co-authored-by: Santoshkumar Sharanappa Nateekar <[email protected]>
  • Loading branch information
skumar09 and Santoshkumar Sharanappa Nateekar authored Oct 24, 2024
1 parent 029f841 commit c61c4d6
Show file tree
Hide file tree
Showing 16 changed files with 459 additions and 34 deletions.
18 changes: 18 additions & 0 deletions nala/blocks/accordion/accordion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect, test } from '@playwright/test';
import WebUtil from '../../libs/webutil.js';
import { features } from './accordion.spec.js';
import AccordionBlock from './accordion.page.js';
import { runAccessibilityTest } from '../../libs/accessibility.js';

let webUtil;
let accordion;
Expand Down Expand Up @@ -50,6 +51,10 @@ test.describe('Milo Accordion Block test suite', () => {
await expect(await accordion.section).toHaveAttribute('daa-lh', await webUtil.getSectionDaalh(1));
await expect(await accordion.accordion).toHaveAttribute('daa-lh', await webUtil.getBlockDaalh('accordion-container', 1));
});

await test.step('step-4: Verify the accessibility test on the accordion block', async () => {
await runAccessibilityTest({ page, testScope: accordion.accordion });
});
});

// Test 1 : Accordion (seo)
Expand Down Expand Up @@ -78,6 +83,10 @@ test.describe('Milo Accordion Block test suite', () => {
await test.step('step-3: Verify analytics attributes', async () => {
await expect(await accordion.accordion).toHaveAttribute('daa-lh', await webUtil.getBlockDaalh('accordion-container', 1));
});

await test.step('step-4: Verify the accessibility test on the accordion block', async () => {
await runAccessibilityTest({ page, testScope: accordion.accordion });
});
});

// Test 2 : Accordion (quiet, max-width-12-desktop-large)
Expand Down Expand Up @@ -110,6 +119,10 @@ test.describe('Milo Accordion Block test suite', () => {
await test.step('step-3: Verify analytics attributes', async () => {
await expect(await accordion.accordion).toHaveAttribute('daa-lh', await webUtil.getBlockDaalh('accordion-container', 1));
});

await test.step('step-4: Verify the accessibility test on the accordion block', async () => {
await runAccessibilityTest({ page, testScope: accordion.accordion });
});
});

// Test 3 : Accordion seo editorial
Expand All @@ -132,5 +145,10 @@ test.describe('Milo Accordion Block test suite', () => {
await expect(await accordion.outlineButton).toContainText(data.outlineButtonText);
await expect(await accordion.blueButton).toContainText(data.blueButtonText);
});

await test.step('step-4: Verify the accessibility test on the Accordion seo editorial block', async () => {
// The accessibility test for the Accordion seo editorial is failing, so skipping it.
await runAccessibilityTest({ page, testScope: accordion.accordion, skipA11yTest: true });
});
});
});
33 changes: 33 additions & 0 deletions nala/blocks/actionitem/actionitem.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test } from '@playwright/test';
import { features } from './actionitem.spec.js';
import ActionItem from './actionitem.page.js';
import { runAccessibilityTest } from '../../libs/accessibility.js';

let actionItem;

Expand Down Expand Up @@ -30,6 +31,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.bodyTextLink).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (Small) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.small });
});
});

// Test 1 : Action-Item (Medium)
Expand All @@ -51,6 +56,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.bodyTextLink).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (Medium) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.medium });
});
});

// Test 2 : Action-Item (Large)
Expand All @@ -72,6 +81,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.bodyTextLink).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (Large) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.large });
});
});

// Test 3 : Action-Item (Center)
Expand All @@ -92,6 +105,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.bodyTextLink).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (Center) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.center });
});
});

// Test 4 : Action-Item (Rounded)
Expand All @@ -113,6 +130,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.bodyTextLink).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (Rounded) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.rounded });
});
});

// Test 5 : Action-Item (Float Button)
Expand All @@ -133,6 +154,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.floatOutlineButton).toBeVisible();
await expect(await actionItem.floatOutlineButton).toContainText(data.floatButtonText);
});

await test.step('step-4: Verify the accessibility test on the Action-Item (Float Button) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.actionItemFloat });
});
await test.step('step-3: Click the float button', async () => {
await actionItem.floatButton.click();
expect(await page.url()).not.toBe(testPage);
Expand All @@ -158,6 +183,10 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.image).toBeVisible();
await expect(await actionItem.bodyText).toContainText(data.bodyText);
});

await test.step('step-3: Verify the accessibility test on the Action-Item (scroller) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.actionScroller });
});
});

// Test 7 : Action-Item (scroller)
Expand All @@ -184,5 +213,9 @@ test.describe('Milo Action-Item block test suite', () => {
await expect(await actionItem.previousButton).toBeVisible({ timeout: 1000 });
await expect(await actionItem.navigationNext).toHaveAttribute('hide-btn', 'false');
});

await test.step('step-3: Verify the accessibility test on the Action-Item (scroller) block', async () => {
await runAccessibilityTest({ page, testScope: actionItem.actionScroller });
});
});
});
Loading

0 comments on commit c61c4d6

Please sign in to comment.