Skip to content

Commit

Permalink
test(button): refactor tests to use beforeEach for page navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
max-umain committed Dec 12, 2024
1 parent 2774c3c commit 63e1e9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/button/test/primary/primary_darkmode/index.html';

test.describe.parallel('tds-button-primary-primary-darkmode', () => {
test('renders primary button correctly', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('renders primary button correctly', async ({ page }) => {
const button = page.getByTestId('tds-button-testid');
await expect(button).toHaveCount(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/button/test/primary/primary_lightmode/index.html';

test.describe.parallel('tds-button-primary-primary-lightmode', () => {
test('renders primary button correctly', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('renders primary button correctly', async ({ page }) => {
const button = page.getByTestId('tds-button-testid');
await expect(button).toHaveCount(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/button/test/primary/primary_darkmode/index.html';

test.describe.parallel('tds-button-primary-secondary-darkmode', () => {
test('renders primary button correctly', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('renders primary button correctly', async ({ page }) => {
const button = page.getByTestId('tds-button-testid');
await expect(button).toHaveCount(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/button/test/primary/primary_lightmode/index.html';

test.describe.parallel('tds-button-primary-secondary-lightmode', () => {
test('renders primary button correctly', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('renders primary button correctly', async ({ page }) => {
const button = page.getByTestId('tds-button-testid');
await expect(button).toHaveCount(1);

Expand Down

0 comments on commit 63e1e9e

Please sign in to comment.