Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a test group using a describe block.
Cypress
describe('[1]', () => { it('checks true is true', () => { expect(true).to.equal(true) }) })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a keyword like 'describe' instead of a descriptive string.
Leaving the name empty or using invalid syntax.
✗ Incorrect
The describe block takes a string as the first argument to name the test group. 'My Test Group' is a clear descriptive name.
2fill in blank
mediumComplete the code to nest a describe block inside another for better grouping.
Cypress
describe('Outer Group', () => { [1]('Inner Group', () => { it('runs a test', () => { expect(1).to.equal(1) }) }) })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'it' or 'test' inside describe for grouping instead of for individual tests.
Using 'context' which is not standard in Cypress.
✗ Incorrect
You nest describe blocks by calling describe inside another describe to group tests hierarchically.
3fill in blank
hardFix the error in the describe block syntax to correctly group tests.
Cypress
describe('Group Name' [1] { it('does something', () => { expect(true).to.be.true }) })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using just a comma or brace without a function.
Omitting the arrow function syntax.
✗ Incorrect
The describe block requires a callback function after the name string, written as () => { ... }.
4fill in blank
hardFill both blanks to create a describe block with a nested it test inside.
Cypress
describe('[1]', () => { it('[2]', () => { expect(2 + 2).to.equal(4) }) })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping group and test names.
Using vague or unclear names.
✗ Incorrect
The describe block name should describe the group, e.g., 'Math Tests'. The it block name describes the test, e.g., 'adds numbers correctly'.
5fill in blank
hardFill all three blanks to create nested describe blocks with a test inside the inner group.
Cypress
describe('[1]', () => { describe('[2]', () => { it('[3]', () => { expect('hello').to.have.length(5) }) }) })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of group and test names.
Using unrelated names that confuse the test purpose.
✗ Incorrect
The outer describe groups string tests, the inner describe groups length checks, and the it block describes the specific test.