Skip to content

Commit

Permalink
test(divider): 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 16, 2024
1 parent 10b1438 commit f7dfe22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/divider/test/horizontal/darkmode/index.html';

test.describe.parallel('tds-divider-darkmode', () => {
test('expect to render a divider in darkmode', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('expect to render a divider in darkmode', async ({ page }) => {
/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/divider/test/horizontal/lightmode/index.html';

test.describe.parallel('tds-divider-lightmode', () => {
test('expect to render a divider in lightmode', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('expect to render a divider in lightmode', async ({ page }) => {
/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { expect } from '@playwright/test';
const componentTestPath = 'src/components/divider/test/vertical/index.html';

test.describe.parallel('tds-divider', () => {
test('expect to render a vertical divider', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('expect to render a vertical divider', async ({ page }) => {
// expect height to be greater than width
const divider = page.getByTestId('divider').locator('div.divider').first();
const box = await divider.boundingBox();
Expand Down

0 comments on commit f7dfe22

Please sign in to comment.