Skip to content

Commit

Permalink
feat(login): add command to fill login form
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Nov 19, 2020
1 parent bdc2757 commit 33d7a6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/cypress-commands/src/commands/fillAndSubmitLoginForm.js
@@ -0,0 +1,12 @@
export const fillAndSubmitLoginForm = () => {
const loginUrl = Cypress.env('dhis2_base_url')
const username = Cypress.env('dhis2_username')
const password = Cypress.env('dhis2_password')

cy.get('#server').type(loginUrl)
cy.get('#j_username').type(username)
cy.get('#j_password').type(password)
cy.get('{loginsubmit}', { prefix: 'dhis2-adapter' }).click()
}

Cypress.Commands.add('fillAndSubmitLoginForm', fillAndSubmitLoginForm)
1 change: 1 addition & 0 deletions packages/cypress-commands/src/index.js
@@ -1,4 +1,5 @@
// will automatically create the commands
import './commands/fillAndSubmitLoginForm'
import './commands/find'
import './commands/get'
import './commands/login'
Expand Down

0 comments on commit 33d7a6d

Please sign in to comment.