Merge "mediawiki.jqueryMsg: Prevent default action for functions as external link"
[lhc/web/wiklou.git] / tests / browser / features / step_definitions / login_steps.rb
1 #
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.
7 #
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
11 #
12 Given(/^I am at Log in page$/) do
13 visit LoginPage
14 end
15
16 When(/^I log in with incorrect password$/) do
17 on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "incorrect password", false)
18 end
19
20 When(/^I log in with incorrect username$/) do
21 on(LoginPage).login_with("incorrect username", ENV["MEDIAWIKI_PASSWORD"], false)
22 end
23
24 When(/^I log in without entering credentials$/) do
25 on(LoginPage).login_with("", "", false)
26 end
27
28 When(/^I log in without entering password$/) do
29 on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "", false)
30 end
31
32 Then(/^error box should be visible$/) do
33 on(LoginErrorPage).error_box_element.should be_visible
34 end
35
36 Then(/^error box should not be visible$/) do
37 on(LoginErrorPage).error_box_element.should_not be_visible
38 end
39
40 Then(/^feedback should be (.+)$/) do |feedback|
41 on(LoginPage) do |page|
42 page.feedback_element.when_present.click
43 page.feedback.should match Regexp.escape(feedback)
44 end
45 end
46
47 Then(/^Log in element should be there$/) do
48 on(LoginPage).login_element.should exist
49 end
50
51 Then(/^main page should open$/) do
52 @browser.url.should == on(MainPage).class.url
53 end
54
55 Then(/^Password element should be there$/) do
56 on(LoginPage).password_element.should exist
57 end
58
59 Then(/^there should be a link to (.+)$/) do |text|
60 on(LoginPage).username_displayed_element.when_present.text.should == text
61 end
62
63 Then(/^Username element should be there$/) do
64 on(LoginPage).username_element.should exist
65 end