Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to wait for the aliased request before continuing the test.
Cypress
cy.intercept('GET', '/api/data').as('getData'); cy.visit('/dashboard'); cy.[1]('@getData');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using cy.get or cy.click instead of cy.wait to wait for the request.
Not using the alias string with '@' prefix.
✗ Incorrect
The cy.wait command pauses the test until the aliased request '@getData' completes.
2fill in blank
mediumComplete the code to alias a POST request to '/api/login' for later waiting.
Cypress
cy.intercept('POST', [1]).as('loginRequest');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong URL path for the alias.
Forgetting to put the URL in quotes.
✗ Incorrect
The intercept command aliases the POST request to '/api/login' as 'loginRequest' for waiting.
3fill in blank
hardFix the error in the code to correctly wait for the aliased request.
Cypress
cy.intercept('GET', '/api/items').as('fetchItems'); cy.visit('/items'); cy.wait([1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the alias without '@' prefix.
Not putting the alias in quotes.
Using the alias as a variable instead of a string.
✗ Incorrect
The cy.wait command requires the alias string with '@' prefix and quotes, like '@fetchItems'.
4fill in blank
hardFill both blanks to alias a PUT request and wait for it after clicking a button.
Cypress
cy.intercept({ method: [1], url: '/api/update' }).as('updateRequest');
cy.get('button#save').click();
cy.wait([2]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong HTTP method like POST instead of PUT.
Waiting for the wrong alias string.
✗ Incorrect
The method is 'PUT' and the wait uses the alias string '@updateRequest'.
5fill in blank
hardFill all three blanks to intercept a DELETE request, alias it, and wait after triggering the delete.
Cypress
cy.intercept({ method: [1], url: [2] }).as([3]);
cy.get('button.delete').click();
cy.wait('@deleteRequest'); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong HTTP method like POST or GET.
Using the wrong URL path.
Using an alias name that does not match the wait command.
✗ Incorrect
The method is 'DELETE', the URL is '/api/delete-item', and the alias is 'deleteRequest'.