Fix cypress test, green 🥒

This commit is contained in:
Robert Schäfer 2019-03-23 02:04:17 +01:00
parent 22367417de
commit 16c58b77ba
2 changed files with 25 additions and 20 deletions

View File

@ -246,13 +246,9 @@ Then(
) )
Given('my user account has the following login credentials:', table => { Given('my user account has the following login credentials:', table => {
loginCredentials = { loginCredentials = table.hashes()[0]
...loginCredentials, cy.debug()
...table.hashes()[0] cy.factory().create('User', loginCredentials)
}
cy.factory().create('User', {
...loginCredentials
})
}) })
When('I fill the password form with:', table => { When('I fill the password form with:', table => {
@ -270,14 +266,23 @@ When('submit the form', () => {
}) })
Then('I cannot login anymore with password {string}', password => { Then('I cannot login anymore with password {string}', password => {
cy.login({ cy.reload()
...loginCredentials, const { email } = loginCredentials
...{password} cy.visit(`/login`)
}) cy.get('input[name=email]')
cy.get('.iziToast-wrapper').should('contain', "Incorrect email or password") .trigger('focus')
.type(email)
cy.get('input[name=password]')
.trigger('focus')
.type(password)
cy.get('button[name=submit]')
.as('submitButton')
.click()
cy.get('.iziToast-wrapper').should('contain', 'Incorrect email address or password.')
}) })
Then('I can login successfully with password {string}', password => { Then('I can login successfully with password {string}', password => {
cy.reload()
cy.login({ cy.login({
...loginCredentials, ...loginCredentials,
...{password} ...{password}

View File

@ -10,22 +10,22 @@ Feature: Change password
Background: Background:
Given my user account has the following login credentials: Given my user account has the following login credentials:
| email | passsword | | email | password |
| user@example.org | 1234 | | user@example.org | exposed |
And I am logged in And I am logged in
Scenario: Change my password Scenario: Change my password
Given I am on the "settings" page Given I am on the "settings" page
And I click on "Security" And I click on "Security"
When I fill the password form with: When I fill the password form with:
| Your old password | 1234 | | Your old password | exposed |
| Your new passsword | 12345 | | Your new passsword | secure |
| Confirm new password | 12345 | | Confirm new password | secure |
And submit the form And submit the form
And I see a success message: And I see a success message:
""" """
Password updated successfully Password successfully changed!
""" """
And I log out through the menu in the top right corner And I log out through the menu in the top right corner
Then I cannot login anymore with password "1234" Then I cannot login anymore with password "exposed"
But I can login successfully with password "12345" But I can login successfully with password "secure"