Cmcmahon has uploaded a new change for review.

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


Change subject: add test for Preferences/Date and time, consolidate Preferences 
tests in preferences_readonly.feature, use new target tags
......................................................................

add test for Preferences/Date and time, consolidate Preferences tests in 
preferences_readonly.feature, use new target tags

Change-Id: Idf3db3b3ac756bcf3e0802b30474c4deacdecd51
---
R features/preferences_readonly.feature
A features/step_definitions/preferences_datetime_steps.rb
A features/support/pages/date_time_page.rb
3 files changed, 61 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/qa/browsertests 
refs/changes/92/61592/1

diff --git a/features/preferences_appearance_readonly.feature 
b/features/preferences_readonly.feature
similarity index 66%
rename from features/preferences_appearance_readonly.feature
rename to features/preferences_readonly.feature
index f33a9ed..058d9c6 100644
--- a/features/preferences_appearance_readonly.feature
+++ b/features/preferences_readonly.feature
@@ -1,5 +1,4 @@
-# Feature files that end with "_readonly.feature" should be read only, so they 
could be run at en.wikipedia.org
-@en.wikipedia.beta.wmflabs.org @en.wikipedia.org @login
+@login @en.wikipedia.beta.wmflabs.org @en.wikipedia.org @test2.wikipedia.org
 Feature: Preferences
 
   Background:
@@ -19,3 +18,11 @@
         And I have Math options radio buttons
         And I can click Save
         And I can restore default settings
+        
+    Scenario: Date and time
+      When I click Date and time
+        Then I can select date format
+          And I can see server time
+          And I can see local time
+          And I can select my time zone
+          
diff --git a/features/step_definitions/preferences_datetime_steps.rb 
b/features/step_definitions/preferences_datetime_steps.rb
new file mode 100644
index 0000000..0c0cd7a
--- /dev/null
+++ b/features/step_definitions/preferences_datetime_steps.rb
@@ -0,0 +1,30 @@
+When(/^I click Date and time$/) do
+  on(PreferencesPage).date_and_time_link
+end
+
+Then(/^I can select date format$/) do
+  on(DateTimePage) 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 see server time$/) do
+  @browser.text.should match Regexp.escape('Server time')
+end
+
+Then(/^I can see local time$/) do
+  @browser.text.should match Regexp.escape('Local time')
+  on(DateTimePage).local_time_span_element.should exist
+end
+
+Then(/^I can select my time zone$/) do
+  @browser.text.should match Regexp.escape('Time zone')
+    on(DateTimePage) do |page|
+      page.time_offset_select_element.should exist
+      page.other_offset_element.should exist
+  end
+end
diff --git a/features/support/pages/date_time_page.rb 
b/features/support/pages/date_time_page.rb
new file mode 100644
index 0000000..b773145
--- /dev/null
+++ b/features/support/pages/date_time_page.rb
@@ -0,0 +1,22 @@
+class DateTimePage
+  include PageObject
+
+  def self.url
+    if ENV['MEDIAWIKI_URL']
+      mediawiki_url = ENV['MEDIAWIKI_URL']
+    else
+      mediawiki_url = 'http://en.wikipedia.beta.wmflabs.org/wiki/'
+    end
+    "#{mediawiki_url}Special:Preferences#mw-prefsection-rendering"
+  end
+  page_url url
+  
+  radio_button(:day_mo_year_radio, id: 'mw-input-wpdate-dmy')
+  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(:no_preference_radio, id: 'mw-input-wpdate-default')
+  text_field(:other_offset, id: 'mw-input-wptimecorrection-other')
+  select_list(:time_offset_select, id: 'mw-input-wptimecorrection')
+  radio_button(:year_mo_day_radio, id: 'mw-input-wpdate-ymd')
+end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf3db3b3ac756bcf3e0802b30474c4deacdecd51
Gerrit-PatchSet: 1
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <cmcma...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to