From da02ce28bd20cf41082ff938955f9d7d3c2e7800 Mon Sep 17 00:00:00 2001 From: Benjamin Pagelsdorf Date: Wed, 3 Apr 2024 12:32:42 +0200 Subject: [PATCH] improve test --- .../ino-radio-group/ino-radio-group.spec.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/storybook/src/stories/ino-radio-group/ino-radio-group.spec.ts b/packages/storybook/src/stories/ino-radio-group/ino-radio-group.spec.ts index 91411af4e8..ba2a5e8493 100644 --- a/packages/storybook/src/stories/ino-radio-group/ino-radio-group.spec.ts +++ b/packages/storybook/src/stories/ino-radio-group/ino-radio-group.spec.ts @@ -1,22 +1,20 @@ -import { expect, Locator, test } from '@playwright/test'; +import { expect, 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 () => { + test('should have grouped three radios', async ({ page }) => { + const inoRadioGroup = page.locator('ino-radio-group'); + const radios = inoRadioGroup.getByRole('radio'); await expect(radios).toHaveCount(3); await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); }); - test('should check radios with arrow keys', async () => { + test('should check radios with arrow keys', async ({ page }) => { + const inoRadioGroup = page.locator('ino-radio-group'); await expect(inoRadioGroup).toHaveAttribute('value', 'opt-2'); await inoRadioGroup.press('Tab');