Skip to content

Commit

Permalink
migrate stencil e2e tests to playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPag committed Apr 3, 2024
1 parent f300e41 commit 21c2779
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 57 deletions.

This file was deleted.

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');
});
});

0 comments on commit 21c2779

Please sign in to comment.