loading...
Cover image for Can't Wait for Windows: Cypress

Can't Wait for Windows: Cypress

antonfrattaroli profile image Anton Frattaroli ・5 min read

When I first saw Cypress a couple years ago, I watched a demo video from the creator and nearly cried tears of joy. I signed up for early access, but never got accepted. I bothered them in their team chat once. I clicked the Watch button on the github project and waited - with an eye on this particular issue: Windows support?

Some are still waiting on Windows support, but I can't wait any longer. Luckily there is a breadcrumb in the github issue: When someone attempts to run Cypress on Windows the error message is supposed to show: You can use Cypress if you install a Linux VM using something like VirtualBox.

VirtualBox

Never heard of it. My virtual machines have always been VMWare. Googled. Downloaded. Installed.

Pretty straightforward. There's a dropdown to choose my operating system. My last experience with Linux was back in 2009 when Windows Vista was out and everyone hated it and Ubuntu was the Linux messiah. I tried it out at the time, only to remember there's no Visual Studio for Ubuntu and abandoned any further effort to switch. Ubuntu is in the VirtualBox list of OSes, and I selected it.

Ubuntu

... FATAL: Could not read from the boot medium.

You mean I have to install Ubuntu myself? Weak. Why the dropdown? Whatever. Googled. Downloaded. Mounted.

... This kernel requires an x86-64 CPU, but only detects an i686 CPU, unable to boot.

I don't know what you're detecting but it isn't an i686. Googled. Oh I have to create a new VM and choose the 64-bit Ubuntu from the dropdown... There's no 64-bit option. Googled. Oh, I need to change my BIOS settings to enable "Virtualization Technology", fine.

Installed Ubuntu. Alright, now we're talking! What's all this Office software? Is this why the ISO took forever to download? Get rid of that desktop trash real quick. Now time to follow the Cypress installation guide.

I need node installed. Googled. sudo apt-get update

Oh, no, no internet. Googled. I have to change Ubuntu settings to work with the host's Cisco AnyConnect VPN. VBoxManage modifyvm "Cypress.io" --natdnshostresolver1 on Baffles me that it has to be run on the virtual machine and not the physical machine, or in VirtualBox Manager. Again, whatever. Let's go.

Node and NPM

sudo apt-get update
sudo apt-get install nodejs

And although it's not mentioned in the Cypress docs, they use the npm command and I know that's separate - not that I've ever used it, must have learned that by osmosis.

sudo apt-get install npm

Fantastic. Let's get the cypress-cli.

npm install -g cypress-cli

Error. Can't connect. I can browse the internet otherwise... does it work on my physical machine? Oh, no, registry.npmjs.org is blocked by the corporate proxy under the category "internet-communications". First off, that category doesn't make sense, and second, I take offense to npm being blocked. That's like telling hundreds of thousands of people their collective work isn't to be trusted. File a support ticket with NetSec... unblocked.

npm install -g cypress-cli

Nope. That didn't work. Need to install nodejs-legacy.

sudo apt-get install nodejs-legacy
npm install -g cypress-cli

cypress install

Didn't work. Need git.

sudo apt-get install git
cypress install
cypress open

Hooray. I can log in with GitHub? Cool, I have one of those. Installing Cypress docs covered, now on to Writing Your First Test... "Open up your favorite IDE". Ouch, 2009 coming back to punch me in the face. At some point I'll be checking this into source control, so better make sure I have something that supports TFS. Googled. Thank you blog from 2010 for your solution to my 2009 problem.

Eclipse

Googled. Looks like I need Java 8 first. One step forward, two steps back.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Got that. Download Eclipse. Extract. Double click an icon to install - that would be nice if it were Windows but at this point I'm expecting to use the command line.

Team Explorer Everywhere... Googled. I read that there is also a plugin for IntelliJ, and I have read that many people prefer IntelliJ over Eclipse. Too late for that now, I want my automated testing.

Download Source...

Cypress

Add folder... New Cypress project... Copy/paste/gut example test file. Within a half hour I had a test to log in to a site using OAuth:

  describe('Log On Test', function() {
it('Logs On www.mysite.com', function() {
cy.visit('https://www.mysite.com')
cy.get('.landing-login-panel .mdl-card__supporting-text:last a').contains('Log In').click()
if (cy.url('host') === 'login.domain.com') {
cy.get('#domain-id').type('username')
cy.get('#password').type('********')
cy.get('.submit').click()
}
  cy.wait(2000)
  cy.get('.user-nav-menu').click()
  cy.get('[for="UIMenu-99"]').should('be.visible')
  cy.get('[for="UIMenu-99"] a[href="/MyProfile"]').click()
})

})




Satisfaction

Plowing ahead without letting obstacles get in your way. That's a skill I has. It certainly was an odyssey to set this up, but it was a morning well spent.

Maybe once I recreate the regression test suite I'll work on integrating it into the CI workflow. I'm sure QA and devops will love that.

And one day, Windows Support will come to Cypress, and I'll force it upon my co-workers.

Discussion

markdown guide
 

Anton,

We at Cypress loved your blog post.

Congratulations on getting it to work, and props on your persistence. We will certainly look at supporting Windows soon, that is one of our most popular requests github.com/cypress-io/cypress/issu...

We are open sourcing the desktop app soon, and since it is Electron-based it should not take too long for anyone who is very determined to build it for Windows. Maybe you could help us with that πŸ˜‰

 

... and the long wait is over - we have Cypress 1.0.0 out with Windows support (very early beta!) docs.cypress.io/guides/references/...

 

Just in time! I'm prepping an application for Docker deployment and when I installed Docker, it claimed it would break VirtualBox.