jenkins-bot has submitted this change and it was merged.

Change subject: QA: Correct the acceptance tests for main page
......................................................................


QA: Correct the acceptance tests for main page

A whole bunch of refactoring.

Change-Id: Ia5fdaba8450266735981a470cbc0ae376f4f792c
---
M tests/acceptance/features/search.feature
M tests/acceptance/features/step_definitions/search_steps.rb
M tests/acceptance/features/support/pages/home_page.rb
A tests/acceptance/features/support/pages/search_page.rb
4 files changed, 35 insertions(+), 33 deletions(-)

Approvals:
  Mgrover: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/acceptance/features/search.feature 
b/tests/acceptance/features/search.feature
index ec55de7..75dc4c1 100644
--- a/tests/acceptance/features/search.feature
+++ b/tests/acceptance/features/search.feature
@@ -1,10 +1,7 @@
 Feature: Search
 
-  Scenario: User can search from home page
+  Scenario: Seach for partial text
     Given I am on the home page
-    Then Search box should be there
-
-  Scenario: Search for partial string
-    Given I am on the home page
-    When I type san
+     When I click the placeholder search box
+       And I type into search box san
     Then Search results should contain San Francisco
diff --git a/tests/acceptance/features/step_definitions/search_steps.rb 
b/tests/acceptance/features/step_definitions/search_steps.rb
index 91fa9a9..9e6d0ed 100644
--- a/tests/acceptance/features/step_definitions/search_steps.rb
+++ b/tests/acceptance/features/step_definitions/search_steps.rb
@@ -1,14 +1,16 @@
-Given /^I am on the home page$/ do
-  visit(HomePage).main_page_element.should exist
+Given(/^I am on the home page$/) do
+  visit(HomePage)
 end
 
-When /^I type (.+)$/ do |search_term|
-  on(HomePage).search_box_element.send_keys 'san'
+When(/^I click the placeholder search box$/) do
+  on(SearchPage).search_box_placeholder_element.when_present.click
 end
 
-Then /^Search box should be there$/ do
-  on(HomePage).search_box_element.should exist
+
+When(/^I type into search box (.+)$/) do |search_term|
+  on(SearchPage).search_box2=search_term
 end
-Then /^Search results should contain (.+)$/ do |text|
-  on(HomePage).search_result_element.when_present.text.should == text
+
+Then(/^Search results should contain (.+)$/) do |text|
+  on(SearchPage).search_result_element.when_present.text.should == text
 end
diff --git a/tests/acceptance/features/support/pages/home_page.rb 
b/tests/acceptance/features/support/pages/home_page.rb
index 5f1a91b..daf5de5 100644
--- a/tests/acceptance/features/support/pages/home_page.rb
+++ b/tests/acceptance/features/support/pages/home_page.rb
@@ -6,29 +6,22 @@
     URL.url('Main_Page')
   end
   page_url url
-
-  a(:mainmenu_button, id: 'mw-mf-main-menu-button')
+  
+  a(:about_link, text: 'About')
+  a(:content_link, text: 'CC BY-SA 3.0')
+  a(:contrib_link, text: 'contributors')
+  a(:disclaimer_link, text: 'Disclaimers')
   a(:login_button, href: /Special:UserLogin/)
   a(:login, text: 'Login')
-  li(:search_results, title: 'San Francisco')
-  a(:search_result) do |page|
-    page.search_results_element.a
-  end
-  text_field(:search_box, name: 'search')
-  div(:main_page, id: 'mainpage')
-  a(:watch_link, class: 'watch-this-article')
-  a(:watched_link, class: 'watch-this-article watched')
-  div(:watch_note, text: 'Added San Francisco Chronicle to your watchlist')
-  div(:watch_note_removed, text: 'Removed San Francisco Chronicle from your 
watchlist')
-  button(:openfooter_button, class:   'openSection')
+  a(:mainmenu_button, id: 'mw-mf-main-menu-button')
   span(:mobile_select, text: 'Mobile')
-  a(:contrib_link, text: 'contributors')
-  a(:content_link, text: 'CC BY-SA 3.0')
-  a(:terms_link, text: 'Terms of Use')
+  button(:openfooter_button, class:   'openSection')
   a(:privacy_link, text: 'Privacy')
-  a(:about_link, text: 'About')
-  a(:disclaimer_link, text: 'Disclaimers')
   form(:search_form, id: 'mw-mf-searchForm')
   a(:sign_up, text: 'Sign up')
-  div(:main_page, id: 'mainpage')
+  a(:terms_link, text: 'Terms of Use')
+  a(:watch_link, class: 'watch-this-article')
+  div(:watch_note, text: 'Added San Francisco Chronicle to your watchlist')
+  a(:watched_link, class: 'watch-this-article watched')
+  div(:watch_note_removed, text: 'Removed San Francisco Chronicle from your 
watchlist')
 end
diff --git a/tests/acceptance/features/support/pages/search_page.rb 
b/tests/acceptance/features/support/pages/search_page.rb
new file mode 100644
index 0000000..8defdf1
--- /dev/null
+++ b/tests/acceptance/features/support/pages/search_page.rb
@@ -0,0 +1,10 @@
+class SearchPage
+  include PageObject
+
+  text_field(:search_box_placeholder, name: 'search', index: 0)
+  text_field(:search_box2, name: 'search', index: 1)
+  li(:search_results, title: 'San Francisco')
+  a(:search_result) do |page|
+    page.search_results_element.a
+  end
+end
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5fdaba8450266735981a470cbc0ae376f4f792c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Mgrover <[email protected]>
Gerrit-Reviewer: Rachel99 <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to