Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/323337
Change subject: Fix empty watchlist views
......................................................................
Fix empty watchlist views
A MobileCollection should be Countable
Additional changes:
* Add browser tests
* Center watchlist empty illustration (looks bad on tablet)
Bug: T148599
Change-Id: Ief849fe0575407e407dd7363edef6eeec082b03b
---
M includes/models/MobileCollection.php
M resources/mobile.special.pagefeed.styles/pagefeed.less
A tests/browser/features/special_watchlist_newuser.feature
M tests/browser/features/step_definitions/special_watchlist_steps.rb
M tests/browser/features/support/pages/watchlist_page.rb
A tests/browser/foo.diff
6 files changed, 72 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/37/323337/1
diff --git a/includes/models/MobileCollection.php
b/includes/models/MobileCollection.php
index 79931df..ca898b1 100644
--- a/includes/models/MobileCollection.php
+++ b/includes/models/MobileCollection.php
@@ -7,7 +7,7 @@
/**
* A collection of pages, which are represented by the MobilePage class.
*/
-class MobileCollection implements IteratorAggregate {
+class MobileCollection implements IteratorAggregate, Countable {
/**
* The internal collection of pages.
@@ -17,6 +17,13 @@
protected $pages = [];
/**
+ * Return size of the collection
+ */
+ public function count() {
+ return sizeof( $this->pages );
+ }
+
+ /**
* Adds a page to the collection.
*
* @param MobilePage $page
diff --git a/resources/mobile.special.pagefeed.styles/pagefeed.less
b/resources/mobile.special.pagefeed.styles/pagefeed.less
index 09968bf..ddb1c61 100644
--- a/resources/mobile.special.pagefeed.styles/pagefeed.less
+++ b/resources/mobile.special.pagefeed.styles/pagefeed.less
@@ -72,7 +72,7 @@
img {
width: 100%;
max-width: 378px;
- margin: 1em 0 2em;
+ margin: 1em auto 2em;
display: block;
}
}
diff --git a/tests/browser/features/special_watchlist_newuser.feature
b/tests/browser/features/special_watchlist_newuser.feature
new file mode 100644
index 0000000..08a000d
--- /dev/null
+++ b/tests/browser/features/special_watchlist_newuser.feature
@@ -0,0 +1,13 @@
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @integration
@test2.m.wikipedia.org @vagrant @login
+Feature: Manage Watchlist
+
+ Background:
+ Given I am logged in as a new user
+ And I am on the "Special:EditWatchlist" page
+
+ Scenario: Empty Watchlist on list view
+ Then I am informed on how to add pages to my watchlist
+
+ Scenario: Empty Watchlist on feed view
+ And I switch to the modified view of the watchlist
+ Then I am told there are no new changes
diff --git a/tests/browser/features/step_definitions/special_watchlist_steps.rb
b/tests/browser/features/step_definitions/special_watchlist_steps.rb
index 7a10cd8..20d584d 100644
--- a/tests/browser/features/step_definitions/special_watchlist_steps.rb
+++ b/tests/browser/features/step_definitions/special_watchlist_steps.rb
@@ -34,3 +34,12 @@
Then(/^the modified button should be selected$/) do
expect(on(WatchlistPage).feed_link_element.parent.element.class_name).to
match 'is-on'
end
+
+Then(/^I am informed on how to add pages to my watchlist$/) do
+ expect(on(WatchlistPage).empty_howto_element.when_present).to be_visible
+end
+
+Then(/^I am told there are no new changes$/) do
+ expect(on(WatchlistPage).empty_panel.when_present).to be_visible
+ expect(on(WatchlistPage).empty_howto_element).not_to be_visible
+end
diff --git a/tests/browser/features/support/pages/watchlist_page.rb
b/tests/browser/features/support/pages/watchlist_page.rb
index a2ad11b..0432ca2 100644
--- a/tests/browser/features/support/pages/watchlist_page.rb
+++ b/tests/browser/features/support/pages/watchlist_page.rb
@@ -5,4 +5,6 @@
ul(:page_list_a_to_z, css: '.page-summary-list')
a(:pages_tab_link, text: 'Pages')
li(:selected_pages_tab, css: '.mw-mf-watchlist-selector
li:nth-child(2).selected')
+ div(:empty_panel, css: '.empty-page')
+ img(:empty_howto, css: '.empty-page img')
end
diff --git a/tests/browser/foo.diff b/tests/browser/foo.diff
new file mode 100644
index 0000000..ac2cf41
--- /dev/null
+++ b/tests/browser/foo.diff
@@ -0,0 +1,39 @@
+diff --git a/tests/browser/features/special_watchlist.feature
b/tests/browser/features/special_watchlist.feature
+index 34fa415..d0c3016 100644
+--- a/tests/browser/features/special_watchlist.feature
++++ b/tests/browser/features/special_watchlist.feature
+@@ -1,12 +1,21 @@
+ @chrome @en.m.wikipedia.beta.wmflabs.org @firefox @integration
@test2.m.wikipedia.org @vagrant @login
+ Feature: Manage Watchlist
+
+- Background:
+- Given I am logged into the mobile website
+- And I have recently edited pages on my watchlist
++ Scenario: Empty Watchlist on list view
++ Given I am logged in as a new user
+ And I am on the "Special:EditWatchlist" page
++ Then I am informed on how to add pages to my watchlist
++
++ Scenario: Empty Watchlist on feed view
++ Given I am logged in as a new user
++ And I am on the "Special:EditWatchlist" page
++ And I switch to the modified view of the watchlist
++ Then I am told there are no new changes
+
+ Scenario: Switching to Feed view
++ Given I am logged into the mobile website
++ And I have recently edited pages on my watchlist
++ And I am on the "Special:EditWatchlist" page
+ When I switch to the modified view of the watchlist
+ And I click the Pages tab
+ And the Pages tab is selected
+@@ -14,6 +23,9 @@ Feature: Manage Watchlist
+ And the modified button should be selected
+
+ Scenario: Switching to List view
++ Given I am logged into the mobile website
++ And I have recently edited pages on my watchlist
++ And I am on the "Special:EditWatchlist" page
+ When I switch to the modified view of the watchlist
+ And I switch to the list view of the watchlist
+ Then I should see a list of pages I am watching
--
To view, visit https://gerrit.wikimedia.org/r/323337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief849fe0575407e407dd7363edef6eeec082b03b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits