Mgrover has submitted this change and it was merged.
Change subject: Fixed watchlist tests
......................................................................
Fixed watchlist tests
Change-Id: I5e7f244dad317959104ddf0f6b56297990e113ab
Feature: Manage Watchlist
Bug: 46922
---
M tests/acceptance/features/step_definitions/search_steps.rb
M tests/acceptance/features/step_definitions/watchlist_steps.rb
M tests/acceptance/features/support/pages/home_page.rb
A tests/acceptance/features/support/pages/random_page.rb
M tests/acceptance/features/watchlist.feature
5 files changed, 25 insertions(+), 17 deletions(-)
Approvals:
Mgrover: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/tests/acceptance/features/step_definitions/search_steps.rb
b/tests/acceptance/features/step_definitions/search_steps.rb
index f4302ee..91fa9a9 100644
--- a/tests/acceptance/features/step_definitions/search_steps.rb
+++ b/tests/acceptance/features/step_definitions/search_steps.rb
@@ -3,7 +3,7 @@
end
When /^I type (.+)$/ do |search_term|
- on(HomePage).search_box_element.send_keys "san"
+ on(HomePage).search_box_element.send_keys 'san'
end
Then /^Search box should be there$/ do
diff --git a/tests/acceptance/features/step_definitions/watchlist_steps.rb
b/tests/acceptance/features/step_definitions/watchlist_steps.rb
index 80f6f92..13ea68d 100644
--- a/tests/acceptance/features/step_definitions/watchlist_steps.rb
+++ b/tests/acceptance/features/step_definitions/watchlist_steps.rb
@@ -9,7 +9,7 @@
# nothing to do here, user in not logged in by default
end
-When /^Select the watchlist icon$/ do
+When /^I select the watchlist icon$/ do
on(HomePage).watch_link_element.when_present.click
end
@@ -36,15 +36,8 @@
end
end
-When /^I search for an article and select the watchlist icon$/ do
- on(HomePage) do |page|
- page.search_box="san francisco chronicle"
- page.search_result_element.when_present
- page.search_form_element.submit
- @browser.url.should match Regexp.escape('San_Francisco_Chronicle')
- page.text.should include "San Francisco Chronicle"
- page.watch_link_element.when_present.click
- end
+When /^I go to random page$/ do
+ visit(RandomPage)
end
Then /^I receive notification that the article has been added to the
watchlist$/ do
diff --git a/tests/acceptance/features/support/pages/home_page.rb
b/tests/acceptance/features/support/pages/home_page.rb
index 7562f8c..9e90b8c 100644
--- a/tests/acceptance/features/support/pages/home_page.rb
+++ b/tests/acceptance/features/support/pages/home_page.rb
@@ -12,7 +12,7 @@
page_url url
a(:mainmenu_button, id: 'mw-mf-main-menu-button')
- a(:login_button, class: 'external login')
+ a(:login_button, href: /Special:UserLogin/)
a(:login, text: 'Login')
ul(:search_results, class: 'suggestions-results')
a(:search_result) do |page|
diff --git a/tests/acceptance/features/support/pages/random_page.rb
b/tests/acceptance/features/support/pages/random_page.rb
new file mode 100644
index 0000000..aa98fe2
--- /dev/null
+++ b/tests/acceptance/features/support/pages/random_page.rb
@@ -0,0 +1,13 @@
+class RandomPage
+ include PageObject
+
+ def self.url
+ if ENV['MEDIAWIKI_URL']
+ mediawiki_url = ENV['MEDIAWIKI_URL']
+ else
+ mediawiki_url = 'http://127.0.0.1:80/wiki/'
+ end
+ "#{mediawiki_url}Special:Random"
+ end
+ page_url url
+end
diff --git a/tests/acceptance/features/watchlist.feature
b/tests/acceptance/features/watchlist.feature
index 035497b..1be2ad4 100644
--- a/tests/acceptance/features/watchlist.feature
+++ b/tests/acceptance/features/watchlist.feature
@@ -2,29 +2,31 @@
Scenario: I receive notification that I need to log in to use the watchlist
functionality
Given I am not logged in
- When Select the watchlist icon
+ When I select the watchlist icon
Then I receive notification that I need to log in to use the watchlist
functionality
Scenario: Login link leads to login page
Given I am not logged in
- When Select the watchlist icon
+ When I select the watchlist icon
And I click Login
Then Login page opens
Scenario: Sign up link leads to Sign up page
Given I am not logged in
- When Select the watchlist icon
+ When I select the watchlist icon
And I click Sign up
Then Sign up page opens
Scenario: Add an article to the watchlist
Given I am logged into the mobile website
- When I search for an article and select the watchlist icon
+ When I go to random page
+ And I select the watchlist icon
Then I receive notification that the article has been added to the
watchlist
And the article watchlist icon is selected
Scenario: Remove an article from the watchlist
Given I am logged into the mobile website
- When I search for an article and select the watchlist icon
+ When I go to random page
+ And I select the watchlist icon
Then I receive notification that the article has been removed from the
watchlist
And the article no longer has the watchlist icon selected
--
To view, visit https://gerrit.wikimedia.org/r/61030
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5e7f244dad317959104ddf0f6b56297990e113ab
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Mgrover <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits