0
0
Cypresstesting~20 mins

Cypress CLI execution - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cypress CLI Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Cypress CLI command?
You run the command cypress run --spec cypress/e2e/login.cy.js in your terminal. What will Cypress do?
ARun all tests in the <code>login.cy.js</code> file and output results in the terminal.
BOpen the Cypress Test Runner GUI and allow manual test selection.
CRun all tests in the <code>cypress/e2e</code> folder except <code>login.cy.js</code>.
DRun tests only in the <code>cypress/support</code> folder.
Attempts:
2 left
💡 Hint
The --spec flag specifies which test file to run in headless mode.
assertion
intermediate
2:00remaining
Which assertion verifies Cypress CLI ran tests successfully?
After running cypress run, you want to check if all tests passed by inspecting the exit code. Which assertion is correct in a Node.js script?
Cypress
const { exec } = require('child_process');
exec('cypress run', (error, stdout, stderr) => {
  // Which assertion below correctly checks success?
});
Aassert.strictEqual(error, null);
Bassert.strictEqual(error.code, 1);
Cassert.strictEqual(stderr.length, 0);
Dassert.strictEqual(stdout.includes('failing'), true);
Attempts:
2 left
💡 Hint
A null error means the command exited with code 0 (success).
🔧 Debug
advanced
2:00remaining
Why does cypress run --headless fail with 'No browser found' error?
You run cypress run --headless --browser chrome but get an error: No browser found named chrome. What is the most likely cause?
AYou must specify the full path to the Chrome executable.
BChrome browser is not installed or not detected on the system.
CThe <code>--headless</code> flag is incompatible with Chrome.
DCypress CLI requires <code>--browser chromium</code> instead of <code>chrome</code>.
Attempts:
2 left
💡 Hint
Cypress needs the browser installed to run tests in it.
🧠 Conceptual
advanced
2:00remaining
What does the --record flag do in Cypress CLI?
You run cypress run --record --key abc123. What is the purpose of the --record flag?
AIt records video of the test run locally on your machine.
BIt runs tests in parallel automatically on multiple machines.
CIt enables verbose logging of all test steps in the terminal.
DIt uploads test results to the Cypress Dashboard for detailed reporting.
Attempts:
2 left
💡 Hint
Think about Cypress Dashboard integration.
framework
expert
2:00remaining
In a CI pipeline, which Cypress CLI command best runs tests with video recording and fails the build on test failures?
You want to run Cypress tests in a CI environment. You want to record videos, upload results to Dashboard, and ensure the pipeline fails if any test fails. Which command is best?
Acypress run --record --key $CYPRESS_RECORD_KEY --video --exit
Bcypress run --record --key $CYPRESS_RECORD_KEY --video --fail-fast
Ccypress run --record --key $CYPRESS_RECORD_KEY --video
Dcypress open --record --key $CYPRESS_RECORD_KEY --video
Attempts:
2 left
💡 Hint
Consider default Cypress CLI behavior on test failures.