Files
hammond/ui/tests/e2e/support/commands.js
Akhil Gupta d25c30a7b2 first commit
2021-05-29 15:20:50 +05:30

20 lines
488 B
JavaScript

// Create custom Cypress commands and overwrite existing ones.
// https://on.cypress.io/custom-commands
import { getStore } from './utils'
Cypress.Commands.add(
'logIn',
({ username = 'admin', password = 'password' } = {}) => {
// Manually log the user in
cy.location('pathname').then((pathname) => {
if (pathname === 'blank') {
cy.visit('/')
}
})
getStore().then((store) =>
store.dispatch('auth/logIn', { username, password })
)
}
)