0
0
Cypresstesting~10 mins

Docker execution in Cypress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run Cypress tests inside a Docker container.

Cypress
docker run -it -v $PWD:/e2e -w /e2e cypress/included:12.0.0 [1]
Drag options to blanks, or click blank then click option'
Acypress run
Bnpm start
Cnode app.js
Ddocker build
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm start' instead of 'cypress run'.
Trying to build the Docker image inside the container.
2fill in blank
medium

Complete the Docker command to mount the current directory as a volume.

Cypress
docker run -v [1]:/e2e -w /e2e cypress/included:12.0.0 cypress run
Drag options to blanks, or click blank then click option'
A/home/user/project
B$PWD
C/tmp
D/var/www
Attempts:
3 left
💡 Hint
Common Mistakes
Using an absolute path that may not exist on the host.
Using a temporary directory instead of the project directory.
3fill in blank
hard

Fix the error in the Docker command to run Cypress tests with the correct working directory.

Cypress
docker run -v $PWD:/e2e -w [1] cypress/included:12.0.0 cypress run
Drag options to blanks, or click blank then click option'
A/usr/src/app
B/app
C/root
D/e2e
Attempts:
3 left
💡 Hint
Common Mistakes
Using a default directory that does not contain the tests.
Not matching the working directory with the mounted volume.
4fill in blank
hard

Fill both blanks to set environment variables and run Cypress tests in Docker.

Cypress
docker run -e [1]=production -e [2]=true cypress/included:12.0.0 cypress run
Drag options to blanks, or click blank then click option'
ANODE_ENV
BDEBUG
CENV
DTEST_MODE
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or unrelated environment variable names.
Not setting environment variables properly with -e flag.
5fill in blank
hard

Fill all three blanks to create a Docker command that runs Cypress tests with volume, working directory, and environment variable.

Cypress
docker run -v [1]:/e2e -w [2] -e [3]=test cypress/included:12.0.0 cypress run
Drag options to blanks, or click blank then click option'
A$PWD
B/e2e
CNODE_ENV
D/app
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between volume mount and working directory.
Incorrect environment variable name or missing -e flag.