-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test(web,web-react,web-twig): Introduce visual tests of all component…
…s #DS-660
- Loading branch information
Showing
48 changed files
with
101 additions
and
51 deletions.
There are no files selected for viewing
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
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
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,73 @@ | ||
import { isTesting as isTestingEnvironment } from '@lmc-eu/spirit-common/constants/environments'; | ||
import { SERVERS, getDevelopmentEndpointUri } from '@lmc-eu/spirit-common/constants/servers'; | ||
import { readdirSync } from 'fs'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
// Tests that are intentionally broken, but will be fixed in the future | ||
const IGNORED_TESTS = [ | ||
'Tooltip', // Should be fixed when DS-1087 and DS-1088 are merged | ||
]; | ||
|
||
const runComponentCompareTests = (testConfig) => { | ||
const { packageDir, componentsDir, srcDir = '', ignoredComponents = [], packageName } = testConfig; | ||
if (packageName) { | ||
const formattedPackageName = packageName | ||
.split('-') | ||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1)) | ||
.join(' '); | ||
|
||
test.describe(`Demo ${formattedPackageName} Components`, () => { | ||
const componentDirs = readdirSync(`${packageDir}${srcDir}${componentsDir}`, { withFileTypes: true }) | ||
.filter((item) => item.isDirectory()) | ||
.filter((item) => !ignoredComponents.includes(item.name)) | ||
.filter((item) => !IGNORED_TESTS.includes(item.name)) | ||
.map((item) => item.name.toLowerCase()); | ||
|
||
for (const component of componentDirs) { | ||
test(`test demo ${formattedPackageName} component ${component}`, async ({ page }) => { | ||
await page.goto( | ||
`${ | ||
isTestingEnvironment() | ||
? SERVERS.TESTING[packageName] | ||
: getDevelopmentEndpointUri(packageName, { isDocker: packageName !== 'web-twig' }) | ||
}${componentsDir}/${component}/${packageName === 'web-twig' ? '?HIDE_TOOLBAR' : ''}`, | ||
); | ||
// wait for fonts to load | ||
await page.evaluate(() => document.fonts.ready); | ||
// wait for transitions to finish | ||
await page.waitForLoadState(); | ||
// disable animations to avoid flaky screenshots | ||
await page.addStyleTag({ content: '*, *::before, *::after { animation-iteration-count: 1 !important }' }); | ||
await expect(page).toHaveScreenshot(`${component}.png`, { | ||
animations: 'disabled', | ||
fullPage: true, | ||
}); | ||
}); | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
const testConfigs = [ | ||
{ | ||
componentsDir: '/src/scss/components', | ||
packageDir: 'packages/web', | ||
packageName: 'web', | ||
}, | ||
{ | ||
componentsDir: '/src/components', | ||
ignoredComponents: ['Field', 'Dialog', 'Icon', 'TextFieldBase', 'VisuallyHidden'], | ||
packageDir: 'packages/web-react', | ||
packageName: 'web-react', | ||
}, | ||
// Disable web-twig tests for now on CI, because we don't have a way to run them in CI yet. | ||
!isTestingEnvironment() && { | ||
componentsDir: '/components', | ||
ignoredComponents: ['Field', 'Icon', 'TextFieldBase', 'VisuallyHidden'], | ||
packageDir: 'packages/web-twig', | ||
packageName: 'web-twig', | ||
srcDir: '/src/Resources', | ||
}, | ||
]; | ||
|
||
testConfigs.forEach(runComponentCompareTests); |
Binary file added
BIN
+69 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/accordion-chromium-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
+128 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/alert-chromium-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
+29.8 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/breadcrumbs-chromium-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
+196 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/button-chromium-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
+171 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/buttonlink-chromium-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
+92.9 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/checkbox-chromium-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
+197 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/collapse-chromium-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
+9.15 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/container-chromium-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
+65.1 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/dropdown-chromium-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
+65.1 KB
...e2e/demo-components-compare.spec.ts-snapshots/dropdownmodern-chromium-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
+103 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/fieldgroup-chromium-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
+314 KB
...s/e2e/demo-components-compare.spec.ts-snapshots/fileuploader-chromium-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
+88.7 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/grid-chromium-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
+209 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/header-chromium-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
+39.4 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/heading-chromium-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
+56.3 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/item-chromium-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.7 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/link-chromium-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
+61.2 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/modal-chromium-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
+89 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/nossr-chromium-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
+80.9 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/offcanvas-chromium-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
+34 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/pagination-chromium-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
+17.1 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/pill-chromium-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
+66.5 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/radio-chromium-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
+276 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/scrollview-chromium-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
+77.6 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/select-chromium-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
+17.5 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/spinner-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+148 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/stack-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.1 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/tabs-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+102 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/tag-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.7 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/text-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+82.7 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/textarea-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+104 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/textfield-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+164 KB
tests/e2e/demo-components-compare.spec.ts-snapshots/tooltip-chromium-linux.png
Oops, something went wrong.
Diff not rendered.
Binary file modified
BIN
+872 Bytes
(100%)
tests/e2e/demo-homepages.spec.ts-snapshots/web-chromium-linux.png
Oops, something went wrong.
Diff not rendered.
Diff not rendered.
Binary file removed
BIN
-96 KB
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-chromium-darwin.png
Diff not rendered.
Binary file modified
BIN
+2.54 KB
(100%)
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-chromium-linux.png
Oops, something went wrong.
Binary file removed
BIN
-142 KB
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-firefox-darwin.png
Diff not rendered.
Binary file removed
BIN
-140 KB
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-firefox-linux.png
Diff not rendered.
Binary file removed
BIN
-127 KB
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-webkit-darwin.png
Diff not rendered.
Binary file removed
BIN
-73.9 KB
tests/e2e/demo-homepages.spec.ts-snapshots/web-react-webkit-linux.png
Diff not rendered.
Diff not rendered.
Diff not rendered.