From 6510d8c9659372dcb4851c7c1be66862365d784d Mon Sep 17 00:00:00 2001 From: Anamika T S Date: Fri, 13 Dec 2024 16:38:03 +0530 Subject: [PATCH] test(checklist): add test for taskname --- .../Checklist/Checklist-test.avt.e2e.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/e2e/components/Checklist/Checklist-test.avt.e2e.js b/e2e/components/Checklist/Checklist-test.avt.e2e.js index 53cd0d0715..1ffdf56370 100644 --- a/e2e/components/Checklist/Checklist-test.avt.e2e.js +++ b/e2e/components/Checklist/Checklist-test.avt.e2e.js @@ -23,6 +23,8 @@ test.describe('Checklist @avt', () => { const buttonEle = page.locator('[aria-label="Checklist toggle"]'); const viewButton = page.getByRole('button', { name: 'View all (10)' }); + const tooltipContent = await page.getByText('Toggle'); + const taskButtons = page.locator('[title="Task name"]'); //press tab to move focus to buttonELement await page.keyboard.press('Tab'); await expect(buttonEle).toBeInViewport(); @@ -35,12 +37,28 @@ test.describe('Checklist @avt', () => { await page.keyboard.press('Enter'); await expect(buttonEle).toHaveAttribute('aria-expanded', 'false'); - //Press escape to clear the focus + //Press to hide tooltip await page.keyboard.press('Escape'); + await expect(tooltipContent).not.toBeVisible(); + + //Press tab to move focus to 1st Task name + await page.keyboard.press('Tab'); + await expect(taskButtons.nth(0)).toBeFocused(); + + //Press tab to move focus to 2nd Task name + await page.keyboard.press('Tab'); + await expect(taskButtons.nth(1)).toBeFocused(); + + //Press tab to move focus to 3rd Task name + await page.keyboard.press('Tab'); + await expect(taskButtons.nth(2)).toBeFocused(); + + //Press tab to move focus to View all(10) button + await page.keyboard.press('Tab'); + await expect(viewButton).toBeFocused(); //check button element is showing Toggle tooltip while hovering await buttonEle.hover(); - const tooltipContent = await page.getByText('Toggle'); await expect(tooltipContent).toBeVisible(); });