Zfilipin has submitted this change and it was merged.

Change subject: adding watchlist behavoir when logged out
......................................................................


adding watchlist behavoir when logged out

Change-Id: Ic40a4a368c1a4c15ee1f0c6c424e475073e86243
---
M tests/acceptance/features/step_definitions/watchlist_steps.rb
M tests/acceptance/features/support/pages/home_page.rb
M tests/acceptance/features/support/pages/login_page.rb
A tests/acceptance/features/support/pages/san_francisco_chronicle_page.rb
M tests/acceptance/features/watchlist.feature
5 files changed, 55 insertions(+), 5 deletions(-)

Approvals:
  Zfilipin: Verified; Looks good to me, approved



diff --git a/tests/acceptance/features/step_definitions/watchlist_steps.rb 
b/tests/acceptance/features/step_definitions/watchlist_steps.rb
index d37d947..6966aa9 100644
--- a/tests/acceptance/features/step_definitions/watchlist_steps.rb
+++ b/tests/acceptance/features/step_definitions/watchlist_steps.rb
@@ -4,6 +4,32 @@
     page.save_settings
   end
 end
+
+Given /^I am not logged in$/ do
+  on(HomePage).login_button_element.should exist
+end
+
+Given /^I am at San Francisco Chronicle article$/ do
+  visit SanFranciscoChroniclePage
+end
+
+When /^Select the watchlist icon$/ do
+  on(HomePage).watch_link_element.when_present.click
+end
+
+Then /^I receive notification that I need to log in to use the watchlist 
functionality$/ do
+  on(HomePage).text.should include "Please login or sign up to watch this 
page."
+end
+
+Then /^When I click Sign In I go to the Log In page$/ do
+  on(LoginPage) do |page|
+    page.login_wl_element.when_present.click
+    page.text.should include "Sign in"
+  end
+end
+
+#Signup takes you to the sign in page... should it take you to the Mobile 
Create Account page??
+
 Given /^I am logged into the mobile website$/ do
   on(HomePage) do |page|
     page.mainmenu_button_element.when_present.click
@@ -34,11 +60,13 @@
     page.watch_note_element.exists?
   end
 end
+
 Then /^the article watchlist icon is selected$/ do
   on(HomePage) do |page|
     page.watched_link_element.should be_true
   end
 end
+
 Then /^I receive notification that the article has been removed from the 
watchlist$/ do
   on(HomePage) do |page|
     page.watch_note_removed_element.exists?
@@ -46,6 +74,6 @@
 end
 Then /^the article no longer has the watchlist icon selected$/ do
   on(HomePage) do |page|
-    page.watch_link_element.exists?
+    page.watch_link_element.should be_true
   end
 end
diff --git a/tests/acceptance/features/support/pages/home_page.rb 
b/tests/acceptance/features/support/pages/home_page.rb
index 3f64d4d..f2304ff 100644
--- a/tests/acceptance/features/support/pages/home_page.rb
+++ b/tests/acceptance/features/support/pages/home_page.rb
@@ -13,14 +13,14 @@
   page_url url
 
   a(:mainmenu_button, id: 'mw-mf-main-menu-button')
-  a(:login_button, class: 'login')
+  a(:login_button, class: 'external login')
   a(:search_result, class: 'search-result-item')
   text_field(:search_box, id: 'mw-mf-search')
   div(:menupage, id: 'mw-mf-menu-page')
   a(:watch_link, class: 'watch-this-article')
   a(:watched_link, class: 'watch-this-article watched')
-  div(:watch_note, text: 'Added Main Page to your watchlist')
-  div(:watch_note_removed, text: 'Removed San Francisco from your watchlist')
+  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')
   span(:mobile_select, text: 'Mobile')
   a(:contrib_link, text: 'contributors')
diff --git a/tests/acceptance/features/support/pages/login_page.rb 
b/tests/acceptance/features/support/pages/login_page.rb
index e56c44e..9585eb2 100644
--- a/tests/acceptance/features/support/pages/login_page.rb
+++ b/tests/acceptance/features/support/pages/login_page.rb
@@ -9,6 +9,7 @@
   a(:phishing, text: 'phishing')
   a(:password_strength, text: 'password strength')
   text_field(:username, id: 'wpName1')
+  a(:login_wl, class: 'button')
 
   def logged_in_as_element
     @browser.div(id: 'mw-content-text').p.b
diff --git 
a/tests/acceptance/features/support/pages/san_francisco_chronicle_page.rb 
b/tests/acceptance/features/support/pages/san_francisco_chronicle_page.rb
new file mode 100644
index 0000000..51ef34f
--- /dev/null
+++ b/tests/acceptance/features/support/pages/san_francisco_chronicle_page.rb
@@ -0,0 +1,14 @@
+class SanFranciscoChroniclePage
+  include PageObject
+  include URLModule
+
+  def self.url
+    if ENV['MEDIAWIKI_URL']
+      base_url = ENV['MEDIAWIKI_URL']
+    else
+      base_url = 'http://127.0.0.1:80/wiki/'
+    end
+    "#{base_url}San_Francisco_Chronicle"
+  end
+  page_url url
+end
diff --git a/tests/acceptance/features/watchlist.feature 
b/tests/acceptance/features/watchlist.feature
index 8685203..0130dd5 100644
--- a/tests/acceptance/features/watchlist.feature
+++ b/tests/acceptance/features/watchlist.feature
@@ -2,14 +2,21 @@
 
   Background:
     Given I am in beta mode
-      And I am logged into the mobile website
+
+  Scenario: Watchlist behavior when not logged in
+      And I am not logged in
+      And I am at San Francisco Chronicle article
+    When Select the watchlist icon
+    Then I receive notification that I need to log in to use the watchlist 
functionality
 
   Scenario: Add an article to the watchlist
+    And I am logged into the mobile website
     When I search for an article and 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
+    And I am logged into the mobile website
     When I search for an article and 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/47330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic40a4a368c1a4c15ee1f0c6c424e475073e86243
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Mgrover <[email protected]>
Gerrit-Reviewer: Cmcmahon <[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