Cmcmahon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142295

Change subject: WIP: Port preferences test from /qa repo
......................................................................

WIP: Port preferences test from /qa repo

This works in any English wiki, including a fresh install.
In order to work in any language wiki, it needs
https://gerrit.wikimedia.org/r/#/c/142292/ to be
merged and released.

Change-Id: I1ba4e2c53a9e1bdb7b832efec4c2c8f6f64d2b86
---
A tests/browser/features/preferences.feature
A tests/browser/features/step_definitions/preferences_appearance_steps.rb
A tests/browser/features/step_definitions/preferences_editing_steps.rb
A tests/browser/features/step_definitions/preferences_user_profile_steps.rb
A tests/browser/features/support/pages/preferences_appearance_page.rb
A tests/browser/features/support/pages/preferences_editing_page.rb
A tests/browser/features/support/pages/preferences_page.rb
A tests/browser/features/support/pages/preferences_user_profile_page.rb
8 files changed, 370 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/142295/1

diff --git a/tests/browser/features/preferences.feature 
b/tests/browser/features/preferences.feature
new file mode 100644
index 0000000..2eb5de8
--- /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 @en.wikipedia.beta.wmflabs.org @firefox @internet_explorer_6 
@internet_explorer_7 @internet_explorer_8 @internet_explorer_9 
@internet_explorer_10 @login @phantomjs @test2.wikipedia.org
+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 server time
+      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/preferences_appearance_steps.rb 
b/tests/browser/features/step_definitions/preferences_appearance_steps.rb
new file mode 100644
index 0000000..d3e275e
--- /dev/null
+++ b/tests/browser/features/step_definitions/preferences_appearance_steps.rb
@@ -0,0 +1,87 @@
+#
+# 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(PreferencesAppearancePage).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
+  @browser.text.should match Regexp.escape("Local time")
+  on(PreferencesAppearancePage).local_time_span_element.should exist
+end
+
+Then(/^I can see server time$/) do
+  @browser.text.should match Regexp.escape("Server time")
+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
+  @browser.text.should match Regexp.escape("Time zone")
+  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 0000000..ad29a74
--- /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 0000000..529af66
--- /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/support/pages/preferences_appearance_page.rb 
b/tests/browser/features/support/pages/preferences_appearance_page.rb
new file mode 100644
index 0000000..c01aab4
--- /dev/null
+++ b/tests/browser/features/support/pages/preferences_appearance_page.rb
@@ -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
+#
+class PreferencesAppearancePage
+  include PageObject
+
+  include URL
+  page_url URL.url("Special:Preferences#mw-prefsection-rendering")
+
+  checkbox(:auto_number_check, id: "mw-input-wpnumberheadings")
+  checkbox(:collapse_sidebar_vector_check, id: 
"mw-input-wpvector-collapsiblenav")
+  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, text:/Restore all default settings/)
+  button(:save_button, text: "Save")
+  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")
+  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 0000000..aed9c41
--- /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 0000000..b581ca4
--- /dev/null
+++ b/tests/browser/features/support/pages/preferences_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 PreferencesPage
+  include PageObject
+
+  include URL
+  page_url URL.url("Special:Preferences")
+
+  a(:appearance_link, text: "Appearance")
+  a(:date_and_time_link, text: "Date and time")
+  a(:editing_link, text: "Editing")
+  a(:gadgets_link, text: "Gadgets")
+  a(:misc_link, text: "Misc")
+  a(:pending_changes_link, text: "Pending changes")
+  a(:recent_changes_link, text: "Recent changes")
+  a(:search_link, text: "Search")
+  a(:user_profile_link, text: "User profile")
+  a(:watchlist_link, text: "Watchlist")
+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 0000000..28e10b9
--- /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

-- 
To view, visit https://gerrit.wikimedia.org/r/142295
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ba4e2c53a9e1bdb7b832efec4c2c8f6f64d2b86
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to