-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(button): add secondary variant darkmode and lightmode screenshot…
… tests (#900) * test(button): move existing secondary test to unspecified * test(button): add primary and secondary mode variant tests for secondary variant * test(button): refactor secondary variant tests to use beforeEach for page navigation * test(button): add padding for new secondary variant tests * test(button): fix imports of css variables for secondary variant * test(button): improve structure for secondary variant
- Loading branch information
Showing
15 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
packages/core/src/components/button/test/secondary/primary/darkmode/button.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
}); | ||
}); |
Binary file added
BIN
+5.32 KB
...utton-secondary-primary-darkmode-renders-secondary-button-correctly-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
packages/core/src/components/button/test/secondary/primary/darkmode/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
packages/core/src/components/button/test/secondary/primary/lightmode/button.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
}); | ||
}); |
Binary file added
BIN
+5.18 KB
...tton-secondary-primary-lightmode-renders-secondary-button-correctly-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
packages/core/src/components/button/test/secondary/primary/lightmode/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
packages/core/src/components/button/test/secondary/secondary/darkmode/button.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
}); | ||
}); |
Binary file added
BIN
+5.34 KB
...ton-secondary-secondary-darkmode-renders-secondary-button-correctly-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
packages/core/src/components/button/test/secondary/secondary/darkmode/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
packages/core/src/components/button/test/secondary/secondary/lightmode/button.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
}); | ||
}); |
Binary file added
BIN
+5.27 KB
...on-secondary-secondary-lightmode-renders-secondary-button-correctly-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
packages/core/src/components/button/test/secondary/secondary/lightmode/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.