-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate stencil e2e tests to playwright
- Loading branch information
Showing
2 changed files
with
36 additions
and
57 deletions.
There are no files selected for viewing
57 changes: 0 additions & 57 deletions
57
packages/elements/src/components/ino-radio-group/ino-radio-group.e2e.ts
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
packages/storybook/src/stories/ino-radio-group/ino-radio-group.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect, Locator, test } from '@playwright/test'; | ||
import { goToStory } from '../test-utils'; | ||
|
||
test.describe('ino-radio-group', () => { | ||
let inoRadioGroup: Locator; | ||
let radios: Locator; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await goToStory(page, ['Input', 'ino-radio-group', 'default']); | ||
inoRadioGroup = page.locator('ino-radio-group'); | ||
radios = inoRadioGroup.getByRole('radio'); | ||
}); | ||
|
||
test('should have grouped three radios', async () => { | ||
await expect(radios).toHaveCount(3); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); | ||
}); | ||
|
||
test('should check radios with arrow keys', async () => { | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); | ||
await inoRadioGroup.press('Tab'); | ||
|
||
await inoRadioGroup.press('ArrowUp'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-1'); | ||
await inoRadioGroup.press('ArrowUp'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-3'); | ||
await inoRadioGroup.press('ArrowDown'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-1'); | ||
await inoRadioGroup.press('ArrowRight'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); | ||
await inoRadioGroup.press('ArrowRight'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-3'); | ||
await inoRadioGroup.press('ArrowLeft'); | ||
await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); | ||
}); | ||
}); |