You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when running the unit tests in the CI/CD pipeline they do not run in a real DOM environment, hence the web only tests could not prevent the PR merge if they would run and eventually fail. Existing e2e tests have a different purpose and could not be considered a replacement for web-only tests.
Many TODO tests were not implemented yet due to not being able to test the component without a real DOM environment. For example, ImageLoader#load is in TODO mode because it requires constructing an image ( createElementNS( 'img' ) ) before doing anything else.
Another limitation is not being able to load assets from disk during testing.
This prevents loaders from being tested against real assets which can lead to regressions when modifying either existing loader logic or any core (or addon) dependency that the loader relies on.
Solution
Run unit tests in a similar way that e2e test are run.
In unit-tests setup, use existing features that enables e2e tests (puppeteer & express).
Launch a headless browser (for CI/CD pipeline) or a headful browser locally (for convenience) and run the tests in it.
Launch express to support loading assets from disk.
catalin-enache
changed the title
Please allow unit tests to run in browser environment and support loading assets from diskJun 6, 2024
catalin-enache
changed the title
Please allow components be fully tested by running tests in browser environment and support loading assets from diskJun 6, 2024
catalin-enache
changed the title
Please allow full testing on components by running CI/CD tests in browser environment and support loading assets from diskJun 6, 2024
Description
Currently, when running the unit tests in the CI/CD pipeline they do not run in a real DOM environment, hence the
web only
tests could not prevent the PR merge if they would run and eventually fail. Existinge2e
tests have a different purpose and could not be considered a replacement forweb-only
tests.Many TODO tests were not implemented yet due to not being able to test the component without a real DOM environment. For example,
ImageLoader#load
is in TODO mode because it requires constructing an image (createElementNS( 'img' )
) before doing anything else.Another limitation is not being able to load assets from disk during testing.
This prevents
loaders
from being tested againstreal assets
which can lead to regressions when modifying either existing loader logic or any core (or addon) dependency that the loader relies on.Solution
Run unit tests in a similar way that
e2e
test are run.In unit-tests setup, use existing features that enables
e2e
tests (puppeteer
&express
).Launch a headless browser (for CI/CD pipeline) or a headful browser locally (for convenience) and run the tests in it.
Launch express to support loading assets from disk.
I have this PR
#28573
Alternatives
Other libraries could support this as well but we can leverage what we already have (
puppeteer
&express
).Additional context
No response
The text was updated successfully, but these errors were encountered: