Zfilipin has uploaded a new change for review. https://gerrit.wikimedia.org/r/61564
Change subject: Refactored pages, exctracted duplicate code to URL module ...................................................................... Refactored pages, exctracted duplicate code to URL module Bug: 47657 Change-Id: Iafe6906c8b4c7ebf9ad8c65961797d65d996e87b --- A features/support/modules/url_module.rb M features/support/pages/aftv5_page.rb M features/support/pages/appearance_page.rb M features/support/pages/article_page.rb M features/support/pages/create_account_page.rb M features/support/pages/describe_page.rb M features/support/pages/does_not_exist_page.rb M features/support/pages/file_does_not_exist_page.rb M features/support/pages/learn_page.rb M features/support/pages/login_page.rb M features/support/pages/main_page.rb M features/support/pages/page_triage_page.rb M features/support/pages/preferences_page.rb M features/support/pages/random_page.rb M features/support/pages/release_rights_page.rb M features/support/pages/upload_page.rb M features/support/pages/upload_wizard_page.rb M features/support/pages/use_page.rb 18 files changed, 44 insertions(+), 153 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/qa/browsertests refs/changes/64/61564/1 diff --git a/features/support/modules/url_module.rb b/features/support/modules/url_module.rb new file mode 100644 index 0000000..6268546 --- /dev/null +++ b/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://en.wikipedia.beta.wmflabs.org/wiki/' + end + "#{mediawiki_url}#{name}" + end +end diff --git a/features/support/pages/aftv5_page.rb b/features/support/pages/aftv5_page.rb index 27efa69..08d68ab 100644 --- a/features/support/pages/aftv5_page.rb +++ b/features/support/pages/aftv5_page.rb @@ -1,15 +1,8 @@ class AFTv5Page 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}Aftpage" - end - page_url url + include URL + page_url URL.url('Aftpage') div(:aft_box, id: 'mw-articlefeedbackv5') a(:all_comments, text: /All comments/) diff --git a/features/support/pages/appearance_page.rb b/features/support/pages/appearance_page.rb index e43c007..6d5c05d 100644 --- a/features/support/pages/appearance_page.rb +++ b/features/support/pages/appearance_page.rb @@ -1,15 +1,8 @@ class AppearancePage 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 + include URL + page_url URL.url('Special:Preferences#mw-prefsection-rendering') radio_button(:always_render_radio, id: 'mw-input-wpmath-0') checkbox(:auto_number_check, id: 'mw-input-wpnumberheadings') diff --git a/features/support/pages/article_page.rb b/features/support/pages/article_page.rb index 5fe20b8..13abc8a 100644 --- a/features/support/pages/article_page.rb +++ b/features/support/pages/article_page.rb @@ -1,15 +1,8 @@ class ArticlePage 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}<%=params[:page_name]%>" - end - page_url url + include URL + page_url URL.url('<%=params[:page_name]%>') a(:discussion, text: 'Discussion') a(:edit, text: 'Edit') diff --git a/features/support/pages/create_account_page.rb b/features/support/pages/create_account_page.rb index 3636617..d2d655c 100644 --- a/features/support/pages/create_account_page.rb +++ b/features/support/pages/create_account_page.rb @@ -1,15 +1,8 @@ class CreateAccountPage 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}<%=params[:page_title]%>" - end - page_url url + include URL + page_url URL.url('<%=params[:page_title]%>') button(:create_account, id: 'wpCreateaccount') end diff --git a/features/support/pages/describe_page.rb b/features/support/pages/describe_page.rb index 53c56e5..dc5964d 100644 --- a/features/support/pages/describe_page.rb +++ b/features/support/pages/describe_page.rb @@ -1,15 +1,8 @@ class DescribePage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') textarea(:description, name: /^description/) div(:next_parent, id: 'mwe-upwiz-stepdiv-details') diff --git a/features/support/pages/does_not_exist_page.rb b/features/support/pages/does_not_exist_page.rb index a35a98c..554dfc5 100644 --- a/features/support/pages/does_not_exist_page.rb +++ b/features/support/pages/does_not_exist_page.rb @@ -1,15 +1,8 @@ class DoesNotExistPage 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}<%=params[:page_name]%>" - end - page_url url + include URL + page_url URL.url('<%=params[:page_name]%>') a(:create, text: 'Create') div(:page_text, id: 'mw-content-text') diff --git a/features/support/pages/file_does_not_exist_page.rb b/features/support/pages/file_does_not_exist_page.rb index 5d292b5..a1fd1c7 100644 --- a/features/support/pages/file_does_not_exist_page.rb +++ b/features/support/pages/file_does_not_exist_page.rb @@ -1,13 +1,6 @@ class FileDoesNotExistPage 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}File:<%=params[:page_name]%>" - end - page_url url + include URL + page_url URL.url('File:<%=params[:page_name]%>') end diff --git a/features/support/pages/learn_page.rb b/features/support/pages/learn_page.rb index d1ce06d..3239e88 100644 --- a/features/support/pages/learn_page.rb +++ b/features/support/pages/learn_page.rb @@ -1,15 +1,8 @@ class LearnPage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') checkbox(:skip, id: 'mwe-upwiz-skip') div(:next_parent, id: 'mwe-upwiz-stepdiv-tutorial') diff --git a/features/support/pages/login_page.rb b/features/support/pages/login_page.rb index 80adc2d..5a22322 100644 --- a/features/support/pages/login_page.rb +++ b/features/support/pages/login_page.rb @@ -1,15 +1,8 @@ class LoginPage 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:UserLogin" - end - page_url url + include URL + page_url URL.url('Special:UserLogin') div(:feedback, class: 'errorbox') button(:login, id: 'wpLoginAttempt') diff --git a/features/support/pages/main_page.rb b/features/support/pages/main_page.rb index 5fc90ed..3f148a9 100644 --- a/features/support/pages/main_page.rb +++ b/features/support/pages/main_page.rb @@ -1,15 +1,8 @@ class MainPage 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}Main_Page" - end - page_url url + include URL + page_url URL.url('Main_Page') a(:my_sandbox, text: "My sandbox") end diff --git a/features/support/pages/page_triage_page.rb b/features/support/pages/page_triage_page.rb index 315e6e3..4f76133 100644 --- a/features/support/pages/page_triage_page.rb +++ b/features/support/pages/page_triage_page.rb @@ -1,15 +1,8 @@ class PageTriagePage 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:NewPagesFeed" - end - page_url url + include URL + page_url URL.url('Special:NewPagesFeed') radio_button(:blocked, id: 'mwe-pt-filter-blocked') radio_button(:bots, id: 'mwe-pt-filter-bot-edits') diff --git a/features/support/pages/preferences_page.rb b/features/support/pages/preferences_page.rb index bd33d4d..e33d9ac 100644 --- a/features/support/pages/preferences_page.rb +++ b/features/support/pages/preferences_page.rb @@ -1,15 +1,8 @@ class PreferencesPage 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" - end - page_url url + include URL + page_url URL.url('Special:Preferences') a(:appearance_link, text: 'Appearance') a(:date_and_time_link, text: 'Date and time') diff --git a/features/support/pages/random_page.rb b/features/support/pages/random_page.rb index 1291237..0799971 100644 --- a/features/support/pages/random_page.rb +++ b/features/support/pages/random_page.rb @@ -1,15 +1,8 @@ class RandomPage 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:Random" - end - page_url url + include URL + page_url URL.url('Special:Random') li(:main_page, id: 'n-mainpage-description') a(:download_as_pdf, text: 'Download as PDF') diff --git a/features/support/pages/release_rights_page.rb b/features/support/pages/release_rights_page.rb index becf7b9..9b86cf2 100644 --- a/features/support/pages/release_rights_page.rb +++ b/features/support/pages/release_rights_page.rb @@ -1,15 +1,8 @@ class ReleaseRightsPage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') radio(:my_own_work, id: 'deedChooser1-ownwork') div(:next_parent, id: 'mwe-upwiz-stepdiv-deeds') diff --git a/features/support/pages/upload_page.rb b/features/support/pages/upload_page.rb index 87bbebc..7c43b3c 100644 --- a/features/support/pages/upload_page.rb +++ b/features/support/pages/upload_page.rb @@ -1,15 +1,8 @@ class UploadPage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') span(:continue, text: 'Continue') file_field(:select_file, name: 'file') diff --git a/features/support/pages/upload_wizard_page.rb b/features/support/pages/upload_wizard_page.rb index 01cb7b1..b864852 100644 --- a/features/support/pages/upload_wizard_page.rb +++ b/features/support/pages/upload_wizard_page.rb @@ -1,15 +1,8 @@ class UploadWizardPage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') text_field(:add_categories, id: 'categories0') text_field(:altitude, id: 'location-altitude0') diff --git a/features/support/pages/use_page.rb b/features/support/pages/use_page.rb index b52f9aa..385c3fc 100644 --- a/features/support/pages/use_page.rb +++ b/features/support/pages/use_page.rb @@ -1,15 +1,8 @@ class UsePage 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:UploadWizard" - end - page_url url + include URL + page_url URL.url('Special:UploadWizard') span(:upload_more_files, text: 'Upload more files') end -- To view, visit https://gerrit.wikimedia.org/r/61564 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iafe6906c8b4c7ebf9ad8c65961797d65d996e87b Gerrit-PatchSet: 1 Gerrit-Project: qa/browsertests Gerrit-Branch: master Gerrit-Owner: Zfilipin <zfili...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits