-
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.
refactor(elements/ino-option): migrate stencil e2e tests to playwright (
#1333) * migrate tests to playwright * migrate ino-option-group tests to playwright
- Loading branch information
Showing
4 changed files
with
58 additions
and
51 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
packages/elements/src/components/ino-option-group/ino-option-group.e2e.ts
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
packages/elements/src/components/ino-option/ino-option.e2e.ts
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
packages/storybook/src/stories/ino-option-group/ino-option-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,21 @@ | ||
import { expect, Locator, test } from '@playwright/test'; | ||
import { goToStory } from '../test-utils'; | ||
|
||
test.describe('ino-option-group', () => { | ||
let inoOptionGroup: Locator; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await goToStory(page, ['Input', 'ino-option-group', 'default']); | ||
inoOptionGroup = page.locator('ino-option-group'); | ||
}); | ||
|
||
test('should be select an option', async () => { | ||
await expect(inoOptionGroup).toHaveCount(2); | ||
const firstGroup = inoOptionGroup.first(); | ||
const inoOptions = firstGroup.locator('ino-option'); | ||
await expect(inoOptions).toHaveCount(4); | ||
await expect(inoOptions.first()).toHaveText( | ||
await firstGroup.getAttribute('label'), | ||
); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
packages/storybook/src/stories/ino-option/ino-option.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,37 @@ | ||
import { expect, Locator, test } from '@playwright/test'; | ||
import { goToStory, setAttribute } from '../test-utils'; | ||
|
||
test.describe('ino-option', () => { | ||
let inoOption: Locator; | ||
let inoSelect: Locator; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await goToStory(page, ['Input', 'ino-option', 'default']); | ||
inoOption = page.locator('ino-option'); | ||
inoSelect = page.locator('ino-select'); | ||
}); | ||
|
||
test('should be select an option', async () => { | ||
await inoSelect.click(); | ||
await inoOption.click(); | ||
await expect(inoSelect.locator('.mdc-select__selected-text')).toHaveText( | ||
await inoOption.textContent(), | ||
); | ||
}); | ||
|
||
test('should be disabled', async () => { | ||
await setAttribute(inoOption, 'disabled', 'true'); | ||
await inoSelect.click(); | ||
await inoOption.click(); | ||
await expect( | ||
inoSelect.locator('.mdc-select__selected-text'), | ||
).not.toHaveText(await inoOption.textContent()); | ||
}); | ||
|
||
test('should be selected', async ({ page }) => { | ||
await goToStory(page, ['Input', 'ino-option', 'selected-option']); | ||
await expect(inoSelect.locator('.mdc-select__selected-text')).toHaveText( | ||
await inoOption.textContent(), | ||
); | ||
}); | ||
}); |