Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow full testing on components by running CI/CD tests in real DOM environment and support loading assets from disk #28572

Open
catalin-enache opened this issue Jun 6, 2024 · 0 comments

Comments

@catalin-enache
Copy link
Contributor

catalin-enache commented Jun 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. 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.

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

catalin-enache added a commit to catalin-enache/three.js_fork that referenced this issue Jun 6, 2024
@catalin-enache catalin-enache changed the title Please allow unit tests to run in browser environment and support loading assets from disk Jun 6, 2024
@catalin-enache catalin-enache changed the title Please allow components be fully tested by running tests in browser environment and support loading assets from disk Jun 6, 2024
@catalin-enache catalin-enache changed the title Please allow full testing on components by running CI/CD tests in browser environment and support loading assets from disk Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants