title: How to expose/access a data store state within a cypress test in an Angular app?
body: <p>I'm trying to create some Cypress tests for an Angular 7 application which uses ngrx-store.  I was hoping to pre-load some data into the store in order to then test the UI.  Unfortunately I am not sure how to directly load the required data into the store, without using a dispatch.</p>
  
  <p>I have managed to expose the store, as described in this example (<a href="https://stackoverflow.com/questions/52068995/how-to-expose-access-a-data-store-like-redux-within-a-cypress-test">How to expose/access a data store like Redux within a cypress test?</a>) however I would like to manipulate the state directly without dispatching an action.  My guess is I somehow need to set a test-specific initial state for the store/state</p>
  
  <p>Here's what I did so far:</p>
  
  <pre><code>    // in app.component
      if (window.Cypress) {
                  // @ts-ignore
                  window.__appStore__ = store$;
              }
  
      // in the test
      cy.window().then(w =&gt; {
              console.log(w.__appStore__);
      }
  </code></pre>
  
  <p>The above  works fine. I get the store, but can only manipulate it through its API.  What I really want is the state of the the store to manipulate it directly.</p>