tyler36 / ddev-cypress

Cypress E2E testing for use with DDEV
Apache License 2.0
11 stars 8 forks source link

Bump Cypress? #19

Closed cemah-h closed 1 year ago

cemah-h commented 1 year ago

I'm trying to install and it's not working. I thought maybe this was because you are using an old (10.2.0) version of Cypress, so I edited my local docker-compose.cypress.yaml file and changed the version to image: 12.5.1, but that didn't work, either. I'm brand new to Cypress so I don't have a clue how to debug this. Any hints appreciated. The error message is: Command was killed with SIGTRAP (Debugger breakpoint): /root/.cache/Cypress/12.5.1/Cypress/Cypress --no-sandbox --smoke-test --ping=496

tyler36 commented 1 year ago

@cemah-h

Thanks for reporting the issue.

I'm trying to replicate the issue locally but I'm getting an error on the latest version too:

EACCES: permission denied, open '/root/.cache/Cypress/12.5.1/binary_state.json

The cypress image runs as root which I think is my problem, and might be related to yours since the issue in both cases seem to be the with the Cypress cache.

See https://github.com/cypress-io/cypress-docker-images/issues/832

tyler36 commented 1 year ago

OK, I had luck by updating Cypress version to 12.3.0.

It is an older version, let me know if this works for you.

rfay commented 1 year ago

12.3.0 has arm64 images, so if you move to that, it will remove the restriction on running only on amd64 architecture.

cemah-h commented 1 year ago

After switching to 12.3.0, I get The Test Runner unexpectedly exited via a close event with signal SIGTRAP -- after also fixing the issue with the config file having changed names from config.json to cypress.config.js and the config flag having changed from --config to --config-file.

Command issued: ddev cypress-open --config-file cypress.config.js

tyler36 commented 1 year ago

@cemah-h

I spent some time playing with it this morning.

Try adding last 2 lines listed below to the docker-compose.cypress.yaml

    volumes:
      # Mount the project root to Cypress's project point
      - "${DDEV_APPROOT}:/e2e"
      # Mount DDEV to allow commands
      - ".:/mnt/ddev_config"
      # Allow X11 forwarding
      - /tmp/.X11-unix:/tmp/.X11-unix

Without this, I get the event with signal SIGTRAP error.

I wonder how we can make that more OS friendly?

rfay commented 1 year ago

What is /tmp/.X11-unix? That couldn't possibly exist on macOS or Windows... It's dependent on X11?

tyler36 commented 1 year ago

/tmp/.X11-unix forwards the XVFB messages from Cypress out of the Docker container into an X11 server. It is used when running Cypress in interactive mode (ddev cypress-open).

According to this blog, they use it with XQuartz X11 server on Mac. Without a Mac, I'm unable to confirm though.

So that's:

tyler36 commented 1 year ago

This addon works for my needs. There are several hurdles that need to be overcome before considering "official" release.

rfay commented 1 year ago

Ah, so you have to run an X server on macOS... didn't even know that was a thing.

So theoretically the mount point would work on mac if the X11 server was working.

tyler36 commented 1 year ago

I update the notes for X11 to help make it clearer. (b7b84aea5633d3882a870132d604261677b19e50)

cemah-h commented 1 year ago

@tyler36 - I still can't get it to work. The X11 line didn't help.

tyler36 commented 1 year ago

@cemah-h Can you get cypress working from the host?

Install it via npm add cypress in the project on you host machine, not DDEV. This way you can confirm if the hardware, configuration, and support files are OK.

Once you have it working, then you can uninstall cypress. The support files and config can then be used by this DDEV addon.

cemah-h commented 1 year ago

Yes, adding via npm always worked. Was just curious how trivial it might be via DDEV.

laetus007 commented 1 year ago

Hi - I'm running a ddev drupal 9 multisite setup on a M1 Mac. I created a fork of this issue removed the preinstall_actions line, setup a release, and did a ddev get of my fork to test an install. I've followed the instructions to get the xquartz running but in all various scenarios of testing (changing versions, etc) it times out. I am running the tests currently on the host but it is so slow compared to another program.

Any recommendations on how to debug?

running cypress-run and cypress-open, I get the following:

ddev cypress-run --config-file cypress.config.js

Cypress verification timed out.

This command failed with the following output:

/root/.cache/Cypress/12.3.0/Cypress/Cypress --no-sandbox --smoke-test --ping=183

----------

Command timed out after 30000 milliseconds: /root/.cache/Cypress/12.3.0/Cypress/Cypress --no-sandbox --smoke-test --ping=183
Timed out

----------

Platform: linux-arm64 (Debian - 11.4)
Cypress Version: 12.3.0
tyler36 commented 1 year ago

@laetus007

No real ideas. Usually, I don't need to specify the config file because it picks it up in the root of my project.

laetus007 commented 1 year ago

@tyler36 - thank you greatly for this feedback. I've dug much deeper over the weekend. From my vantage point, it looks like this add-on (when removing the preinstall_actions) installs the cypress/included image on a M1 Mac. To the best of my testing cypress is accessible both via docker and ddev commands. However, my server is not accessible from the cypress container. Confirmed after ssh'ing into the container and running a curl against the running ddev test site. Will continue to troubleshoot/debug today and tomorrow.

tyler36 commented 1 year ago

@laetus007 Thanks for the update.

I've remove the ARM64 check from 32731c61928dcb4f7f31990c84566c633aa4c9de

I haven't able to get any version over 12.3.0 working with the Docker image. I've been tracking an issue and there a permissions problems from 12.4.0 (https://github.com/cypress-io/cypress-docker-images/issues/832#issuecomment-1428139677) that is a known problem should you encounter a permissions issues.