Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: passing subject from previous chained command to waitUntil #40

Closed
peetjvv opened this issue Sep 3, 2019 · 7 comments
Closed

Comments

@peetjvv
Copy link

peetjvv commented Sep 3, 2019

It would be nice if I can pass the subject from the previous command in the chain of cypress commands into my checkfunction without having to use .then like this:

cy.getStore().then(store =>
  cy.waitUntil(
    () => {
      const things = store.getState().things;
      console.log(things, !!Object.keys(things).length);
      return !!Object.keys(things).length;
    }
  )
);

It would be ideal if I can do something like this:

cy.getStore().waitUntil(store => !!Object.keys(store.getState().things).length));
@NoriSte
Copy link
Owner

NoriSte commented Sep 4, 2019

Thank you @peetjvv for the suggestion! Definitely we must add it! I'm pretty busy at the moment so I won't add it in the next days, would you like to submit a PR with that?
Thank you
Stefano

@peetjvv
Copy link
Author

peetjvv commented Sep 4, 2019

I was planning on giving it a go and submitting a PR myself, but I'm also quite busy atm unfortunately

@NoriSte
Copy link
Owner

NoriSte commented Sep 4, 2019

@peetjvv I've just implemented and released it (1.4.0), let me know if it works for you and if you need something more 😉

@peetjvv
Copy link
Author

peetjvv commented Sep 4, 2019

@NoriSte v1.4.0 is working perfectly. It even works with my ideal solution that I wanted to use originally:

cy.getStore().waitUntil(store => !!Object.keys(store.getState().things).length));

Thanks for your help, speedy updates and nice new tests!

@NoriSte
Copy link
Owner

NoriSte commented Sep 4, 2019

You're welcome ❤️

@peetjvv
Copy link
Author

peetjvv commented Sep 5, 2019

unfortunately the chaining only seems works for me with cypress open and not cypress run. If I have a sec I'll investigate further and let you know.

@NoriSte
Copy link
Owner

NoriSte commented Sep 5, 2019

Ok, let me know if we can do something for you (or how you solved it). I have just read the Travis log and there is nothing wrong about cypress run with the pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants