-
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(table): add screenshot tests using reusable test code (#954)
- Loading branch information
Showing
199 changed files
with
763 additions
and
391 deletions.
There are no files selected for viewing
34 changes: 25 additions & 9 deletions
34
packages/core/src/components/table/table/test/batch/table.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
Binary file added
BIN
+22.9 KB
...hots/tds-table-batch-primary-darkmode-renders-batch-table-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.
Binary file added
BIN
+22.8 KB
...ots/tds-table-batch-primary-lightmode-renders-batch-table-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.
Binary file removed
BIN
-22.7 KB
...able.e2e.ts-snapshots/tds-table-batch-renders-batch-table-correctly-1-linux.png
Binary file not shown.
Binary file added
BIN
+22.9 KB
...ts/tds-table-batch-secondary-darkmode-renders-batch-table-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.
Binary file added
BIN
+22.7 KB
...s/tds-table-batch-secondary-lightmode-renders-batch-table-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.
31 changes: 21 additions & 10 deletions
31
...components/table/table/test/column-filtering/header-input-wrapper/interaction-fill.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 |
---|---|---|
@@ -1,23 +1,34 @@ | ||
import { test } from 'stencil-playwright'; | ||
import { expect } from '@playwright/test'; | ||
import { | ||
testConfigurations, | ||
getTestDescribeText, | ||
setupPage, | ||
} from '../../../../../../utils/testConfiguration'; | ||
|
||
const componentTestPath = | ||
'src/components/table/table/test/column-filtering/header-input-wrapper/index.html'; | ||
const componentName = 'tds-table'; | ||
const testDescription = 'tds-table-column-filtering fill'; | ||
|
||
test.describe.parallel('tds-table-column-filtering fill', () => { | ||
test('expect slotted inputs to persist inputed value', async ({ page }) => { | ||
await page.goto(componentTestPath); | ||
testConfigurations.withModeVariants.forEach((config) => { | ||
test.describe.parallel(getTestDescribeText(config, testDescription), () => { | ||
test.beforeEach(async ({ page }) => { | ||
await setupPage(page, config, componentTestPath, componentName); | ||
}); | ||
|
||
const inputfield = page.getByTestId('firstHeaderInput'); | ||
await inputfield.fill('Hello World!'); | ||
test('expect slotted inputs to persist inputed value', async ({ page }) => { | ||
const inputfield = page.getByTestId('firstHeaderInput'); | ||
await inputfield.fill('Hello World!'); | ||
|
||
await inputfield.blur(); | ||
await inputfield.blur(); | ||
|
||
let value = await inputfield.inputValue(); | ||
let value = await inputfield.inputValue(); | ||
|
||
expect(value).toBe('Hello World!'); | ||
expect(value).toBe('Hello World!'); | ||
|
||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
}); | ||
}); | ||
}); |
Binary file removed
BIN
-19.7 KB
...olumn-filtering-fill-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Binary file not shown.
Binary file added
BIN
+20.1 KB
...ill-primary-darkmode-expect-slotted-inputs-to-persist-inputed-value-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.
Binary file added
BIN
+19.8 KB
...ll-primary-lightmode-expect-slotted-inputs-to-persist-inputed-value-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.
Binary file added
BIN
+20 KB
...l-secondary-darkmode-expect-slotted-inputs-to-persist-inputed-value-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.
Binary file added
BIN
+19.9 KB
...-secondary-lightmode-expect-slotted-inputs-to-persist-inputed-value-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.
36 changes: 25 additions & 11 deletions
36
...omponents/table/table/test/column-filtering/header-input-wrapper/interaction-focus.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 |
---|---|---|
@@ -1,24 +1,38 @@ | ||
import { test } from 'stencil-playwright'; | ||
import { expect } from '@playwright/test'; | ||
import { | ||
testConfigurations, | ||
getTestDescribeText, | ||
setupPage, | ||
} from '../../../../../../utils/testConfiguration'; | ||
|
||
const componentTestPath = | ||
'src/components/table/table/test/column-filtering/header-input-wrapper/index.html'; | ||
const componentName = 'tds-table'; | ||
const testDescription = 'tds-table-column-filtering focus'; | ||
|
||
test.describe.parallel('tds-table-column-filtering focus', () => { | ||
test('expect wrapper to effect slotted inputs style on focus', async ({ page }) => { | ||
await page.goto(componentTestPath); | ||
testConfigurations.withModeVariants.forEach((config) => { | ||
test.describe.parallel(getTestDescribeText(config, testDescription), () => { | ||
test.beforeEach(async ({ page }) => { | ||
await setupPage(page, config, componentTestPath, componentName); | ||
}); | ||
|
||
const inputfield = page.getByTestId('firstHeaderInput'); | ||
test('expect wrapper to effect slotted inputs style on focus', async ({ page }) => { | ||
const inputfield = page.getByTestId('firstHeaderInput'); | ||
|
||
await inputfield.focus(); | ||
await inputfield.focus(); | ||
|
||
const color = await inputfield.evaluate((el) => { | ||
return window.getComputedStyle(el).getPropertyValue('background-color'); | ||
}); | ||
// only check the color if no mode variant or mode is set: | ||
if (!config) { | ||
const color = await inputfield.evaluate((el) => { | ||
return window.getComputedStyle(el).getPropertyValue('background-color'); | ||
}); | ||
|
||
expect(color).toBe('rgb(255, 255, 255)'); // white | ||
expect(color).toBe('rgb(255, 255, 255)'); // white | ||
} | ||
|
||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
}); | ||
}); | ||
}); |
Binary file removed
BIN
-19.8 KB
...tering-focus-expect-wrapper-to-effect-slotted-inputs-style-on-focus-1-linux.png
Binary file not shown.
Binary file added
BIN
+20.1 KB
...s-primary-darkm-ab933-apper-to-effect-slotted-inputs-style-on-focus-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.
Binary file added
BIN
+20 KB
...s-primary-light-43327-apper-to-effect-slotted-inputs-style-on-focus-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.
Binary file added
BIN
+20 KB
...s-secondary-dar-76991-apper-to-effect-slotted-inputs-style-on-focus-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.
Binary file added
BIN
+20 KB
...s-secondary-lig-76aa6-apper-to-effect-slotted-inputs-style-on-focus-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.
39 changes: 27 additions & 12 deletions
39
...omponents/table/table/test/column-filtering/header-input-wrapper/interaction-hover.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
Binary file removed
BIN
-24.4 KB
...tering-hover-expect-wrapper-to-effect-slotted-inputs-style-on-hover-1-linux.png
Binary file not shown.
Binary file added
BIN
+24.7 KB
...r-primary-darkm-1683d-apper-to-effect-slotted-inputs-style-on-hover-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.
Binary file added
BIN
+24.5 KB
...r-primary-light-7b6df-apper-to-effect-slotted-inputs-style-on-hover-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.
Binary file added
BIN
+24.6 KB
...r-secondary-dar-03d45-apper-to-effect-slotted-inputs-style-on-hover-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.
Binary file added
BIN
+24.4 KB
...r-secondary-lig-9096d-apper-to-effect-slotted-inputs-style-on-hover-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.
26 changes: 19 additions & 7 deletions
26
...s/core/src/components/table/table/test/column-filtering/header-input-wrapper/table.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 |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import { test } from 'stencil-playwright'; | ||
import { expect } from '@playwright/test'; | ||
import { | ||
testConfigurations, | ||
getTestDescribeText, | ||
setupPage, | ||
} from '../../../../../../utils/testConfiguration'; | ||
|
||
const componentTestPath = | ||
'src/components/table/table/test/column-filtering/header-input-wrapper/index.html'; | ||
const componentName = 'tds-table'; | ||
const testDescription = 'tds-table-column-filtering'; | ||
|
||
test.describe.parallel('tds-table-column-filtering', () => { | ||
test('renders table with editable header cell correctly', async ({ page }) => { | ||
await page.goto(componentTestPath); | ||
const tableComponent = page.getByRole('table'); | ||
await expect(tableComponent).toHaveCount(1); | ||
testConfigurations.withModeVariants.forEach((config) => { | ||
test.describe.parallel(getTestDescribeText(config, testDescription), () => { | ||
test.beforeEach(async ({ page }) => { | ||
await setupPage(page, config, componentTestPath, componentName); | ||
}); | ||
|
||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
test('renders table with editable header cell correctly', async ({ page }) => { | ||
const tableComponent = page.getByRole('table'); | ||
await expect(tableComponent).toHaveCount(1); | ||
|
||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+20.1 KB
...-primary-darkmode-renders-table-with-editable-header-cell-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.
Binary file added
BIN
+19.9 KB
...primary-lightmode-renders-table-with-editable-header-cell-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.
Binary file removed
BIN
-19.7 KB
...-column-filtering-renders-table-with-editable-header-cell-correctly-1-linux.png
Binary file not shown.
Binary file added
BIN
+20 KB
...econdary-darkmode-renders-table-with-editable-header-cell-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.
Binary file added
BIN
+19.9 KB
...condary-lightmode-renders-table-with-editable-header-cell-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.
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
Binary file added
BIN
+19.8 KB
.../tds-table-default-primary-darkmode-renders-default-table-correctly-1-linux.png
Oops, something went wrong.
Binary file added
BIN
+19.6 KB
...tds-table-default-primary-lightmode-renders-default-table-correctly-1-linux.png
Oops, something went wrong.
Binary file removed
BIN
-19.5 KB
....e2e.ts-snapshots/tds-table-default-renders-default-table-correctly-1-linux.png
Diff not rendered.
Binary file added
BIN
+19.7 KB
...ds-table-default-secondary-darkmode-renders-default-table-correctly-1-linux.png
Oops, something went wrong.
Binary file added
BIN
+19.5 KB
...s-table-default-secondary-lightmode-renders-default-table-correctly-1-linux.png
Oops, something went wrong.
31 changes: 21 additions & 10 deletions
31
...s/core/src/components/table/table/test/editing/body-input-wrapper/interaction-fill.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 |
---|---|---|
@@ -1,22 +1,33 @@ | ||
import { test } from 'stencil-playwright'; | ||
import { expect } from '@playwright/test'; | ||
import { | ||
testConfigurations, | ||
getTestDescribeText, | ||
setupPage, | ||
} from '../../../../../../utils/testConfiguration'; | ||
|
||
const componentTestPath = 'src/components/table/table/test/editing/body-input-wrapper/index.html'; | ||
const componentName = 'tds-table'; | ||
const testDescription = 'tds-table-editable-cells fill'; | ||
|
||
test.describe.parallel('tds-table-editable-cells fill', () => { | ||
test('expect slotted inputs to persist inputed value', async ({ page }) => { | ||
await page.goto(componentTestPath); | ||
testConfigurations.withModeVariants.forEach((config) => { | ||
test.describe.parallel(getTestDescribeText(config, testDescription), () => { | ||
test.beforeEach(async ({ page }) => { | ||
await setupPage(page, config, componentTestPath, componentName); | ||
}); | ||
|
||
const inputfield = page.getByTestId('firstInput'); | ||
await inputfield.fill('Hello World!'); | ||
test('expect slotted inputs to persist inputed value', async ({ page }) => { | ||
const inputfield = page.getByTestId('firstInput'); | ||
await inputfield.fill('Hello World!'); | ||
|
||
await inputfield.blur(); | ||
await inputfield.blur(); | ||
|
||
let value = await inputfield.inputValue(); | ||
let value = await inputfield.inputValue(); | ||
|
||
expect(value).toBe('Hello World!'); | ||
expect(value).toBe('Hello World!'); | ||
|
||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
/* Check diff of screenshot */ | ||
await expect(page).toHaveScreenshot({ maxDiffPixels: 0.01 }); | ||
}); | ||
}); | ||
}); |
Binary file removed
BIN
-19.7 KB
...-editable-cells-fill-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Diff not rendered.
Binary file added
BIN
+20 KB
...ill-primary-darkmode-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Oops, something went wrong.
Binary file added
BIN
+19.8 KB
...ll-primary-lightmode-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Oops, something went wrong.
Binary file added
BIN
+19.9 KB
...l-secondary-darkmode-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Oops, something went wrong.
Binary file added
BIN
+19.8 KB
...-secondary-lightmode-expect-slotted-inputs-to-persist-inputed-value-1-linux.png
Oops, something went wrong.
Oops, something went wrong.