From 82c520f311364137d29e9949325c8b178d7d2dff Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 14 Dec 2018 04:17:03 +0500 Subject: [PATCH] Add scenario to feature "Password change" --- features/desktop/password_change.feature | 23 ++++++++++++++++++++++- features/step_definitions/user.rb | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/features/desktop/password_change.feature b/features/desktop/password_change.feature index e74e3a0..d4972b3 100644 --- a/features/desktop/password_change.feature +++ b/features/desktop/password_change.feature @@ -1,6 +1,8 @@ Feature: Password change - Scenario: with valid credentials + Background: Given I am signed in with email "user@example.com" and password "password" + + Scenario: with valid credentials When I visit "/users/edit" And I fill form with the following data: | key | value | @@ -19,3 +21,22 @@ Feature: Password change When I try to sign in with email "user@example.com" and password "q1w2e3r4" Then I am signed in as "user@example.com" + + Scenario: with invalid password + When I visit "/users/edit" + And I fill form with the following data: + | key | value | + | Пароль | q1w2e3r4 | + | Подтверждение пароля | q1w2e3r4 | + | Текущий пароль | invalid | + And I click the form button "Обновить" + Then the password is failed to change + + When I try to sign out + Then I am successfully signed out + + When I try to sign in with email "user@example.com" and password "q1w2e3r4" + Then I fail to sign in + + When I try to sign in with email "user@example.com" and password "password" + Then I am signed in as "user@example.com" diff --git a/features/step_definitions/user.rb b/features/step_definitions/user.rb index 394e460..f21fc07 100644 --- a/features/step_definitions/user.rb +++ b/features/step_definitions/user.rb @@ -107,3 +107,10 @@ Then 'the password is successfully changed' do expect(page).to have_css 'div.alert.alert-info', text: 'Ваша учетная запись изменена.' end + +Then 'the password is failed to change' do + expect(page.current_path).to eq '/users' + expect(page).to have_css 'div.alert.alert-danger', + text: 'Пожалуйста, исправьте следующие ошибки:' + expect(page).to have_text 'Текущий пароль имеет неверное значение' +end