Cypress - Test Organization and Patterns
Given this Page Object class snippet:
What will happen when the test calls:
class LoginPage {
visit() {
cy.visit('/login')
}
enterUsername(name) {
cy.get('#username').type(name)
}
enterPassword(pass) {
cy.get('#password').type(pass)
}
submit() {
cy.get('button[type=submit]').click()
}
}What will happen when the test calls:
const page = new LoginPage(); page.visit(); page.enterUsername('user1'); page.enterPassword('pass1'); page.submit();