Cypress - Test Organization and Patterns
Given this Page Object class snippet:
What will the following test code do?
class LoginPage {
visit() {
cy.visit('/login')
}
getUsernameInput() {
return cy.get('#username')
}
getPasswordInput() {
return cy.get('#password')
}
submit() {
cy.get('button[type="submit"]').click()
}
}What will the following test code do?
const login = new LoginPage();
login.visit();
login.getUsernameInput().type('user1');
login.getPasswordInput().type('pass1');
login.submit();