Skip to content

Commit

Permalink
Test(web,web-react,web-twig): Visually test only components that have…
Browse files Browse the repository at this point in the history
… their page #DS-1185

Check if index.html or *.stories.twig exist.
Remove manually controlled list.
  • Loading branch information
crishpeen committed Mar 4, 2024
1 parent 6eedb11 commit ed4df63
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/e2e/demo-components-compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const IGNORED_TESTS = [
];

const runComponentCompareTests = (testConfig) => {
const { packageDir, componentsDir, srcDir = '', ignoredComponents = [], packageName } = testConfig;
const { packageDir, componentsDir, srcDir = '', packageName } = testConfig;
if (packageName) {
const formattedPackageName = packageName
.split('-')
Expand All @@ -19,7 +19,11 @@ const runComponentCompareTests = (testConfig) => {
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) =>
readdirSync(`${packageDir}${srcDir}${componentsDir}/${item.name}`).includes(
packageName !== 'web-twig' ? 'index.html' : `${item.name}.stories.twig`,
),
)
.filter((item) => !IGNORED_TESTS.includes(item.name))
.map((item) => item.name.toLowerCase());

Expand Down Expand Up @@ -56,14 +60,12 @@ const testConfigs = [
},
{
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',
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.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ed4df63

Please sign in to comment.