Skip to content

Commit

Permalink
test(slider): move two types of test separate to each other
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaushik95 committed Jun 27, 2024
1 parent acf2770 commit ef63c8b
Showing 1 changed file with 38 additions and 39 deletions.
77 changes: 38 additions & 39 deletions e2e/components/Slider/Slider-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,45 +92,44 @@ test.describe('@avt Slider', () => {
await expect(page).toHaveNoACViolations('Slider-with-layer');
});

test.slow(
'@avt-advanced-states slider with custom format',
async ({ page }) => {
await visitStory(page, {
component: 'Slider',
id: 'components-slider--slider-with-custom-value-label',
globals: {
theme: 'white',
},
});

// Test for label changes
// Initial value
await page.keyboard.press('Tab');
await expect(page.getByRole('slider')).toBeVisible();
await page.keyboard.press('Tab');

await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'Medium'
);
// Move to high
await page.keyboard.press('Shift+ArrowRight');
await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'High'
);

// Move to Low
await page.keyboard.press('Shift+ArrowLeft');
await page.keyboard.press('Shift+ArrowLeft');
await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'Low'
);

await expect(page).toHaveNoACViolations('Slider-with-custom-value-label');
}
);
test('@avt-advanced-states slider with custom format', async ({ page }) => {
await visitStory(page, {
component: 'Slider',
id: 'components-slider--slider-with-custom-value-label',
globals: {
theme: 'white',
},
});

await expect(page).toHaveNoACViolations('Slider-with-custom-value-label');
});

test.slow('@avt-keyboard-nav slider with custom format', async ({ page }) => {
// Test for label changes
// Initial value
await page.keyboard.press('Tab');
await expect(page.getByRole('slider')).toBeVisible();
await page.keyboard.press('Tab');

await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'Medium'
);
// Move to high
await page.keyboard.press('Shift+ArrowRight');
await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'High'
);

// Move to Low
await page.keyboard.press('Shift+ArrowLeft');
await page.keyboard.press('Shift+ArrowLeft');
await expect(page.getByRole('slider')).toHaveAttribute(
'aria-valuetext',
'Low'
);
});

// Prevent timeout
test.slow('@avt-keyboard-nav', async ({ page }) => {
Expand Down

0 comments on commit ef63c8b

Please sign in to comment.