-
|
I'm having trouble getting my Cypress component tests to pass using the new BApp wrapper component. I'm getting const wrapper = () =>
h('div', { id: 'app', class: 'p-3' }, [
h(BApp, { defaults: appDefaults }, () => [h(component, options.props, options.slots)]),
]);
mount(wrapper, mountOptions);This is working fine for most tests, but not if the component calls useToast/Modal/etc. in their script setup section. I would have thought it would be okay, since I'm passing the children into BApp as a closure, but apparently not. I'm really just looking for any ideas as to how I might get this to work. I thought perhaps I could call |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
It turns out this wasn't related to Cypress or how I was instantiating the component at all. It has to do with how the orchestrator gets injected, and my use of useToast in a composable from within a Pinia store. Previously, this used |
Beta Was this translation helpful? Give feedback.
It turns out this wasn't related to Cypress or how I was instantiating the component at all. It has to do with how the orchestrator gets injected, and my use of useToast in a composable from within a Pinia store. Previously, this used
app.provide, which is available to inject into Pinia stores, but now it's provided on the component level, so in Pinia stores it is undefined. All I had to do was add the orchestratorPlugin, and everything worked fine. (Both in my app and in Cypress.)