Complete the code to visit the login page in Cypress.
cy.[1]('/login')
click instead of visit to open a page.The visit command loads a page URL in Cypress, which is needed to start login.
Complete the code to fill the username input field.
cy.get('input[name="username"]').[1]('myUser')
click or select instead of type.The type command enters text into input fields in Cypress.
Fix the error in the code to submit the login form.
cy.get('form').[1]()
click on the form instead of submit.The submit() command triggers form submission in Cypress.
Fill both blanks to create a custom command for login that speeds up tests.
Cypress.Commands.[1]('login', (username, password) => { cy.request('POST', '/api/login', { username: username, [2]: password }) })
send or post instead of add for command creation.Cypress.Commands.add defines a new command. The password key must be correct to send credentials.
Fill all three blanks to use the custom login command and speed up the test suite.
describe('Dashboard tests', () => { beforeEach(() => { cy.[1]('login', 'user1', [2]) cy.[3]('/dashboard') }) it('shows welcome message', () => { cy.contains('Welcome').should('be.visible') }) })
click instead of visit to load the page.Use the custom login command with username and password, then visit the dashboard page.
