Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349974 )

Change subject: Category overlay should show "content based" categories
......................................................................

Category overlay should show "content based" categories

Only hidden categories should appear in "organizational"
Now we are using formatversion=2 rather than checking for empty string
we'll want to use the boolean

Browser tests have been added!

Bug: T163699
Change-Id: Ie49bac6b9152cfd9ef0f67399d021334198cef13
---
M resources/mobile.categories.overlays/CategoryOverlay.js
A tests/browser/features/category.feature
A tests/browser/features/step_definitions/category_steps.rb
M tests/browser/features/step_definitions/create_page_api_steps.rb
M tests/browser/features/support/pages/article_page.rb
5 files changed, 47 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/74/349974/1

diff --git a/resources/mobile.categories.overlays/CategoryOverlay.js 
b/resources/mobile.categories.overlays/CategoryOverlay.js
index 9015ff1..2c3e2ae 100644
--- a/resources/mobile.categories.overlays/CategoryOverlay.js
+++ b/resources/mobile.categories.overlays/CategoryOverlay.js
@@ -100,7 +100,7 @@
                                                        
page.categories.forEach( function ( category ) {
                                                                var title = 
mw.Title.newFromText( category.title, category.ns );
 
-                                                               if ( 
category.hidden !== undefined ) {
+                                                               if ( 
category.hidden ) {
                                                                        
$hiddenCatlist.append( self.templatePartials.item.render( {
                                                                                
url: title.getUrl(),
                                                                                
title: title.getNameText()
diff --git a/tests/browser/features/category.feature 
b/tests/browser/features/category.feature
new file mode 100644
index 0000000..6d1efae
--- /dev/null
+++ b/tests/browser/features/category.feature
@@ -0,0 +1,11 @@
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant @login
+Feature: Categories
+
+  @smoke @editing @integration
+  Scenario: I can view categories
+    Given I am using the mobile site
+      And I am in beta mode
+      And I am on a page that has categories
+    When I click on the category button
+    Then I should see the categories overlay
+      And I should see a list of categories
diff --git a/tests/browser/features/step_definitions/category_steps.rb 
b/tests/browser/features/step_definitions/category_steps.rb
new file mode 100644
index 0000000..1565322
--- /dev/null
+++ b/tests/browser/features/step_definitions/category_steps.rb
@@ -0,0 +1,19 @@
+When(/^I click on the category button$/) do
+  on(ArticlePage) do |page|
+    page.wait_until_rl_module_ready('skins.minerva.categories')
+    page.category_element.when_present.click
+  end
+end
+
+Then(/^I should see the categories overlay$/) do
+  on(ArticlePage) do |page|
+    expect(on(ArticlePage).overlay_heading_element.when_present.text).to match 
'Categories'
+  end
+end
+
+
+Then(/^I should see a list of categories$/) do
+  on(ArticlePage) do |page|
+    
expect(on(ArticlePage).overlay_category_topic_item_element.when_present).to 
be_visible
+  end
+end
diff --git a/tests/browser/features/step_definitions/create_page_api_steps.rb 
b/tests/browser/features/step_definitions/create_page_api_steps.rb
index 8d6177d..1b9c3b4 100644
--- a/tests/browser/features/step_definitions/create_page_api_steps.rb
+++ b/tests/browser/features/step_definitions/create_page_api_steps.rb
@@ -63,6 +63,18 @@
   end
 end
 
+Given(/^I am on a page that has categories$/) do
+  msg = 'This page is used by Selenium to test category related features.'
+  api.create_page 'Category:Selenium artifacts', msg
+  api.create_page 'Category:Test category', msg
+  wikitext = msg + '
+
+[[Category:Test category]] [[Category:Selenium artifacts]]'
+
+  api.create_page 'Selenium categories test page', wikitext
+  step 'I am on the "Selenium categories test page" page'
+end
+
 Given(/^I go to a page that has languages$/) do
   wikitext = 'This page is used by Selenium to test language related features.
 
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index 56f6cc6..275cfe5 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -90,6 +90,7 @@
   # page-actions
   ul(:page_actions, id: 'page-actions')
   a(:talk, css: '.talk')
+  a(:category, css: '.category-button')
   a(:nearby_button, css: '#page-secondary-actions .nearby')
 
   # wikidata descriptions
@@ -119,6 +120,9 @@
   end
   h2(:overlay_heading, css: '.overlay-title h2')
 
+  # category
+  li(:overlay_category_topic_item, css: '.topic-title-list li')
+
   # visual editor
   div(:overlay_ve, css: '.editor-overlay-ve')
   div(:overlay_ve_header) do |page|

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie49bac6b9152cfd9ef0f67399d021334198cef13
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to