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(radio-button): add darkmode screenshot test and refactor folder structure #921

Closed
wants to merge 1 commit 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,29 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Textarea - Basic</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-radio-button
name="rb-example"
value="option1"
radio-id="option-1"
required="false"
checked
>
<div slot="label">Label text 1</div>
</tds-radio-button>

<tds-radio-button name="rb-example" value="option2" radio-id="option-2" required="false">
<div slot="label">Label text 2</div>
</tds-radio-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { expect } from '@playwright/test';
import { test } from 'stencil-playwright';

const componentTestPath = 'src/components/radio-button/test/default/darkmode/index.html';

test.describe.parallel('TdsRadioButton component tests default darkmode', () => {
test.beforeEach(async ({ page }) => {
await page.goto(componentTestPath);
});

test('Radio buttons with Label text = "Label text 1" and "Label text 2" render on the page', async ({
page,
}) => {
const radioButton1 = page.locator('tds-radio-button', { hasText: 'Label text 1' });
const radioButton2 = page.locator('tds-radio-button', { hasText: 'Label text 2' });
await expect(radioButton1).toBeVisible();
await expect(radioButton2).toBeVisible();
await expect(page).toHaveScreenshot({ maxDiffPixelRatio: 0 });
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Textarea - Basic</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>
<tds-radio-button
name="rb-example"
value="option1"
radio-id="option-1"
required="false"
checked
>
<div slot="label">Label text 1</div>
</tds-radio-button>

<tds-radio-button name="rb-example" value="option2" radio-id="option-2" required="false">
<div slot="label">Label text 2</div>
</tds-radio-button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { expect } from '@playwright/test';
import { test } from 'stencil-playwright';

test.describe.parallel('TdsRadioButton component tests', () => {
const componentTestPath = 'src/components/radio-button/test/default/lightmode/index.html';

test.describe.parallel('TdsRadioButton component tests default lightmode', () => {
test.beforeEach(async ({ page }) => {
// Navigate to the index.html page where your component is rendered
// Adjust the path to the index.html as necessary based on your project structure
await page.goto('src/components/radio-button/test/default/index.html');
await page.goto(componentTestPath);
});

test('Radio buttons with Label text = "Label text 1" and "Label text 2" render on the page', async ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { expect } from '@playwright/test';
import { test } from 'stencil-playwright';

const componentTestPath = 'src/components/radio-button/test/disabled/index.html';

test.describe.parallel('Radio button - disabled state', () => {
test.beforeEach(async ({ page }) => {
await page.goto('src/components/radio-button/test/disabled/index.html');
await page.goto(componentTestPath);
});

test('Radio buttons with Label text = "Label text 1" and "Label text 2" renders on the page', async ({
Expand Down
Loading