0
0
Cypresstesting~20 mins

cypress.config.js settings - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cypress Config Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of baseUrl setting in cypress.config.js

What will be the base URL used by Cypress tests if the following cypress.config.js is loaded?

Cypress
module.exports = {
  e2e: {
    baseUrl: 'https://example.com',
    setupNodeEvents(on, config) {
      // no changes
    }
  }
};
Ahttps://localhost
Bhttp://localhost:3000
Cundefined
Dhttps://example.com
Attempts:
2 left
💡 Hint

Look at the baseUrl property inside the e2e object.

assertion
intermediate
2:00remaining
Correct assertion for viewportWidth in cypress.config.js

Given this cypress.config.js snippet, which assertion correctly verifies the viewport width setting?

Cypress
module.exports = {
  e2e: {
    viewportWidth: 1280,
    viewportHeight: 720
  }
};
Aexpect(config.viewportHeight).to.equal(1280);
Bassert(config.viewportWidth === 1280);
Cexpect(config.e2e.viewportWidth).to.equal(1280);
Dassert(config.e2e.viewportHeight === 1280);
Attempts:
2 left
💡 Hint

Check the property path and value for viewport width.

🔧 Debug
advanced
2:30remaining
Identify the error in cypress.config.js

What error will Cypress throw when loading this cypress.config.js?

Cypress
module.exports = {
  e2e: {
    baseUrl: 'https://testsite.com',
    setupNodeEvents(on, config) {
      on('before:browser:launch', (browser = {}, launchOptions) => {
        launchOptions.args.push('--disable-gpu')
      });
    }
  }
};
ASyntaxError: Unexpected end of input
BTypeError: on is not a function
CNo error, config loads successfully
DReferenceError: launchOptions is not defined
Attempts:
2 left
💡 Hint

Check for missing or mismatched brackets and parentheses.

🧠 Conceptual
advanced
1:30remaining
Effect of setting video to false in cypress.config.js

What is the effect of setting video: false in the e2e configuration of cypress.config.js?

ACypress will not record videos of test runs
BCypress will disable screenshots on failure
CCypress will run tests in headless mode only
DCypress will skip all tests marked as @video
Attempts:
2 left
💡 Hint

Think about what the video setting controls in Cypress.

framework
expert
3:00remaining
Correct way to configure retries in cypress.config.js

Which option correctly configures Cypress to retry failed tests 2 times for e2e tests only?

Amodule.exports = { retries: { runMode: 2, openMode: 0 } };
Bmodule.exports = { e2e: { retries: { runMode: 2, openMode: 0 } } };
Cmodule.exports = { e2e: { retries: 2 } };
Dmodule.exports = { retries: 2 };
Attempts:
2 left
💡 Hint

Retries can be configured globally or per testing type. Here, only e2e tests should retry.