Skip to content

Commit c141603

Browse files
authoredOct 17, 2019
Add better instructions on how to run locally in docker [skip-ci] (#5387)
* Add better instructions on how to run locally in docker [skip-ci] * Apply suggestions from code review
1 parent 758ec23 commit c141603

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed
 

‎CONTRIBUTING.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,22 @@ If you're curious how we manage all of these tests in CI check out our [`circle.
380380

381381
#### Docker
382382

383-
Sometimes tests pass locally, but fail on CI. Our CI environment should be dockerized. In order to run the same image locally, there is script [scripts/run-docker-local.sh](scripts/run-docker-local.sh) that assumes that you have pulled the image `cypress/internal:chrome61` (see [circle.yml](circle.yml) for the current image name).
383+
Sometimes tests pass locally, but fail in CI. Our CI environment is dockerized. In order to run the image used in CI locally:
384+
385+
1. [Install Docker](https://docs.docker.com/install/) and get it running on your machine.
386+
2. Run the following command from the root of the project:
387+
388+
```shell
389+
npm run docker
390+
```
391+
392+
There is a script [scripts/run-docker-local.sh](scripts/run-docker-local.sh) that runs the cypress image (see [circle.yml](circle.yml) for the current image name).
384393

385394
The image will start and will map the root of the repository to `/cypress` inside the image. Now you can modify the files using your favorite environment and rerun tests inside the docker environment.
386395

387-
**hint** sometimes building inside the image has problems with `node-sass` library.
396+
##### Troubleshooting
397+
398+
Sometimes building inside the image has problems with `node-sass` library.
388399

389400
```text
390401
Error: Missing binding /cypress/packages/desktop-gui/node_modules/node-sass/vendor/linux-x64-48/binding.node
@@ -407,21 +418,21 @@ npm rebuild node-sass
407418

408419
#### Docker for built binary
409420

410-
You can also use Docker to simulate and debug built binary. In a temp folder (for example from the folder `/tmp/test-folder/`) start a Docker image
421+
You can also use Docker to simulate and debug the built binary. In a temporary folder (for example from the folder `/tmp/test-folder/`) start a Docker image:
411422

412423
```shell
413424
$ docker run -it -w /app -v $PWD:/app cypress/base:8 /bin/bash
414425
```
415426

416-
Point installation at a specific binary and NPM (if needed) and _set local cache folder_ to unzip downloaded binary into a subfolder.
427+
Point the installation at a specific binary and npm (if needed) and _set local cache folder_ to unzip the downloaded binary into a subfolder.
417428

418429
```shell
419430
$ export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/.../cypress.zip
420431
$ export CYPRESS_CACHE_FOLDER=./cypress-cache
421432
$ npm i https://cdn.cypress.io/beta/npm/.../cypress.tgz
422433
```
423434

424-
Note that unzipping Linux binary inside Docker container onto a mapped volume drive is slow. But once this is done you can modify application resource folder in local folder `/tmp/test-folder/node_modules/cypress/cypress-cache/3.3.0/Cypress/resources/app` to debug issues.
435+
Note that unzipping the Linux binary inside a Docker container onto a mapped volume drive is *slow*. But once this is done you can modify the application resource folder in the local folder `/tmp/test-folder/node_modules/cypress/cypress-cache/3.3.0/Cypress/resources/app` to debug issues.
425436

426437
### Packages
427438

4 commit comments

Comments
 (4)

cypress-bot[bot] commented on Oct 17, 2019

@cypress-bot[bot]
Contributor

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/linux-x64/circle-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-167762/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-167750/cypress.tgz

cypress-bot[bot] commented on Oct 17, 2019

@cypress-bot[bot]
Contributor

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-28190934/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-28190934/cypress.zip

cypress-bot[bot] commented on Oct 17, 2019

@cypress-bot[bot]
Contributor

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-28190934/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-28190934/cypress.zip

cypress-bot[bot] commented on Oct 17, 2019

@cypress-bot[bot]
Contributor

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/darwin-x64/circle-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-167777/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-c1416035e9cd0dfc0bd342ea2992cd8b4bc7a888-167776/cypress.tgz
Please sign in to comment.