Migrating Test Suites From Selenium To Cypress?

In our Slack Ask Me Anything with @marie.drake and Filip Hric, @ziad_tawfeek asked

Have you tried to migrate test suites from a Selenium-based framework to Cypress? How easy it is to do so, any insights also on obstacles faced on that road?

@jainkat responded with

The code organization is pretty different. Selenium test suites are usually organized into the Page-Object Model, and Cypress warns against using that. Conditional waiting and such is very different, too. I think you’d probably be better off just rewriting into Cypress using the Selenium tests as a guide.

Filip’s response was

I’m not 100% convinced Cypress advises against page object model. I think the idea is - use it if it makes sense, or at least that is how I’m reading their docs on this.

Me personally, I use page objects for stuff in my app that is really repetitive. I’m not aiming for 100% DRY (don’t repeat yourself) code, I think tests should be most of all easy to read and to debug.

at the same time, you want to have some kind of abstraction so that an update of an app does not break 50% of your tests on 1000 different places.

and yeah, I learned that the hard way :see_no_evil:

Marie also responded with

100% agree with Jain the two frameworks are different so it would need a different approach. But what you can do as a guide is just to convert 1 test to Cypress and make sure to setup running it on your CI pipeline as early as possible. Then once you are comfortable with using the basics of Cypress, you can look into using Custom Commands or page object model pattern depending on which you prefer.

So how would you do it?