Code Monkey home page Code Monkey logo

Comments (3)

DanWahlin avatar DanWahlin commented on September 1, 2024 1

Excellent! Glad you got it working. Thanks for sharing your insights.

from observable-store.

DanWahlin avatar DanWahlin commented on September 1, 2024

Hi Jason. It's challenging to say what the issue may be here without being able to run any type of sample and see everything. But, here are my initial thoughts.

Has the store you're trying to access to trigger the event been initialized in the application at that point of the overall flow (when you call setStatusJobUpdate() from Cypress code)? I'm wondering, if a component or service where the store is being injected hasn't been called yet so that store isn't yet initialized and available. The store won't be initialized until it's injected (not sure if you're using Angular or another option) of course. When you call setup() it sounds like that is triggering it to be initialized. The fact that you're seeing 13 when calling allStoreServices in the app versus 0 in Cypress makes me wonder about the life cycle timing and if the stores haven't yet been initialized when you run the Cypress code.

As far as accessing it through the window object, it's not put into the global scope so currently doesn't support that type of access.

Normally for these types of scenarios I'll try to create a minimum viable sample to narrow down the issue. Makes it a lot easier to debug versus trying to run the entire app. But, I realize for more complex apps that can be challenging to do.

from observable-store.

JasonLandbridge avatar JasonLandbridge commented on September 1, 2024

Hi thanks for the answer and I figured it out!

So Cypress works with IFrames which indeed separates what you run in a test, from what is actually running on the app. And my initial question went at it from the wrong way, during an E2E test in Cypress I'm not supposed to mess with the internal state, I should only mimic/mock the input from what a user can do.

What happens is, Websocket message comes in (SignalR) => Observable store gets updated => Triggers change on the page. I figured I could skip the first step and mock the trigger inside the Observable store. But that was a bad idea for the above reasons, so I developed the Cypress-SignalR-Mock plugin to do this.

Leaving it here for others so my pain is not in vain :D

from observable-store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.