Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(spinner): add darkmode and lightmode screenshot tests and modify existing tests #924

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Spinner - Standard</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-spinner size="lg" variant="inverted"></tds-spinner>
<tds-spinner size="md" variant="inverted"></tds-spinner>
<tds-spinner size="sm" variant="inverted"></tds-spinner>
<tds-spinner size="xs" variant="inverted"></tds-spinner>
</body>
</html>
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/spinner/test/inverted/index.html';
const componentTestPath = 'src/components/spinner/test/inverted/darkmode/index.html';

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

test('renders inverted spinner correctly', 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,14 +4,14 @@
<meta charset="UTF-8" />
<title>Spinner - Standard</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">
<body style="background-color: var(--tds-grey-50)">
<tds-spinner size="lg" variant="inverted"></tds-spinner>
<tds-spinner size="md" variant="inverted"></tds-spinner>
<tds-spinner size="sm" variant="inverted"></tds-spinner>
Expand Down
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/spinner/test/inverted/lightmode/index.html';

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

test('renders inverted spinner correctly', 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
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Spinner - Standard</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-spinner size="lg" variant="standard"></tds-spinner>
<tds-spinner size="md" variant="standard"></tds-spinner>
<tds-spinner size="sm" variant="standard"></tds-spinner>
<tds-spinner size="xs" variant="standard"></tds-spinner>
</body>
</html>
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/spinner/test/standard/darkmode/index.html';

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

test('renders basic spinner correctly', 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 @@ -4,14 +4,14 @@
<meta charset="UTF-8" />
<title>Spinner - Standard</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>
<body style="background-color: var(--tds-grey-50)">
<tds-spinner size="lg" variant="standard"></tds-spinner>
<tds-spinner size="md" variant="standard"></tds-spinner>
<tds-spinner size="sm" variant="standard"></tds-spinner>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { test } from 'stencil-playwright';
import { expect } from '@playwright/test';

const componentTestPath = 'src/components/spinner/test/standard/index.html';
const componentTestPath = 'src/components/spinner/test/standard/lightmode/index.html';

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

test('renders basic spinner correctly', async ({ page }) => {
/* Check diff on screenshot */
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
});

test('Check if animation is present', async ({ page }) => {
await page.goto(componentTestPath);

const spinner = page.locator('tds-spinner:first-child circle');
const spinnerStyle = await spinner.evaluate((style) => getComputedStyle(style).animationName);
expect(spinnerStyle).toBe('dash');
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading