web
web copied to clipboard
[@web/test-runner-visual-regression] Node is detached from document
I get an Node is detached from document
issue since @web/test-runner
version 17, if I use the @web/test-runner-visual-regression
package in my tests.
I created a repo to reproduce my issue: https://github.com/petergaal91/wtr-snapshot
I defined 2 web components and 2 test files. If I run the card.component.spec file only, it's works perfectly, but if I run more than 2 test files I see this error message:
npm run test
> [email protected] test
> npx wtr --config ./wtr.config.mjs
Error: Node is detached from document
at CDPElementHandle.assertConnectedElement (wtr-snapshot/node_modules/puppeteer-core/lib/cjs/puppeteer/api/ElementHandle.js:590:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async CDPElementHandle.scrollIntoView (wtr-snapshot/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ElementHandle.js:107:9)
at async CDPElementHandle.scrollIntoViewIfNeeded (/wtr-snapshot/node_modules/puppeteer-core/lib/cjs/puppeteer/api/ElementHandle.js:602:9)
at async CDPElementHandle.screenshot (/wtr-snapshot/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ElementHandle.js:406:9)
at async Object.executeCommand (/wtr-snapshot/node_modules/@web/test-runner-visual-regression/dist/visualRegressionPlugin.js:45:45)
at async TestRunnerApiPlugin._onCommand (/wtr-snapshot/node_modules/@web/test-runner-core/dist/server/plugins/api/testRunnerApiPlugin.js:145:32)
src/card/card.component.spec.ts:
❌ <test-card> > should render correctly > ltr
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
at createTimeoutError (node_modules/@web/test-runner-mocha/dist/autorun.js:1:191473)
at ds._timeoutError (node_modules/@web/test-runner-mocha/dist/autorun.js:1:195706)
at node_modules/@web/test-runner-mocha/dist/autorun.js:1:193787
Chrome: |██████████████████████████████| 2/2 test files | 7 passed, 1 failed
Finished running tests in 2.6s with 1 failed tests.
If I downgrade these packages, it's works perfectly:
"@web/test-runner": "0.16.1"
"@web/test-runner-chrome": "0.13.0"
I see puppeteer upgraded in version 17, so I'm not 100% sure it's wtr related or not. I didn't found any puppeteer related issue for this error.
I'm seeing this as well with the @web/test-runner-visual-regression.