Skip to content

Commit

Permalink
fix: MDS-1320 adding swipe tests - init approach
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioGranada committed Sep 17, 2024
1 parent 2a446c6 commit dc11fd0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/app/client/carousel/examples/SelectIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SelectIndex = () => {
</Chip>
))}
</div>
<Carousel step={1} selectedIndex={selected} className="w-[320px]">
<Carousel step={1} selectedIndex={selected} className="w-[320px]" data-testid="selectedIndex-carousel" isSwipeDragDisabled>
<Carousel.Reel>
{ITEMS.map((_, index) => (
<Carousel.Item
Expand Down
20 changes: 20 additions & 0 deletions docs/e2e/carousel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,26 @@ test.describe("Carousel in Light Theme", () => {
await page.getByTestId(`carousel-button-0`).click();
await expect(page.getByTestId(`carousel-0`)).toBeInViewport();
});
test('SelectedIndex: Swipping over the carousel should be disabled when isSwipeDragDisabled is present', async ({page}) => {

Check warning on line 174 in docs/e2e/carousel.spec.ts

View workflow job for this annotation

GitHub Actions / Spellcheck

Unknown word (Swipping)
const autoSlideCarousel = page.getByTestId('selectedIndex-carousel');
const secondElementInCarousel = page.getByTestId('carousel-button-1');

await secondElementInCarousel.first().click();
await page.waitForTimeout(500);
await autoSlideCarousel.hover();
await page.waitForTimeout(500);
await page.mouse.wheel(100, 0);
await page.waitForTimeout(500);
await page.mouse.wheel(-100, 0);
await page.waitForTimeout(500);
await expect(autoSlideCarousel.getByTestId(`carousel-1`)).toBeInViewport();

// await page.getByTestId(`carousel-button-1`).first().click();
// await page.waitForTimeout(500);
// await expect(page.getByTestId(`carousel-1`)).toBeInViewport();
// await page.getByTestId(`carousel-button-0`).click();
// await expect(page.getByTestId(`carousel-0`)).toBeInViewport();
});
});
/* Spaces tests */
test.describe("Spaces tests", () => {
Expand Down

0 comments on commit dc11fd0

Please sign in to comment.