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
16 When(/^I log in with incorrect password$/) do
17 on(LoginPage
).login_with(user
, 'incorrect password', false)
20 When(/^I log in with incorrect username$/) do
21 on(LoginPage
).login_with('incorrect username', password
, false)
24 When(/^I log in without entering credentials$/) do
25 on(LoginPage
).login_with('', '', false)
28 When(/^I log in without entering password$/) do
29 on(LoginPage
).login_with(user
, '', false)
32 Then(/^error box should be visible$/) do
33 expect(on(LoginErrorPage
).error_box_element
).to be_visible
36 Then(/^error box should not be visible$/) do
37 expect(on(LoginErrorPage
).error_box_element
).not_to be_visible
40 Then(/^feedback should be (.+)$/) do |feedback
|
41 on(LoginPage
) do |page
|
42 page
.feedback_element
.when_present
.click
43 expect(page
.feedback
).to match Regexp
.escape(feedback
)
47 Then(/^Log in element should be there$/) do
48 expect(on(LoginPage
).login_element
).to exist
51 Then(/^main page should open$/) do
52 expect(@browser.url
).to eq
on(MainPage
).class.url
55 Then(/^Password element should be there$/) do
56 expect(on(LoginPage
).password_element
).to exist
59 Then(/^there should be a link to (.+)$/) do |text
|
60 expect(on(LoginPage
).username_displayed_element
.when_present
.text
).to eq text
63 Then(/^Username element should be there$/) do
64 expect(on(LoginPage
).username_element
).to exist