1 Given(/^I am at Log in page$/) do
6 on(LoginPage).login_with(user, password, false)
9 When(/^I log in with incorrect password$/) do
10 on(LoginPage).login_with(user, 'incorrect password', false)
13 When(/^I log in with incorrect username$/) do
14 on(LoginPage).login_with('incorrect username', password, false)
17 When(/^I log in without entering credentials$/) do
18 on(LoginPage).login_with('', '', false)
21 When(/^I log in without entering password$/) do
22 on(LoginPage).login_with(user, '', false)
25 Then(/^error box should be visible$/) do
26 expect(on(LoginPage).error_message_element).to exist
29 Then(/^error box should not be visible$/) do
30 expect(on(LoginPage).error_message_element).not_to exist
33 Then(/^feedback should be (.+)$/) do |feedback|
34 on(LoginPage) do |page|
35 page.feedback_element.when_present.click
36 expect(page.feedback).to match Regexp.escape(feedback)
40 Then(/^Log in element should be there$/) do
41 expect(on(LoginPage).login_element).to exist
44 Then(/^main page should open$/) do
45 expect(@browser.url).to eq on(MainPage).class.url
48 Then(/^Password element should be there$/) do
49 expect(on(LoginPage).password_element).to exist
52 Then(/^there should be a link to (.+)$/) do |text|
53 expect(on(LoginPage).username_displayed_element.when_present.text).to eq text
56 Then(/^Username element should be there$/) do
57 expect(on(LoginPage).username_element).to exist