0
0
Cypresstesting~20 mins

Cypress architecture (runs in browser) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cypress Browser Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Where does Cypress test code run?

In Cypress architecture, where does the test code execute?

AOnly on the Node.js server outside the browser
BIn a separate virtual machine isolated from browser and server
CInside the browser alongside the application code
DOn a cloud server managed by Cypress
Attempts:
2 left
💡 Hint

Think about how Cypress interacts with the web page it tests.

Predict Output
intermediate
2:00remaining
Cypress command execution order

What will be the order of console logs when running this Cypress test?

Cypress
describe('Test order', () => {
  it('logs messages', () => {
    cy.log('A')
    console.log('B')
    cy.log('C')
    console.log('D')
  })
})
AA, C, B, D
BB, D, A, C
CA, B, C, D
DB, A, D, C
Attempts:
2 left
💡 Hint

Remember that cy.log commands are asynchronous and queued, while console.log runs immediately.

assertion
advanced
2:00remaining
Correct assertion for element visibility in Cypress

Which assertion correctly checks that a button with id submit-btn is visible?

Acy.get('#submit-btn').should('be.visible')
Bcy.get('#submit-btn').should('exist')
Ccy.get('#submit-btn').should('have.text', 'Submit')
Dcy.get('#submit-btn').should('not.be.hidden')
Attempts:
2 left
💡 Hint

Visibility means the element is shown on the page, not just present in the DOM.

🔧 Debug
advanced
2:00remaining
Why does this Cypress test fail to find element?

Given this test code, why does Cypress fail to find the element?

Cypress
it('fails to find element', () => {
  cy.visit('/page')
  cy.get('.dynamic-item').click()
})
Acy.visit() does not load the page before cy.get() runs
BThe selector '.dynamic-item' is invalid CSS syntax
Ccy.get() only works for elements with IDs, not classes
DThe element is added dynamically after page load, but no explicit wait or retry is used
Attempts:
2 left
💡 Hint

Think about how Cypress waits for elements and when elements appear.

framework
expert
2:00remaining
How does Cypress architecture enable automatic waiting?

Which architectural feature of Cypress allows it to automatically wait for commands and assertions without explicit waits?

ACypress runs inside the browser and controls the event loop to retry commands until success or timeout
BCypress uses a separate server to poll the application state continuously
CCypress injects custom JavaScript timers to delay commands manually
DCypress requires user to add explicit <code>cy.wait()</code> calls for synchronization
Attempts:
2 left
💡 Hint

Think about how Cypress integrates with the browser environment.