0
0
Cypresstesting~10 mins

Skipping and focusing tests (.skip, .only) 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 skip this test in Cypress.

Cypress
it[1]('should not run this test', () => {
  cy.visit('https://example.com')
})
Drag options to blanks, or click blank then click option'
A.skip
B.only
C.ignore
D.focus
Attempts:
3 left
💡 Hint
Common Mistakes
Using .only instead of .skip will run only this test.
Using .focus or .ignore are not valid Cypress test modifiers.
2fill in blank
medium

Complete the code to run only this test in Cypress.

Cypress
it[1]('should run only this test', () => {
  cy.visit('https://example.com')
})
Drag options to blanks, or click blank then click option'
A.skip
B.focus
C.only
D.ignore
Attempts:
3 left
💡 Hint
Common Mistakes
Using .skip will skip this test instead of running only it.
Using .focus or .ignore are not valid Cypress test modifiers.
3fill in blank
hard

Fix the error in this code to skip the whole test suite.

Cypress
describe[1]('My test suite', () => {
  it('test 1', () => {
    cy.visit('https://example.com')
  })
})
Drag options to blanks, or click blank then click option'
A.skip
B.ignore
C.focus
D.only
Attempts:
3 left
💡 Hint
Common Mistakes
Using .only will run only this suite and skip others.
Using .focus or .ignore are not valid Cypress suite modifiers.
4fill in blank
hard

Fill both blanks to run only this test suite and skip others.

Cypress
describe[1]('Focused suite', () => {
  it[2]('test inside focused suite', () => {
    cy.visit('https://example.com')
  })
})
Drag options to blanks, or click blank then click option'
A.only
B.skip
C.focus
D.ignore
Attempts:
3 left
💡 Hint
Common Mistakes
Using .skip on describe will skip the whole suite, not focus it.
Using .only on it will run only that test, not the suite.
5fill in blank
hard

Fill both blanks to skip one test, focus another, and leave the rest normal.

Cypress
describe('Mixed tests', () => {
  it[1]('test to skip', () => {
    cy.visit('https://skip.com')
  })
  it[2]('test to focus', () => {
    cy.visit('https://focus.com')
  })
  it('normal test', () => {
    cy.visit('https://normal.com')
  })
})
Drag options to blanks, or click blank then click option'
A.skip
B.only
D.focus
Attempts:
3 left
💡 Hint
Common Mistakes
Using .focus is not a valid Cypress modifier.
Adding .only to multiple tests runs only those tests, ignoring others.