Skip to content

Commit

Permalink
test(button): refactor ghost variant tests to use beforeEach for page…
Browse files Browse the repository at this point in the history
… navigation
  • Loading branch information
max-umain committed Dec 12, 2024
1 parent d886813 commit c4fcae6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 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/ghost/primary_darkmode/index.html';

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

test('renders ghost 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/ghost/primary_lightmode/index.html';

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

test('renders ghost 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/ghost/secondary_darkmode/index.html';

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

test('renders ghost 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/ghost/secondary_lightmode/index.html';

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

test('renders ghost 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/ghost/unspecified/index.html';

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

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

Expand All @@ -14,7 +17,6 @@ test.describe.parallel('tds-button-ghost', () => {
});

test('Check so that height is correct to md measurements', async ({ page }) => {
await page.goto(componentTestPath);
const button = page.getByText('Button', { exact: true });
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
expect(buttonHeight).toBe('24px');
Expand Down

0 comments on commit c4fcae6

Please sign in to comment.