From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- tests/browser/features/create_account.feature | 12 +++ .../features/create_and_follow_wiki_link.feature | 9 +++ tests/browser/features/edit_page.feature | 11 +++ tests/browser/features/file.feature | 23 ++++++ tests/browser/features/login.feature | 42 +++++++++++ tests/browser/features/main_page_links.feature | 19 +++++ tests/browser/features/preferences.feature | 60 +++++++++++++++ .../step_definitions/create_account_steps.rb | 18 +++++ .../create_and_follow_wiki_link_steps.rb | 28 +++++++ .../features/step_definitions/edit_page_steps.rb | 24 ++++++ .../features/step_definitions/file_steps.rb | 18 +++++ .../features/step_definitions/login_steps.rb | 65 +++++++++++++++++ .../step_definitions/main_page_links_steps.rb | 47 ++++++++++++ .../preferences_appearance_steps.rb | 85 ++++++++++++++++++++++ .../step_definitions/preferences_editing_steps.rb | 54 ++++++++++++++ .../preferences_user_profile_steps.rb | 43 +++++++++++ .../step_definitions/view_history_steps.rb | 8 ++ tests/browser/features/support/env.rb | 2 + tests/browser/features/support/hooks.rb | 2 + .../browser/features/support/modules/url_module.rb | 10 +++ .../features/support/pages/create_account_page.rb | 19 +++++ tests/browser/features/support/pages/edit_page.rb | 8 ++ .../support/pages/file_does_not_exist_page.rb | 19 +++++ .../features/support/pages/login_error_page.rb | 5 ++ tests/browser/features/support/pages/main_page.rb | 19 +++++ .../support/pages/preferences_appearance_page.rb | 41 +++++++++++ .../support/pages/preferences_editing_page.rb | 28 +++++++ .../features/support/pages/preferences_page.rb | 22 ++++++ .../support/pages/preferences_user_profile_page.rb | 28 +++++++ .../features/support/pages/view_history_page.rb | 7 ++ .../browser/features/support/pages/ztargetpage.rb | 7 ++ tests/browser/features/view_history.feature | 11 +++ 32 files changed, 794 insertions(+) create mode 100644 tests/browser/features/create_account.feature create mode 100644 tests/browser/features/create_and_follow_wiki_link.feature create mode 100644 tests/browser/features/edit_page.feature create mode 100644 tests/browser/features/file.feature create mode 100644 tests/browser/features/login.feature create mode 100644 tests/browser/features/main_page_links.feature create mode 100644 tests/browser/features/preferences.feature create mode 100644 tests/browser/features/step_definitions/create_account_steps.rb create mode 100644 tests/browser/features/step_definitions/create_and_follow_wiki_link_steps.rb create mode 100644 tests/browser/features/step_definitions/edit_page_steps.rb create mode 100644 tests/browser/features/step_definitions/file_steps.rb create mode 100644 tests/browser/features/step_definitions/login_steps.rb create mode 100644 tests/browser/features/step_definitions/main_page_links_steps.rb create mode 100644 tests/browser/features/step_definitions/preferences_appearance_steps.rb create mode 100644 tests/browser/features/step_definitions/preferences_editing_steps.rb create mode 100644 tests/browser/features/step_definitions/preferences_user_profile_steps.rb create mode 100644 tests/browser/features/step_definitions/view_history_steps.rb create mode 100644 tests/browser/features/support/env.rb create mode 100644 tests/browser/features/support/hooks.rb create mode 100644 tests/browser/features/support/modules/url_module.rb create mode 100644 tests/browser/features/support/pages/create_account_page.rb create mode 100644 tests/browser/features/support/pages/edit_page.rb create mode 100644 tests/browser/features/support/pages/file_does_not_exist_page.rb create mode 100644 tests/browser/features/support/pages/login_error_page.rb create mode 100644 tests/browser/features/support/pages/main_page.rb create mode 100644 tests/browser/features/support/pages/preferences_appearance_page.rb create mode 100644 tests/browser/features/support/pages/preferences_editing_page.rb create mode 100644 tests/browser/features/support/pages/preferences_page.rb create mode 100644 tests/browser/features/support/pages/preferences_user_profile_page.rb create mode 100644 tests/browser/features/support/pages/view_history_page.rb create mode 100644 tests/browser/features/support/pages/ztargetpage.rb create mode 100644 tests/browser/features/view_history.feature (limited to 'tests/browser/features') diff --git a/tests/browser/features/create_account.feature b/tests/browser/features/create_account.feature new file mode 100644 index 00000000..0b4e83a5 --- /dev/null +++ b/tests/browser/features/create_account.feature @@ -0,0 +1,12 @@ +@chrome @clean @firefox @phantomjs +Feature: Create account + + Scenario Outline: Go to Create account page + Given I go to Create account page at + Then form has Create account button + + Examples: + | path | + | Special:CreateAccount | + | Special:UserLogin/signup | + | Special:UserLogin?type=signup | diff --git a/tests/browser/features/create_and_follow_wiki_link.feature b/tests/browser/features/create_and_follow_wiki_link.feature new file mode 100644 index 00000000..a0aa624e --- /dev/null +++ b/tests/browser/features/create_and_follow_wiki_link.feature @@ -0,0 +1,9 @@ +@chrome @clean @firefox @login @phantomjs +Feature: Create Page With Wiki Link + + Scenario: Create Page With Wiki Link + Given I create page "Link Target Test Page" with content "Link Target Test Page" + And I go to the "Link Source Test Page" page with content "This is a [[Link Target Test Page|link to the test target page]] right here." + When I click the Link Target link + Then I should be on the Link Target Test Page + And the page content should contain "Link Target Test Page" diff --git a/tests/browser/features/edit_page.feature b/tests/browser/features/edit_page.feature new file mode 100644 index 00000000..b905795e --- /dev/null +++ b/tests/browser/features/edit_page.feature @@ -0,0 +1,11 @@ +@chrome @clean @firefox @login @phantomjs +Feature: Edit Page + + Scenario: Create and edit page + Given I go to the "Editing Test Page" page with content "This is a page to test editing" + When I click Edit + And I edit the page with "Edited and a random string" + And I click Preview + And I click Show Changes + And I save the edit + Then the edited page content should contain "Edited and a random string" diff --git a/tests/browser/features/file.feature b/tests/browser/features/file.feature new file mode 100644 index 00000000..0bd36ed6 --- /dev/null +++ b/tests/browser/features/file.feature @@ -0,0 +1,23 @@ +# +# 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 +# +@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs +Feature: File + + Scenario: Anonymous goes to file that does not exist + Given I am at file that does not exist + Then page should show that no such file exists + + @login + Scenario: Logged-in user goes to file that does not exist + Given I am logged in + And I am at file that does not exist + Then page should show that no such file exists diff --git a/tests/browser/features/login.feature b/tests/browser/features/login.feature new file mode 100644 index 00000000..c34d23d3 --- /dev/null +++ b/tests/browser/features/login.feature @@ -0,0 +1,42 @@ +# +# 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 +# +@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs +Feature: Log in + + Background: + Given I am at Log in page + + Scenario: Go to Log in page + Then Username element should be there + And Password element should be there + And Log in element should be there + + Scenario: Log in without entering credentials + When I log in without entering credentials + Then error box should be visible + + Scenario: Log in without entering password + When I log in without entering password + Then error box should be visible + + Scenario: Log in with incorrect username + When I log in with incorrect username + Then error box should be visible + + Scenario: Log in with incorrect password + When I log in with incorrect password + Then error box should be visible + + @login + Scenario: Log in with valid credentials + When I am logged in + Then error box should not be visible diff --git a/tests/browser/features/main_page_links.feature b/tests/browser/features/main_page_links.feature new file mode 100644 index 00000000..3613c828 --- /dev/null +++ b/tests/browser/features/main_page_links.feature @@ -0,0 +1,19 @@ +@chrome @clean @firefox @phantomjs +Feature: Main Page View History Links + + Background: + Given I open the main wiki URL + + Scenario: Main Page View History links exist + Then I should see a link for View History + + Scenario: Main Page Sidebar Links + Then I should see a link for Recent changes + And I should see a link for Random page + And I should see a link for Help + And I should see a link for What links here + And I should see a link for Related changes + And I should see a link for Special pages + And I should see a link for Printable version + And I should see a link for Permanent link + And I should see a link for Page information diff --git a/tests/browser/features/preferences.feature b/tests/browser/features/preferences.feature new file mode 100644 index 00000000..9e3abfde --- /dev/null +++ b/tests/browser/features/preferences.feature @@ -0,0 +1,60 @@ +# +# 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 +# +@chrome @clean @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @login @phantomjs +Feature: Preferences + + Scenario: Preferences Appearance + Given I am logged in + When I navigate to Preferences + And I click Appearance + Then I can select skins + And I can select image size + And I can select thumbnail size + And I can select Threshold for stub link + And I can select underline preferences + And I have advanced options checkboxes + And I can click Save + And I can restore default settings + And I can select date format + And I can see time offset section + And I can see local time + And I can select my time zone + + + Scenario: Preferences Editing + Given I am logged in + When I navigate to Preferences + And I click Editing + Then I can select edit area font style + And I can select section editing via edit links + And I can select section editing by right clicking + And I can select section editing by double clicking + And I can select to prompt me when entering a blank edit summary + And I can select to warn me when I leave an edit page with unsaved changes + And I can select show edit toolbar + And I can select show preview on first edit + And I can select show preview before edit box + And I can select live preview + + + Scenario: Preferences User profile + Given I am logged in + When I navigate to Preferences + And I click User profile + Then I can see my Basic informations + And I can change my language + And I can change my gender + And I can see my signature + And I can change my signature + And I can see my email + And I can click Save + And I can restore default settings 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 + diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb new file mode 100644 index 00000000..7c122366 --- /dev/null +++ b/tests/browser/features/support/env.rb @@ -0,0 +1,2 @@ +require "mediawiki_api" +require "mediawiki_selenium" diff --git a/tests/browser/features/support/hooks.rb b/tests/browser/features/support/hooks.rb new file mode 100644 index 00000000..85309f39 --- /dev/null +++ b/tests/browser/features/support/hooks.rb @@ -0,0 +1,2 @@ +# Needed for cucumber --dry-run -f stepdefs +require 'page-object' diff --git a/tests/browser/features/support/modules/url_module.rb b/tests/browser/features/support/modules/url_module.rb new file mode 100644 index 00000000..6c329e87 --- /dev/null +++ b/tests/browser/features/support/modules/url_module.rb @@ -0,0 +1,10 @@ +module URL + def self.url(name) + if ENV["MEDIAWIKI_URL"] + mediawiki_url = ENV["MEDIAWIKI_URL"] + else + mediawiki_url = "http://127.0.0.1:80/w/index.php" + end + "#{mediawiki_url}#{name}" + end +end diff --git a/tests/browser/features/support/pages/create_account_page.rb b/tests/browser/features/support/pages/create_account_page.rb new file mode 100644 index 00000000..380bccbc --- /dev/null +++ b/tests/browser/features/support/pages/create_account_page.rb @@ -0,0 +1,19 @@ +# +# 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 +# +class CreateAccountPage + include PageObject + + include URL + page_url URL.url("<%=params[:page_title]%>") + + button(:create_account, id: "wpCreateaccount") +end diff --git a/tests/browser/features/support/pages/edit_page.rb b/tests/browser/features/support/pages/edit_page.rb new file mode 100644 index 00000000..b619c342 --- /dev/null +++ b/tests/browser/features/support/pages/edit_page.rb @@ -0,0 +1,8 @@ +class EditPage + include PageObject + + text_area(:edit_page_content, id: "wpTextbox1") + button(:preview_button, id: "wpPreview") + button(:show_changes_button, id: "wpDiff") + button(:save_button, id: "wpSave") +end \ No newline at end of file diff --git a/tests/browser/features/support/pages/file_does_not_exist_page.rb b/tests/browser/features/support/pages/file_does_not_exist_page.rb new file mode 100644 index 00000000..c8491f3b --- /dev/null +++ b/tests/browser/features/support/pages/file_does_not_exist_page.rb @@ -0,0 +1,19 @@ +# +# 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 +# +class FileDoesNotExistPage + include PageObject + + include URL + page_url URL.url("File:<%=params[:page_name]%>") + + div(:file_does_not_exist_message, id: "mw-imagepage-nofile") +end diff --git a/tests/browser/features/support/pages/login_error_page.rb b/tests/browser/features/support/pages/login_error_page.rb new file mode 100644 index 00000000..4fc9ca7f --- /dev/null +++ b/tests/browser/features/support/pages/login_error_page.rb @@ -0,0 +1,5 @@ +class LoginErrorPage + include PageObject + + div(:error_box, class: "errorbox") +end \ No newline at end of file diff --git a/tests/browser/features/support/pages/main_page.rb b/tests/browser/features/support/pages/main_page.rb new file mode 100644 index 00000000..7d96c2b2 --- /dev/null +++ b/tests/browser/features/support/pages/main_page.rb @@ -0,0 +1,19 @@ +class MainPage + include PageObject + + include URL + page_url URL.url("") + + a(:edit_link, href: /action=edit/) + li(:help_link, id: "n-help") + div(:page_content, id: "content") + li(:page_information_link, id: "t-info") + li(:permanent_link_link, id: "t-permalink") + a(:printable_version_link, href: /printable=yes/) + li(:random_page_link, id: "n-randompage") + li(:recent_changes_link, id: "n-recentchanges") + li(:related_changes_link, id: "t-recentchangeslinked") + li(:special_pages_link, id: "t-specialpages") + a(:view_history_link, href: /action=history/) + li(:what_links_here_link, id: "t-whatlinkshere") +end \ No newline at end of file diff --git a/tests/browser/features/support/pages/preferences_appearance_page.rb b/tests/browser/features/support/pages/preferences_appearance_page.rb new file mode 100644 index 00000000..c24e3862 --- /dev/null +++ b/tests/browser/features/support/pages/preferences_appearance_page.rb @@ -0,0 +1,41 @@ +# +# 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 +# +class PreferencesAppearancePage + include PageObject + + include URL + page_url URL.url("Special:Preferences#mw-prefsection-rendering") + + checkbox(:auto_number_check, id: "mw-input-wpnumberheadings") + radio_button(:cologne_blue, id: "mw-input-wpskin-cologneblue") + radio_button(:day_mo_year_radio, id: "mw-input-wpdate-dmy") + checkbox(:dont_show_aft_check, id: "mw-input-wparticlefeedback-disable") + checkbox(:exclude_from_experiments_check, id: "mw-input-wpvector-noexperiments") + checkbox(:hidden_categories_check, id: "mw-input-wpshowhiddencats") + radio_button(:iso_8601_radio, id: "mw-input-wpdate-ISO_8601") + span(:local_time_span, id: "wpLocalTime") + radio_button(:mo_day_year_radio, id: "mw-input-wpdate-mdy") + radio_button(:modern, id: "mw-input-wpskin-modern") + radio_button(:monobook, id: "mw-input-wpskin-monobook") + radio_button(:no_preference_radio, id: "mw-input-wpdate-default") + text_field(:other_offset, id: "mw-input-wptimecorrection-other") + a(:restore_default_link, href: /reset/) + select_list(:size_select, id: "mw-input-wpimagesize") + select_list(:threshold_select, id: "mw-input-wpstubthreshold") + select_list(:time_offset_select, id: "mw-input-wptimecorrection") + table(:time_offset_table, id: "mw-htmlform-timeoffset") + select_list(:thumb_select, id: "mw-input-wpthumbsize") + select_list(:underline_select, id: "mw-input-wpunderline") + radio_button(:vector, id: "mw-input-wpskin-vector") + radio_button(:year_mo_day_radio, id: "mw-input-wpdate-ymd") +end + diff --git a/tests/browser/features/support/pages/preferences_editing_page.rb b/tests/browser/features/support/pages/preferences_editing_page.rb new file mode 100644 index 00000000..aed9c41d --- /dev/null +++ b/tests/browser/features/support/pages/preferences_editing_page.rb @@ -0,0 +1,28 @@ +# +# 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 +# +class PreferencesEditingPage + include PageObject + + include URL + page_url URL.url("Special:Preferences#mw-prefsection-rendering") + + select_list(:edit_area_font_style_select, id: "mw-input-wpeditfont") + checkbox(:edit_section_double_click_check, id: "mw-input-wpeditondblclick") + checkbox(:edit_section_edit_link, id: "mw-input-wpeditsectiononrightclick") + checkbox(:edit_section_right_click_check, id: "mw-input-wpeditsectiononrightclick") + checkbox(:forced_edit_summary_check, id: "mw-input-wpforceeditsummary") + checkbox(:live_preview_check, id: "mw-input-wpuselivepreview") + checkbox(:preview_on_first_check, id: "mw-input-wppreviewonfirst") + checkbox(:preview_on_top_check, id: "mw-input-wppreviewontop") + checkbox(:show_edit_toolbar_check, id: "mw-input-wpshowtoolbar") + checkbox(:unsaved_changes_check, id: "mw-input-wpuseeditwarning") +end diff --git a/tests/browser/features/support/pages/preferences_page.rb b/tests/browser/features/support/pages/preferences_page.rb new file mode 100644 index 00000000..919ba27f --- /dev/null +++ b/tests/browser/features/support/pages/preferences_page.rb @@ -0,0 +1,22 @@ +# +# 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 +# +class PreferencesPage + include PageObject + + include URL + page_url URL.url("Special:Preferences") + + a(:appearance_link, id: "preftab-rendering") + a(:editing_link, id: "preftab-editing") + a(:user_profile_link, id: "preftab-personal") + button(:save_button, id: "prefcontrol") +end diff --git a/tests/browser/features/support/pages/preferences_user_profile_page.rb b/tests/browser/features/support/pages/preferences_user_profile_page.rb new file mode 100644 index 00000000..28e10b97 --- /dev/null +++ b/tests/browser/features/support/pages/preferences_user_profile_page.rb @@ -0,0 +1,28 @@ +# +# 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 +# +class PreferencesUserProfilePage + include PageObject + + include URL + page_url URL.url("Special:Preferences#mw-prefsection-personal") + + table(:basic_info_table, id: "mw-htmlform-info") + link(:change_password_link, text: "Change password") + table(:email_table, id: "mw-htmlform-email") + radio_button(:gender_female_radio, id: "mw-input-wpgender-male") + radio_button(:gender_male_radio, id: "mw-input-wpgender-female") + radio_button(:gender_undefined_radio, id: "mw-input-wpgender-unknown") + select_list(:lang_select, id: "mw-input-wplanguage") + checkbox(:remember_password_check, id: "mw-input-wprememberpassword") + text_field(:signature_field, id: "mw-input-wpnickname") + table(:signature_table, id: "mw-htmlform-signature") +end diff --git a/tests/browser/features/support/pages/view_history_page.rb b/tests/browser/features/support/pages/view_history_page.rb new file mode 100644 index 00000000..66895986 --- /dev/null +++ b/tests/browser/features/support/pages/view_history_page.rb @@ -0,0 +1,7 @@ +class ViewHistoryPage + include PageObject + + a(:view_history_link, href: /action=history/) + a(:old_version_link, href: /oldid=/) + +end \ No newline at end of file diff --git a/tests/browser/features/support/pages/ztargetpage.rb b/tests/browser/features/support/pages/ztargetpage.rb new file mode 100644 index 00000000..c1f46eca --- /dev/null +++ b/tests/browser/features/support/pages/ztargetpage.rb @@ -0,0 +1,7 @@ +class ZtargetPage < MainPage + include URL + page_url URL.url("<%=params[:article_name]%>") + include PageObject + + a(:link_target_page_link, text: "link to the test target page") +end \ No newline at end of file diff --git a/tests/browser/features/view_history.feature b/tests/browser/features/view_history.feature new file mode 100644 index 00000000..ba61ebda --- /dev/null +++ b/tests/browser/features/view_history.feature @@ -0,0 +1,11 @@ +@chrome @clean @firefox @phantomjs +Feature: View History + + Scenario: Edit page and view history + Given I go to the "History Test Page" page with content "This is a page that will have history" + When I click Edit + And I edit the page with "Edited and a random string" + And I save the edit + And the edited page content should contain "Edited and a random string" + And I click View History + Then I should see a link to a previous version of the page -- cgit v1.2.2