Skip to content

Commit

Permalink
fix: Update Carousel specs
Browse files Browse the repository at this point in the history
  • Loading branch information
avattipalli committed Feb 14, 2024
1 parent 797915e commit 8827372
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/functional/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default defineConfig({
'x-vercel-protection-bypass': process.env.VERCEL_PROTECTION_BYPASS,
'x-vercel-set-bypass-cookie': process.env.CI ? 'true' : 'false',
},
actionTimeout: 10000,
},
projects: [
{
Expand Down
36 changes: 28 additions & 8 deletions packages/functional/tests/ui/core/components/Carousel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test.beforeEach(async ({ page }) => {

await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Best Selling Products' }) })
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('tablist', { name: 'Slides' })
.scrollIntoViewIfNeeded();

Expand All @@ -17,35 +17,55 @@ test.beforeEach(async ({ page }) => {
test('Navigate to next set of products', async ({ page }) => {
await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Best Selling Products' }) })
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('button', { name: 'Next products' })
.click();

await expect(page.getByRole('link', { name: '[Sample] Orbit Terrarium - Large' })).toBeVisible();
await expect(
page.getByRole('link', { name: '[Sample] Tiered Wire Basket' }).first(),
).toBeVisible();
});

test('Navigate to previous set of products', async ({ page }) => {
await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Best Selling Products' }) })
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('button', { name: 'Previous products' })
.click();

await expect(page.getByRole('link', { name: '[Sample] Orbit Terrarium - Large' })).toBeVisible();
await expect(
page.getByRole('link', { name: '[Sample] Orbit Terrarium - Large' }).first(),
).toBeVisible();
});

test('Navigation on set of products is cyclic', async ({ page }) => {
await expect(page.getByRole('link', { name: '[Sample] Smith Journal 13' })).toBeVisible();

await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Best Selling Products' }) })
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('button', { name: 'Next products' })
.click();

await expect(
page.getByRole('link', { name: '[Sample] Tiered Wire Basket' }).first(),
).toBeVisible();

await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Best Selling Products' }) })
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('button', { name: 'Next products' })
.click();

await expect(page.getByRole('link', { name: '[Sample] Able Brewing System' })).toBeVisible();
await expect(
page.getByRole('link', { name: '[Sample] Able Brewing System' }).first(),
).toBeVisible();

await page
.getByRole('region')
.filter({ has: page.getByRole('heading', { name: 'Featured products' }) })
.getByRole('button', { name: 'Next products' })
.click();

await expect(page.getByRole('link', { name: '[Sample] Smith Journal 13' }).first()).toBeVisible();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8827372

Please sign in to comment.