Bird
0
0

Identify the error in this Cypress test code:

medium📝 Debug Q14 of 15
Cypress - Writing Tests
Identify the error in this Cypress test code:
describe('Login Tests', () => {
  it('checks login button', () => {
    cy.get('#login').should('be.visible')
  })
  it('checks logout button') {
    cy.get('#logout').should('be.visible')
  }
})
AIncorrect selector syntax for <code>cy.get</code>
BUsing <code>describe</code> inside <code>it</code> block
CAssertions placed outside <code>it</code> blocks
DMissing arrow function syntax in second <code>it</code> block
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of it blocks

    The first it block uses arrow function correctly. The second it block is missing the arrow function parentheses and arrow before the block.
  2. Step 2: Confirm other parts are correct

    No describe inside it, assertions are inside it, and selectors are valid CSS selectors.
  3. Final Answer:

    Missing arrow function syntax in second it block -> Option D
  4. Quick Check:

    Arrow function missing = A [OK]
Quick Trick: Check each it has arrow function syntax () => { } [OK]
Common Mistakes:
  • Ignoring missing arrow function syntax
  • Thinking assertions can be outside it
  • Assuming selector syntax error without checking

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes