summaryrefslogtreecommitdiff
path: root/tests/browser/features/step_definitions
diff options
context:
space:
mode:
Diffstat (limited to 'tests/browser/features/step_definitions')
-rw-r--r--tests/browser/features/step_definitions/create_account_steps.rb18
-rw-r--r--tests/browser/features/step_definitions/create_and_follow_wiki_link_steps.rb28
-rw-r--r--tests/browser/features/step_definitions/edit_page_steps.rb24
-rw-r--r--tests/browser/features/step_definitions/file_steps.rb18
-rw-r--r--tests/browser/features/step_definitions/login_steps.rb65
-rw-r--r--tests/browser/features/step_definitions/main_page_links_steps.rb47
-rw-r--r--tests/browser/features/step_definitions/preferences_appearance_steps.rb85
-rw-r--r--tests/browser/features/step_definitions/preferences_editing_steps.rb54
-rw-r--r--tests/browser/features/step_definitions/preferences_user_profile_steps.rb43
-rw-r--r--tests/browser/features/step_definitions/view_history_steps.rb8
10 files changed, 390 insertions, 0 deletions
diff --git a/tests/browser/features/step_definitions/create_account_steps.rb b/tests/browser/features/step_definitions/create_account_steps.rb
new file mode 100644
index 00000000..7fa29843
--- /dev/null
+++ b/tests/browser/features/step_definitions/create_account_steps.rb
@@ -0,0 +1,18 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+Given(/^I go to Create account page at (.+)$/) do |path|
+ visit(CreateAccountPage, :using_params => {:page_title => path})
+end
+
+Then(/^form has Create account button$/) do
+ on(CreateAccountPage).create_account_element.should exist
+end
diff --git a/tests/browser/features/step_definitions/create_and_follow_wiki_link_steps.rb b/tests/browser/features/step_definitions/create_and_follow_wiki_link_steps.rb
new file mode 100644
index 00000000..ba41f7fb
--- /dev/null
+++ b/tests/browser/features/step_definitions/create_and_follow_wiki_link_steps.rb
@@ -0,0 +1,28 @@
+Given(/^I go to the "(.+)" page with content "(.+)"$/) do |page_title, page_content|
+ @wikitext = page_content
+ on(APIPage).create page_title, page_content
+ step "I am on the #{page_title} page"
+end
+
+Given(/^I am on the (.+) page$/) do |article|
+ article = article.gsub(/ /, '_')
+ visit(ZtargetPage, :using_params => {:article_name => article})
+end
+
+Given(/^I create page "(.*?)" with content "(.*?)"$/) do |page_title, page_content|
+ on(APIPage).create page_title, page_content
+end
+
+
+When(/^I click the Link Target link$/) do
+ on(ZtargetPage).link_target_page_link
+end
+
+Then(/^I should be on the Link Target Test Page$/) do
+ @browser.url.should match /Link_Target_Test_Page/
+end
+
+Then(/^the page content should contain "(.*?)"$/) do |content|
+ on(ZtargetPage).page_content.should match content
+end
+
diff --git a/tests/browser/features/step_definitions/edit_page_steps.rb b/tests/browser/features/step_definitions/edit_page_steps.rb
new file mode 100644
index 00000000..5ab02bec
--- /dev/null
+++ b/tests/browser/features/step_definitions/edit_page_steps.rb
@@ -0,0 +1,24 @@
+When(/^I click Edit$/) do
+ on(MainPage).edit_link
+end
+
+When(/^I click Preview$/) do
+ on(EditPage).preview_button
+end
+
+When(/^I click Show Changes$/) do
+ on(EditPage).show_changes_button
+end
+
+When(/^I edit the page with "(.*?)"$/) do |edit_content|
+ on(EditPage).edit_page_content_element.send_keys(edit_content + @random_string)
+end
+
+When(/^I save the edit$/) do
+ on(EditPage).save_button
+end
+
+Then(/^the edited page content should contain "(.*?)"$/) do |content|
+ on(MainPage).page_content.should match(content + @random_string)
+end
+
diff --git a/tests/browser/features/step_definitions/file_steps.rb b/tests/browser/features/step_definitions/file_steps.rb
new file mode 100644
index 00000000..a2ed1bfc
--- /dev/null
+++ b/tests/browser/features/step_definitions/file_steps.rb
@@ -0,0 +1,18 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+Given(/^I am at file that does not exist$/) do
+ visit(FileDoesNotExistPage, using_params: {page_name: @random_string})
+end
+
+Then(/^page should show that no such file exists$/) do
+ on(FileDoesNotExistPage).file_does_not_exist_message_element.should be_visible
+end
diff --git a/tests/browser/features/step_definitions/login_steps.rb b/tests/browser/features/step_definitions/login_steps.rb
new file mode 100644
index 00000000..b654b2d3
--- /dev/null
+++ b/tests/browser/features/step_definitions/login_steps.rb
@@ -0,0 +1,65 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+Given(/^I am at Log in page$/) do
+ visit LoginPage
+end
+
+When(/^I log in with incorrect password$/) do
+ on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "incorrect password", false)
+end
+
+When(/^I log in with incorrect username$/) do
+ on(LoginPage).login_with("incorrect username", ENV["MEDIAWIKI_PASSWORD"], false)
+end
+
+When(/^I log in without entering credentials$/) do
+ on(LoginPage).login_with("", "", false)
+end
+
+When(/^I log in without entering password$/) do
+ on(LoginPage).login_with(ENV["MEDIAWIKI_USER"], "", false)
+end
+
+Then(/^error box should be visible$/) do
+ on(LoginErrorPage).error_box_element.should be_visible
+end
+
+Then(/^error box should not be visible$/) do
+ on(LoginErrorPage).error_box_element.should_not be_visible
+end
+
+Then(/^feedback should be (.+)$/) do |feedback|
+ on(LoginPage) do |page|
+ page.feedback_element.when_present.click
+ page.feedback.should match Regexp.escape(feedback)
+ end
+end
+
+Then(/^Log in element should be there$/) do
+ on(LoginPage).login_element.should exist
+end
+
+Then(/^main page should open$/) do
+ @browser.url.should == on(MainPage).class.url
+end
+
+Then(/^Password element should be there$/) do
+ on(LoginPage).password_element.should exist
+end
+
+Then(/^there should be a link to (.+)$/) do |text|
+ on(LoginPage).username_displayed_element.when_present.text.should == text
+end
+
+Then(/^Username element should be there$/) do
+ on(LoginPage).username_element.should exist
+end
diff --git a/tests/browser/features/step_definitions/main_page_links_steps.rb b/tests/browser/features/step_definitions/main_page_links_steps.rb
new file mode 100644
index 00000000..c76fd2ba
--- /dev/null
+++ b/tests/browser/features/step_definitions/main_page_links_steps.rb
@@ -0,0 +1,47 @@
+Given(/^I open the main wiki URL$/) do
+ visit(MainPage)
+end
+
+Then(/^I should see a link for View History$/) do
+ on(MainPage).view_history_link_element.should be_visible
+end
+
+Then(/^I should see a link for Edit$/) do
+ on(MainPage).edit_link_element.should be_visible
+end
+
+Then(/^I should see a link for Recent changes$/) do
+ on(MainPage).recent_changes_link_element.should be_visible
+end
+
+Then(/^I should see a link for Random page$/) do
+ on(MainPage).random_page_link_element.should be_visible
+end
+
+Then(/^I should see a link for Help$/) do
+ on(MainPage).help_link_element.should be_visible
+end
+
+Then(/^I should see a link for What links here$/) do
+ on(MainPage).what_links_here_link_element.should be_visible
+end
+
+Then(/^I should see a link for Related changes$/) do
+ on(MainPage).related_changes_link_element.should be_visible
+end
+
+Then(/^I should see a link for Special pages$/) do
+ on(MainPage).special_pages_link_element.should be_visible
+end
+
+Then(/^I should see a link for Printable version$/) do
+ on(MainPage).printable_version_link_element.should be_visible
+end
+
+Then(/^I should see a link for Permanent link$/) do
+ on(MainPage).permanent_link_link_element.should be_visible
+end
+
+Then(/^I should see a link for Page information$/) do
+ on(MainPage).page_information_link_element.should be_visible
+end
diff --git a/tests/browser/features/step_definitions/preferences_appearance_steps.rb b/tests/browser/features/step_definitions/preferences_appearance_steps.rb
new file mode 100644
index 00000000..0046af69
--- /dev/null
+++ b/tests/browser/features/step_definitions/preferences_appearance_steps.rb
@@ -0,0 +1,85 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+When(/^I click Appearance$/) do
+ visit(PreferencesPage).appearance_link_element.when_present.click
+end
+
+When(/^I navigate to Preferences$/) do
+ visit(PreferencesPage)
+end
+
+Then(/^I can click Save$/) do
+ on(PreferencesPage).save_button_element.should exist
+end
+
+Then(/^I can restore default settings$/) do
+ on(PreferencesAppearancePage).restore_default_link_element.should exist
+end
+
+Then(/^I can see local time$/) do
+ on(PreferencesAppearancePage).local_time_span_element.should exist
+end
+
+Then(/^I can see time offset section$/) do
+ on(PreferencesAppearancePage).time_offset_table_element.should be_visible
+end
+
+Then(/^I can select date format$/) do
+ on(PreferencesAppearancePage) do |page|
+ page.no_preference_radio_element.should exist
+ page.mo_day_year_radio_element.should exist
+ page.day_mo_year_radio_element.should exist
+ page.year_mo_day_radio_element.should exist
+ page.iso_8601_radio_element.should exist
+ end
+end
+
+Then(/^I can select image size$/) do
+ on(PreferencesAppearancePage).size_select_element.should exist
+end
+
+Then(/^I can select my time zone$/) do
+ on(PreferencesAppearancePage) do |page|
+ page.time_offset_select_element.should exist
+ page.other_offset_element.should exist
+ end
+end
+
+Then(/^I can select skins$/) do
+ on(PreferencesAppearancePage) do |page|
+ page.cologne_blue_element.should exist
+ page.modern_element.should exist
+ page.monobook_element.should exist
+ page.vector_element.should exist
+ end
+end
+
+Then(/^I can select Threshold for stub link$/) do
+ on(PreferencesAppearancePage).threshold_select_element.should exist
+end
+
+Then(/^I can select thumbnail size$/) do
+ on(PreferencesAppearancePage).thumb_select_element.should exist
+end
+
+Then(/^I can select underline preferences$/) do
+ on(PreferencesAppearancePage).underline_select_element.should exist
+end
+
+Then(/^I have advanced options checkboxes$/) do
+ on(PreferencesAppearancePage) do |page|
+ page.hidden_categories_check_element.should exist
+ page.auto_number_check_element.should exist
+ end
+end
+
+
diff --git a/tests/browser/features/step_definitions/preferences_editing_steps.rb b/tests/browser/features/step_definitions/preferences_editing_steps.rb
new file mode 100644
index 00000000..ad29a745
--- /dev/null
+++ b/tests/browser/features/step_definitions/preferences_editing_steps.rb
@@ -0,0 +1,54 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+When(/^I click Editing$/) do
+ visit(PreferencesPage).editing_link_element.when_present.click
+end
+
+Then(/^I can select edit area font style$/) do
+ on(PreferencesEditingPage).edit_area_font_style_select_element.when_present.should exist
+end
+
+Then(/^I can select live preview$/) do
+ on(PreferencesEditingPage).live_preview_check_element.when_present.should exist
+end
+
+Then(/^I can select section editing by double clicking$/) do
+ on(PreferencesEditingPage).edit_section_double_click_check_element.when_present.should exist
+end
+
+Then(/^I can select section editing by right clicking$/) do
+ on(PreferencesEditingPage).edit_section_right_click_check_element.when_present.should exist
+end
+
+Then(/^I can select section editing via edit links$/) do
+ on(PreferencesEditingPage).edit_section_edit_link_element.when_present.should exist
+end
+
+Then(/^I can select show edit toolbar$/) do
+ on(PreferencesEditingPage).show_edit_toolbar_check_element.when_present.should exist
+end
+
+Then(/^I can select show preview before edit box$/) do
+ on(PreferencesEditingPage).preview_on_top_check_element.when_present.should exist
+end
+
+Then(/^I can select show preview on first edit$/) do
+ on(PreferencesEditingPage).preview_on_first_check_element.when_present.should exist
+end
+
+Then(/^I can select to prompt me when entering a blank edit summary$/) do
+ on(PreferencesEditingPage).forced_edit_summary_check_element.when_present.should exist
+end
+
+Then(/^I can select to warn me when I leave an edit page with unsaved changes$/) do
+ on(PreferencesEditingPage).unsaved_changes_check_element.when_present.should exist
+end
diff --git a/tests/browser/features/step_definitions/preferences_user_profile_steps.rb b/tests/browser/features/step_definitions/preferences_user_profile_steps.rb
new file mode 100644
index 00000000..529af66d
--- /dev/null
+++ b/tests/browser/features/step_definitions/preferences_user_profile_steps.rb
@@ -0,0 +1,43 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+When(/^I click User profile$/) do
+ visit(PreferencesPage).user_profile_link_element.when_present.click
+end
+
+Then(/^I can change my gender$/) do
+ on(PreferencesUserProfilePage) do |page|
+ page.gender_undefined_radio_element.should exist
+ page.gender_male_radio_element.should exist
+ page.gender_female_radio_element.should exist
+ end
+end
+
+Then(/^I can change my language$/) do
+ on(PreferencesUserProfilePage).lang_select_element.should exist
+end
+
+Then(/^I can change my signature$/) do
+ on(PreferencesUserProfilePage).signature_field_element.should exist
+end
+
+Then(/^I can see my Basic informations$/) do
+ on(PreferencesUserProfilePage).basic_info_table_element.should exist
+end
+
+Then(/^I can see my email$/) do
+ on(PreferencesUserProfilePage).email_table_element.should exist
+end
+
+Then(/^I can see my signature$/) do
+ on(PreferencesUserProfilePage).signature_table_element.should exist
+end
+
diff --git a/tests/browser/features/step_definitions/view_history_steps.rb b/tests/browser/features/step_definitions/view_history_steps.rb
new file mode 100644
index 00000000..1ecc0085
--- /dev/null
+++ b/tests/browser/features/step_definitions/view_history_steps.rb
@@ -0,0 +1,8 @@
+When(/^I click View History$/) do
+ on(ViewHistoryPage).view_history_link
+end
+
+Then(/^I should see a link to a previous version of the page$/) do
+ on(ViewHistoryPage).old_version_link_element.should be_visible
+end
+