IMF says Somalia subsidizing in danger over political decision delays

The International Monetary Fund (IMF) could stop its program in Somalia in 90 days if long-deferred public races experience further deferrals. The program is expected for audit in mid-May. Laura…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Run Cypress with a single Docker command

If you have Cypress end-to-end tests, you can run them using the complete image. For example, if your project structure looks like this:

Then you can execute your Cypress tests using the following shell command:

Nothing to install, just write your spec files using your favorite editor and run them.

The image cypress/included:3.2.0 has the entrypoint set to cypress run, so you don't need to type it when running our Docker image. If you want a different command, you can change the entrypoint and then pass any additional arguments after the image name.

You can also pass environment variables into the container to control Cypress behavior. For example, the boolean config option video controls if the video of the run is recorded. It is true by default, but you can disable it via an environment variable.

If you want to see Cypress in interactive mode, you need to forward the XVFB messages from Cypress out of the Docker container into an X11 server running on the host machine. I have done this on my Mac; other operating systems might require different commands.

Then I grabbed the IP of the host machine and added it to the allowed X11 hosts.

Now you can execute a cypress open command passing DISPLAY and the X11 socket file to the container:

The Docker container starts and you can see the full interactive Cypress Test Runner open. You can watch the test run, interact with the Command Log, open DevTools, etc. Even spec file watching is working — if you edit and save the cypress/integration/spec.js file, the Test Runner picks up the change and reruns the tests.

Debugging tip: if Cypress shows an error Gtk-WARNING **: cannot open display:... make sure X11 server allows connections over the network from the Docker container. Run xhost command in the terminal to see if it has the IP address you have added previous with xhost + $IP.

To support both cypress run and cypress open settings we recommend:

You can start the application, run the headless tests and close the services with command:

To start in the interactive mode we need to pass both filenames to the docker

You should see the Test Runner and be able to run tests

Let’s consider another common situation: running the Test Runner inside a Docker container, while running the website on the host outside the container. First, start the website on the host machine

Now start the Test Runner but instead of localhost use a special Docker domain that points back at the host machine:

Missing Chinese characters when running the Test Runner inside the Docker container

Add a comment

Related posts:

10 Practical Ways To Stop Worrying About Future

10 Practical Ways To Stop Worrying About Future . 10 Practical Ways To Stop Worrying About Future. Ever Worrying about the future ever hurt your productivity? Category: Self-Improvement Worrying…

Can physical therapy lessen the pain of arthritis?

Physical treatment may lessen the discomfort associated with arthritis, lessen the need for painkillers, and perhaps postpone or eliminate the need for surgery. Exercises to increase joint mobility…

Why Pursue a Bachelor of Optometry?

Optometry is a branch of healthcare that deals with eye care and vision. Optometrists are eye care professionals who diagnose and treat eye problems, prescribe corrective lenses, and provide…