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 => {
loginCredentials = {
...loginCredentials,
...table.hashes()[0]
}
cy.factory().create('User', {
...loginCredentials
})
loginCredentials = table.hashes()[0]
cy.debug()
cy.factory().create('User', loginCredentials)
})
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 => {
cy.login({
...loginCredentials,
...{password}
})
cy.get('.iziToast-wrapper').should('contain', "Incorrect email or password")
cy.reload()
const { email } = loginCredentials
cy.visit(`/login`)
cy.get('input[name=email]')
.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 => {
cy.reload()
cy.login({
...loginCredentials,
...{password}

View File

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