Cypress: Cypress on Google Cloud (Cloud Build / Cloud Functions / Cloud Run)

Created on 3 Aug 2019  路  7Comments  路  Source: cypress-io/cypress

I've spent some time investigating running Cypress on Google Cloud Platform -utilising their serverless offerings.

Here are my initial findings:

Cloud Build: Able to run cypress, with the following tips:

  • add ENV CYPRESS_CACHE_FOLDER /cypress-cache in the Dockerfile
  • add the asound.conf fix (https://github.com/cypress-io/cypress-docker-images/issues/52) in the Dockerfile

Cloud Functions / Firebase functions: Unable to run cypress

  • Error: Your system is missing the dependency: Xvfb. I'm unable to add this to Google Cloud functions, or unable to install due to security

Cloud Run: Unable to run cypress

  • Error: Container Sandbox Limitation: Unsupported syscall name_to_handle_at(0xffffff9c,0x150f2ac0ac6a,0x150f23dfedc0,0x150f23dfedb8,0x0,0x150f23e00700). Please, refer to https://gvisor.dev/c/linux/amd64/name_to_handle_at for more information.
  • Error: Container Sandbox Limitation: Unsupported syscall setsockopt(0x39,0x1,0xc,0x3e56b36c1794,0x4,0x3e56b36c1870). Please, refer to https://gvisor.dev/c/linux/amd64/setsockopt for more information.

I'll continue investigating and see if there is a way to get around these security issues.

I've managed to get Puppeteer/Chrome headless working on all of the above. I wonder _if_ using puppeteer/chrome-headless instead of electron or Chrome inside of Cypress, then it might be possible to run on both Cloud Run and/or Google Functions.

Most helpful comment

Absolutely, and just for completeness here is my Google Cloud Build + Cypress example repo https://github.com/bahmutov/google-cloud-build-example

All 7 comments

Yes, @tomardern we have been able to run Cypress in Cloud Build step (just a normal container), but not in smaller serverless environments. First, Cypress image is just too large, and does not support headless Chrome yet. We will need to do a lot of work to get away from using Chrome extension to control the browser automations to using Chrome Debugger Protocol. This will enable headlesss Chrome and we should be able to run in Cloud functions then.

Thanks @bahmutov. I thought id'll raise something so that at least it can easily be found via Google

Absolutely, and just for completeness here is my Google Cloud Build + Cypress example repo https://github.com/bahmutov/google-cloud-build-example

Hi @tomardern , I have one question. I am creating one Cypress test application and want this to schedule by GCP Cloud Scheduler. So I dockerise the application and deploy this in GCP Cloud Run but getting error in Cloud Run. I am very new to Cypress. Can you please guide me what is this error about.

2020-10-29 12:44:33.268 ISTFontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
2020-10-29 12:45:02.086 ISTCould not find a Cypress configuration file, exiting.
2020-10-29 12:45:02.086 IST
2020-10-29 12:45:02.086 ISTWe looked but did not find a cypress.json file in this folder: /

@Debapriya-dev Last year, I was unable to run cypress on Cloud Run with the errors in my initial post :( I've not re-looked at this for a year :(

@tomardern Then can you please suggest me a way out , my purpose is to create a Cypress test application and deploy it in GCP so that I can trigger it by Cloud Scheduler.

@Debapriya-dev Sorry, as frustrating as this may sound, I'm not sure I'm going to be able to help you much with what you are trying to achieve, I don't know your context, nor have access to the repo/codebase your working in.

My suggestion would be to try and run via Cloud Build (not cloud run), then use the Cloud Scheduler to schedule a "build". You could also try and do this via GitHub Actions (as an alternative to CloudBuild) as it may be easier as you can run on a schedule

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brian-mann picture brian-mann  路  3Comments

simonhaenisch picture simonhaenisch  路  3Comments

dkreft picture dkreft  路  3Comments

carloscheddar picture carloscheddar  路  3Comments

rbung picture rbung  路  3Comments