first commit
This commit is contained in:
19
ui/tests/e2e/support/commands.js
Normal file
19
ui/tests/e2e/support/commands.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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 })
|
||||
)
|
||||
}
|
||||
)
|
||||
17
ui/tests/e2e/support/setup.js
Normal file
17
ui/tests/e2e/support/setup.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
2
ui/tests/e2e/support/utils.js
Normal file
2
ui/tests/e2e/support/utils.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// Returns the Vuex store.
|
||||
export const getStore = () => cy.window().its('__app__.$store')
|
||||
Reference in New Issue
Block a user