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

Expose setSystemTime from lolex #15424

Closed
emilgoldsmith opened this issue Mar 11, 2021 · 7 comments · Fixed by #23329
Closed

Expose setSystemTime from lolex #15424

emilgoldsmith opened this issue Mar 11, 2021 · 7 comments · Fixed by #23329
Labels
type: enhancement Requested enhancement of existing feature

Comments

@emilgoldsmith
Copy link
Contributor

What would you like?

I would like to be able to do:

cy.clock().then(clock => clock.setSystemTime(12345));

Why is this needed?

I am testing a timer, and I realized that when I wanted to test it also displays hours correctly, I did cy.tick(46060*1000) and Cypress froze because it was running thousands of setInterval callbacks in a row. setSystemTime allows me to skip forward in time, and I can still use tick for small increment testing.

I'm happy to do the implementing

@emilgoldsmith
Copy link
Contributor Author

P.S: I have a working test right now as I just used the workaround of installing the underlying package myself and manually faking timers, and then using setSystemTime, but would of course be neat to not have to do that

@jennifer-shehane jennifer-shehane added stage: proposal 💡 No work has been done of this issue type: enhancement Requested enhancement of existing feature labels Mar 16, 2021
@emilgoldsmith
Copy link
Contributor Author

emilgoldsmith commented Mar 20, 2021

Hi @jennifer-shehane so I see it was tagged as a proposal, thank you for that! I was just wondering what this means logistically. Is it welcome for me to contribute this change or does it need to go through some kind of discussion first?

@jennifer-shehane
Copy link
Member

@emilgoldsmith I think this would be an accepted change. There seems to be a use case for it. Maybe @chrisbreiding has some thoughts.

@chrisbreiding
Copy link
Contributor

That sounds good to me 👍

@emilgoldsmith
Copy link
Contributor Author

Great :), I’ll try to set aside time for it one weekend then, but anyone else following is definitely welcome to do it too :)

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: contributor pr in progress and removed stage: proposal 💡 No work has been done of this issue stage: needs review The PR code is done & tested, needs review labels Aug 13, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 24, 2022

The code for this is done in cypress-io/cypress#23329, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 30, 2022

Released in 10.7.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.7.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants