2 # This file is subject to the license terms in the LICENSE file found in the
3 # qa-browsertests top-level directory and at
4 # https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
5 # qa-browsertests, including this file, may be copied, modified, propagated, or
6 # distributed except according to the terms contained in the LICENSE file.
8 # Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
9 # qa-browsertests top-level directory and at
10 # https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
12 Given(/^I am at Log in page$/) do
17 on(LoginPage
).login_with(user
, password
, false)
20 When(/^I log in with incorrect password$/) do
21 on(LoginPage
).login_with(user
, 'incorrect password', false)
24 When(/^I log in with incorrect username$/) do
25 on(LoginPage
).login_with('incorrect username', password
, false)
28 When(/^I log in without entering credentials$/) do
29 on(LoginPage
).login_with('', '', false)
32 When(/^I log in without entering password$/) do
33 on(LoginPage
).login_with(user
, '', false)
36 Then(/^error box should be visible$/) do
37 expect(on(LoginErrorPage
).error_box_element
).to be_visible
40 Then(/^error box should not be visible$/) do
41 expect(on(LoginErrorPage
).error_box_element
).not_to be_visible
44 Then(/^feedback should be (.+)$/) do |feedback
|
45 on(LoginPage
) do |page
|
46 page
.feedback_element
.when_present
.click
47 expect(page
.feedback
).to match Regexp
.escape(feedback
)
51 Then(/^Log in element should be there$/) do
52 expect(on(LoginPage
).login_element
).to exist
55 Then(/^main page should open$/) do
56 expect(@browser.url
).to eq
on(MainPage
).class.url
59 Then(/^Password element should be there$/) do
60 expect(on(LoginPage
).password_element
).to exist
63 Then(/^there should be a link to (.+)$/) do |text
|
64 expect(on(LoginPage
).username_displayed_element
.when_present
.text
).to eq text
67 Then(/^Username element should be there$/) do
68 expect(on(LoginPage
).username_element
).to exist