-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,103 @@ | ||
import {test} from './fixture'; | ||
import {test, expect} from './fixture'; | ||
|
||
test.describe('default', () => { | ||
test('should be A11Y compliant', async () => {}); | ||
test.describe('before query is loaded', () => { | ||
test.beforeEach(async ({recommendationList}) => { | ||
await recommendationList.load({story: 'before-query'}); | ||
await recommendationList.hydrated.waitFor(); | ||
}); | ||
|
||
test('should be a11y compliant', async ({makeAxeBuilder}) => { | ||
const accessibilityResults = await makeAxeBuilder().analyze(); | ||
expect(accessibilityResults.violations.length).toEqual(0); | ||
}); | ||
|
||
test('should have placeholders', async ({recommendationList}) => { | ||
await expect(recommendationList.placeholder.first()).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.describe('after query is loaded', () => { | ||
test.beforeEach(async ({recommendationList}) => { | ||
await recommendationList.load({story: 'default'}); | ||
await recommendationList.hydrated.waitFor(); | ||
}); | ||
|
||
test('should be a11y compliant', async ({makeAxeBuilder}) => { | ||
const accessibilityResults = await makeAxeBuilder().analyze(); | ||
expect(accessibilityResults.violations.length).toEqual(0); | ||
}); | ||
|
||
test('should have recommendations', async ({recommendationList}) => { | ||
await expect(recommendationList.recommendation.first()).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.describe('with a full result template', () => { | ||
test.beforeEach(async ({recommendationList}) => { | ||
await recommendationList.load({story: 'with-full-template'}); | ||
await recommendationList.hydrated.waitFor(); | ||
}); | ||
|
||
test('should be a11y compliant', async ({makeAxeBuilder}) => { | ||
const accessibilityResults = await makeAxeBuilder().analyze(); | ||
expect(accessibilityResults.violations.length).toEqual(0); | ||
}); | ||
|
||
test('should have recommendations', async ({recommendationList}) => { | ||
await expect(recommendationList.recommendation.first()).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.describe('with a carousel', () => { | ||
test.beforeEach(async ({recommendationList}) => { | ||
await recommendationList.load({story: 'as-carousel'}); | ||
await recommendationList.hydrated.waitFor(); | ||
}); | ||
|
||
test('should be a11y compliant', async ({makeAxeBuilder}) => { | ||
const accessibilityResults = await makeAxeBuilder().analyze(); | ||
expect(accessibilityResults.violations.length).toEqual(0); | ||
}); | ||
|
||
test('should have recommendations', async ({recommendationList}) => { | ||
await expect(recommendationList.recommendation.first()).toBeVisible(); | ||
}); | ||
|
||
test('should support going forward and backward', async ({ | ||
recommendationList, | ||
}) => { | ||
await recommendationList.nextButton.click(); | ||
await expect(recommendationList.indicators.nth(1)).toHaveAttribute( | ||
'part', | ||
'indicator active-indicator' | ||
); | ||
|
||
await recommendationList.prevButton.click(); | ||
await recommendationList.prevButton.click(); | ||
await expect(recommendationList.indicators.nth(2)).toHaveAttribute( | ||
Check failure on line 77 in packages/atomic/src/components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts GitHub Actions / Run Playwright tests for Atomic (8, 24)[chromium] › components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts:66:3 › with a carousel › should support going forward and backward
Check failure on line 77 in packages/atomic/src/components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts GitHub Actions / Run Playwright tests for Atomic (8, 24)[chromium] › components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts:66:3 › with a carousel › should support going forward and backward
Check failure on line 77 in packages/atomic/src/components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts GitHub Actions / Run Playwright tests for Atomic (8, 24)[chromium] › components/commerce/atomic-commerce-recommendation-list/e2e/atomic-commerce-recommendation-list.e2e.ts:66:3 › with a carousel › should support going forward and backward
|
||
'part', | ||
'indicator active-indicator' | ||
); | ||
|
||
await recommendationList.nextButton.click(); | ||
await expect(recommendationList.indicators.nth(0)).toHaveAttribute( | ||
'part', | ||
'indicator active-indicator' | ||
); | ||
}); | ||
}); | ||
|
||
test('with no recommendations returned by the API, should render placeholders', async ({ | ||
recommendationList, | ||
page, | ||
}) => { | ||
await recommendationList.noRecommendations(); | ||
await recommendationList.load({story: 'default'}); | ||
await page.waitForTimeout(2000); // Wait for atomic components to render | ||
await expect | ||
.poll(async () => await recommendationList.recommendation.count()) | ||
.toBe(0); | ||
await expect | ||
.poll(async () => await recommendationList.placeholder.count()) | ||
.toBe(0); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.stencil.json", | ||
"exclude": [ | ||
"node_modules", | ||
"src/external-builds", | ||
"**/*.stories.tsx", | ||
"**/*.stories.ts", | ||
"**/*.stories.js" | ||
] | ||
|
||
"exclude": ["node_modules", "src/external-builds"] | ||
} |