Skip to content

Commit

Permalink
Merge branch 'develop' into test/link-screenshot-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ckrook authored Dec 16, 2024
2 parents 29f0648 + 34583ce commit 33e18ee
Show file tree
Hide file tree
Showing 71 changed files with 721 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/button/test/secondary/primary/darkmode/index.html';

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

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

/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Button - Secondary</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body class="tds-mode-dark" style="background-color: var(--tds-grey-958); padding: 20px">
<tds-button
text="Button"
variant="secondary"
mode-variant="primary"
size="md"
data-testid="tds-button-testid"
></tds-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/button/test/secondary/primary/lightmode/index.html';

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

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

/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Button - Secondary</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body style="padding: 20px">
<tds-button
text="Button"
variant="secondary"
mode-variant="primary"
size="md"
data-testid="tds-button-testid"
></tds-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/button/test/secondary/secondary/darkmode/index.html';

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

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

/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Button - Secondary</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body class="tds-mode-dark" style="background-color: var(--tds-grey-900); padding: 20px">
<tds-button
text="Button"
variant="secondary"
mode-variant="secondary"
size="md"
data-testid="tds-button-testid"
></tds-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/button/test/secondary/secondary/lightmode/index.html';

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

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

/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Button - Secondary</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body style="background-color: var(--tds-grey-50); padding: 20px">
<tds-button
text="Button"
variant="secondary"
mode-variant="secondary"
size="md"
data-testid="tds-button-testid"
></tds-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/button/test/secondary/index.html';
const componentTestPath = 'src/components/button/test/secondary/unspecified/index.html';

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

test('renders secondary 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-secondary', () => {
});

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('48px');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/checkbox/test/default/darkmode/index.html';

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

test('renders basic checkbox correctly', async ({ page }) => {
const labelElement = page.locator('tds-checkbox label'); // Target label underneath checkbox

expect(labelElement).toHaveText('Label'); // Check label text
/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Checkbox - Default</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body class="tds-mode-dark" style="background-color: var(--tds-grey-958)">
<tds-checkbox>
<span slot="label">Label</span>
</tds-checkbox>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/checkbox/test/default/index.html';
const componentTestPath = 'src/components/checkbox/test/default/lightmode/index.html';

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

test('renders basic checkbox correctly', async ({ page }) => {
const labelElement = page.locator('tds-checkbox label'); // Target label underneath checkbox

expect(labelElement).toHaveText('Label'); // Check label text
Expand All @@ -14,7 +17,6 @@ test.describe.parallel('tds-checkbox', () => {
});

test('Hover and click on checkbox -> should become checked', async ({ page }) => {
await page.goto(componentTestPath);
const checkbox = page.locator('tds-checkbox');
// Hover over the checkbox
await checkbox.hover();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset="UTF-8" />
<title>Checkbox - Default</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../dist/tegel/tegel.css" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../loader/index.es2017.js';
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>
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/checkbox/test/disabled/index.html';

test.describe('tds-checkbox', () => {
test('Hover over checkbox and label -> cursor should become inactive', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('Hover over checkbox and label -> cursor should become inactive', async ({ page }) => {
// Find the checkbox and label elements
const checkbox = page.locator('tds-checkbox');
const input = page.locator('tds-checkbox input');
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/checkbox/test/indeterminate/index.html';

test.describe('tds-checkbox', () => {
test('Checkbox indeterminate state', async ({ page }) => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('Checkbox indeterminate state', async ({ page }) => {
// Find the checkbox and label elements
const checkbox = page.locator('tds-checkbox');
const labelElement = page.locator('tds-checkbox label'); // Target label underneath checkbox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/divider/test/darkmode/index.html';
const componentTestPath = 'src/components/divider/test/horizontal/darkmode/index.html';

test.describe.parallel('tds-divider', () => {
test('expect to render a divider in darkmode', async ({ page }) => {
test.describe.parallel('tds-divider-darkmode', () => {
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Divider - Horizontal, dark mode</title>
<title>Divider - Horizontal, darkmode</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../dist/tegel/tegel.css" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../loader/index.es2017.js';
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body class="tds-mode-dark" style="padding: 20px; height: 300px;">
<body class="tds-mode-dark" style="background-color: var(--tds-grey-958); padding: 20px">
<tds-divider data-testid="divider"></tds-divider>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/divider/test/horizontal/lightmode/index.html';

test.describe.parallel('tds-divider-lightmode', () => {
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 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Divider - Horizontal</title>
<title>Divider - Horizontal, lightmode</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" href="../../../../../dist/tegel/tegel.css" />
<link rel="stylesheet" href="../../../../../../dist/tegel/tegel.css" />
<script type="module">
import { defineCustomElements } from '../../../../../loader/index.es2017.js';
import { defineCustomElements } from '../../../../../../loader/index.es2017.js';
defineCustomElements();
</script>
</head>

<body style="padding: 20px; width: 300px;">
<body style="padding: 20px">
<tds-divider data-testid="divider"></tds-divider>
</body>
</html>
Loading

0 comments on commit 33e18ee

Please sign in to comment.