storybookjs / testing-vue3

Testing utilities that allow you to reuse your stories in your unit tests
16 stars 9 forks source link

Components not rendering in Cypress #1

Open olemarius opened 2 years ago

olemarius commented 2 years ago

testing-vue3 doesnt seem to work with cypress (9.0.0). The component simply doesnt render.

import CrashTestDummy from '@/components/CrashTestDummy/CrashTestDummy.vue'; const { Primary, Secondary } = composeStories(stories);

// does not work mount(Primary, componentConfig);

// works, widget renders fine. mount(CrashTestDummy, componentConfig);

CrashTestDummy.vue is just an empty component with some dummy text.

TypeError: Cannot read properties of undefined (reading 'addEventListener')

Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Test if locale works in Cyp...`
    at _loop_1 (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6013:15)
    at VueWrapper2.attachNativeEventListener (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6023:7)
    at new VueWrapper2 (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:5986:11)
    at createWrapper (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6137:10)
    at mount (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6337:17)
    at Context.<anonymous> (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6513:19)
    at getRet (http://localhost:3000/__cypress/runner/cypress_runner.js:172283:20)
From previous event:
    at Context.thenFn (http://localhost:3000/__cypress/runner/cypress_runner.js:172301:63)
    at Context.then (http://localhost:3000/__cypress/runner/cypress_runner.js:172753:21)
    at Context.<anonymous> (http://localhost:3000/__cypress/runner/cypress_runner.js:189216:23)
    at http://localhost:3000/__cypress/runner/cypress_runner.js:187816:17
From previous event:
    at runCommand (http://localhost:3000/__cypress/runner/cypress_runner.js:187795:10)
    at next (http://localhost:3000/__cypress/runner/cypress_runner.js:187936:16)
From previous event:
    at http://localhost:3000/__cypress/runner/cypress_runner.js:202259:79
From previous event:
    at Object.run (http://localhost:3000/__cypress/runner/cypress_runner.js:202254:23)
    at Object.run (http://localhost:3000/__cypress/runner/cypress_runner.js:187991:17)
    at $Cy.cy.<computed> [as then] (http://localhost:3000/__cypress/runner/cypress_runner.js:189256:19)
    at mount2 (http://localhost:3000/__cypress/src/node_modules/.vite/@cypress_vue.js?v=f1d54d89:6491:13)
    at Context.<anonymous> (http://localhost:3000/src/components/CrashTestDummy/CrashTestDummy.spec.ts?import:23:5)
    at Context.runnable.fn (http://localhost:3000/__cypress/runner/cypress_runner.js:189471:23)
    at callFn (http://localhost:3000/__cypress/runner/cypress_runner.js:142125:21)
    at Hook.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://localhost:3000/__cypress/runner/cypress_runner.js:142112:7)
    at http://localhost:3000/__cypress/runner/cypress_runner.js:196060:30
From previous event:
    at Object.onRunnableRun (http://localhost:3000/__cypress/runner/cypress_runner.js:196045:19)
    at $Cypress.action (http://localhost:3000/__cypress/runner/cypress_runner.js:185468:28)
    at Hook.Runnable.run (http://localhost:3000/__cypress/runner/cypress_runner.js:193741:13)
    at next (http://localhost:3000/__cypress/runner/cypress_runner.js:142627:10)
    at http://localhost:3000/__cypress/runner/cypress_runner.js:142671:5
    at timeslice (http://localhost:3000/__cypress/runner/cypress_runner.js:136597:27)
logError @ cypress_runner.js:210452
(anonymous) @ cypress_runner.js:208862
emit @ cypress_runner.js:83077
(anonymous) @ cypress_runner.js:205507
emit @ cypress_runner.js:83077
emit @ cypress_runner.js:205568
onPrint @ cypress_runner.js:204397
_onPrintClick @ cypress_runner.js:204402
(anonymous) @ cypress_runner.js:205739
executeAction @ cypress_runner.js:80835
n @ cypress_runner.js:80835
ca @ cypress_runner.js:91425
ja @ cypress_runner.js:91426
ka @ cypress_runner.js:91426
wa @ cypress_runner.js:91428
Aa @ cypress_runner.js:91429
ya @ cypress_runner.js:91429
Da @ cypress_runner.js:91432
Ad @ cypress_runner.js:91495
Gi @ cypress_runner.js:91661
Kb @ cypress_runner.js:91450
Dd @ cypress_runner.js:91497
(anonymous) @ cypress_runner.js:91662
../../node_modules/scheduler/cjs/scheduler.production.min.js.exports.unstable_runWithPriority @ cypress_runner.js:99528
Ii @ cypress_runner.js:91662
Cd @ cypress_runner.js:91496