Using something like cy.clock() and cy.tick() on UI.Vision

Hi!

I’d like to run a test with UI.Vision on a webpage and I`d like to freeze and advance time of methods like setTimeout.

This is possible to do with Cypress through cy.clock() and cy.tick().
For instance, this guy on YouTube use cy.clock() and cy.tick() to pause a canvas animation every 1500ms and see how it looks like.

(1) Is there a way around to do this without Cypress, using just UI.Vision? Would it be able to do through the command “executeScript” of UI.Vision? How could I do that?

(2) I thought also that maybe I could somehow import the commands of Cypress and use them on UI.Vision. Is that possible? How could I do that?

(3) Maybe I could use this code from Github here. But how do I apply this code on UI.Vision? Can I use the command “executeScript”? For instance, even the Console from Chrome don’t recognize the command describe() when I try to copy the code.

If someone could teach me how to this I`d be very grateful. Thank you!

I think with executeScript you can do whatever you can do with the Chrome command line. So do you know why it fails on the Chrome command line?

1 Like

Hi Ulrich, thank you for the help!

The functions cy.clock() and cy.tick() are not part of JavaScript. I don’t know, but maybe I could use them executing before that this code from Github here

But this code starts with the function describe() and I learned here that the functions of this code are not part of JavaScript as well. They are from Jasmine or Mochajs.

So maybe somehow could I import those commands from Jasmine or Mochajs before everything?