Commit graph

247 commits

Author SHA1 Message Date
Piotr Miazga 9ece509c99 Hygiene: SkinOptions should validate options
Changes:
 - when trying to set unknown option, throw exception
 - added unit tests

Bug: T221012
Change-Id: I0d1a43fb5a7179b8e9cd578e3e33bab12ddfd61c
2019-07-31 22:24:29 +00:00
jdlrobson 0311e8ed1c Disable diff test due to issue with RunJobs
Bug: T229031
Change-Id: I9bf37b796ba9ddafdc3be559e74d2b511c3e78b1
2019-07-25 18:38:05 +00:00
jdlrobson f0503a52d0 Refresh the user, bell and search icon
* New module skins.minerva.icons.wikimedia provides icons
from Wikimedia UI in Minerva
* search selector in skins.minerva.content.styles.images is
retained for cached HTML
* skins.minerva.icons.loggedin now a
ResourceLoaderOOUIIconPackModule and bell removed from repo.
* userAvatar replaced with userAvatarOutline

Bug: T224070
Change-Id: Ibed609371060acc4b69e5cd4cd4f20edc871b3ba
2019-07-25 16:35:01 +00:00
jdlrobson 28c84d7d0d Update reference test to click the right element
This behaviour changed in Ife957374cb0d21446db2067171e68fb726ad8347
and related changes

Bug: T214049
Change-Id: I48df96eedebc6e34d62d1cdb02cddb7a091dae86
2019-07-18 14:15:55 -07:00
jenkins-bot 6076c61772 Merge "Embrace packageFiles" 2019-07-16 21:21:42 +00:00
Piotr Miazga d7f60a26db Extract language/variants check to a service
The $hasLangauges and $hasVariants checks were used in couple places,
which lead to the same code used in many places.
Following the DRY rule, let's implement a Service that can do that
check, and use that service everywhere in code.

Bug: T224735
Change-Id: I46d58758356e870c408a74b2c087a42d6ad0ddea
2019-07-16 19:53:57 +00:00
jdlrobson 72df451bd3 Embrace packageFiles
Help with readability by using module.exports and require rather than the MobileFrontend
provided mw.mobileFrontend module manager (and avoid adopting webpack at this time)

Replace usages of mw.mobileFrontend.require with local require and module.exports
(compatible with RL or Node implementation)

Changes:
* Notifications modules are merged into skins.minerva.scripts and initialised
via a client side check.
* new file overlayManager for exporting an overlayManager singleton
rather than being hidden inside resources/skins.minerva.scripts/init.js
* All M.define/M.requires swapped out for require where possible
The `define` method is now forbidden in the repo.

Bug: T212944
Change-Id: I44790dd3fc6fe42bb502d79c39c4081c223bf2b1
2019-07-16 18:04:10 +00:00
Nicholas Ray 331df226f5 Make Minerva use new PageHTMLParser.js and refactored Page.js
In I02f8645aac1d7b081eaba8f2ac92a2ef51f78182, Page.js was made into a
model and its html parsing responsibilities were moved to
PageHTMLParser. Additionally, a singleton for the current page
(currentPage.js) and a singleton for the curent page html parser
(currentPageHTMLParser.js) were introduced to replace the usage of
M.getCurrentPage().

This commit refactors Minerva to make use of these changes.

Notable changes:

* 🐛 The event bus singleton was added to references.js since it
previously relied on an instance of Skin to listen for the
`references-loaded` event. However, this event is emitted on the event
bus singleton.

* Additionally, I didn't see a reason why the `references-loaded` event
needed to also pass the current page instance when the only file
listening to it is references.js (which already has the current page
instance) so I removed that and the convoluted passing of page.js within
the file. I assumed this logic was unecessary.

* The call to drawer.showReferences in references.js now was made to
pass the currentPage instance as well as the currentPageHTMLParser. This
is to prepare for I6e858bbe73f83166476b5b2c0fdac1cca7404246 where the
getReferences() interface for ReferencesMobileViewGateway.js and
ReferencesHtmlScraperGateway.js is refactored to accept both of these
instances. Additionally, references.js was refactored to support event
delegation which gets rid of some parsing/setup logic.

Bug: T193077
Depends-On: I02f8645aac1d7b081eaba8f2ac92a2ef51f78182
Change-Id: I2f32dbcc4ebaa4bebb297cda1ecce3457922b343
2019-07-15 16:43:51 -06:00
jdlrobson 0fa35053c3 QA: Update search browser test selector
Change-Id: Ibef220e65a4dfa3725ac01d4917fe7a0a9b8a878
2019-07-11 17:26:38 -07:00
Kosta Harlan 14493b00dd Move unit test into "unit" directory
See also I16691fc8ac063705ba0c2bc63b96c4534ca8660b

Change-Id: I90921679518ee95fe393f8b1bbd9134daf0ba032
2019-07-09 10:14:36 -04:00
jenkins-bot 61784701e2 Merge "Make failing Bucketing test more robust" 2019-07-08 15:59:15 +00:00
Thiemo Kreuz 303a5019fc Make failing Bucketing test more robust
This test started failing on us for no apparent reason.

Example: Ic95f7b0
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php72-docker/11469/consoleFull

Output: "test control group is about 25% (30.8%)"

It appears like the bucketing is not really done based on an actual
random number generator, but based on a hash that contains the session
ID. If this session ID is not really a random number, the hash might
not be random enough as well, but be skewed towards one or the other
direction.

We propose to take the normal distribution into account and change the
narrow +/- 10% margin to +/- 20%.

Change-Id: Ib163f1de4f9cff27aaf8dbc81189315142ff0d8a
2019-07-05 21:38:58 +00:00
Stephen Niedzielski 4c34cce9f3 Hygiene: move menu entries to subdirectory
The number of generic menu entry specific files is growing which is
cluttering the Menu/ directory. Move the entries to a new subfolder.

Bug: T214540
Change-Id: I807d6f6034ee1924e3a606f5e6782c3298896825
2019-07-05 21:32:44 +00:00
Kosta Harlan 9b7b10bbe9 Allow overriding text and CSS class for home menu entry
* Introduce a HomeMenuEntry class and use it for adding the home menu link
* Provide override methods for text and CSS class

Bug: T223210
Change-Id: I37160887478cba829a6e2f10a4d8f87d95167556
2019-07-03 16:42:47 -04:00
jenkins-bot 200e64d32a Merge "Make SkinOptionsTest extend unit test case" 2019-07-02 18:34:09 +00:00
Kosta Harlan b6682f6f93 Make SkinOptionsTest extend unit test case
Depends-On: I237a9f82e4d1b05cf2f08b3e4bb7ffcd8d47111c
Change-Id: I42ca6c315584ae04289b28efa766bf4e67fda67a
2019-07-02 13:54:11 +00:00
jdlrobson a9533fc463 Browser: Drop failing tests
Two tests are failing. These are false positives that
obscure real failures. Both are removed for the following reason.

1) Editor test is covered by the redirect tests - failing due to
concurrent edits (possibly because multiple browser tests act on the same
page at the same time). However, editing is already covered by the other
2 cases.

2) Remove unwatch test - this is failing as there is a problem in the
setup - the page starts unwatched when it should be watched. The test
for checking that an article can be watched should suffice here.

Bug: T224947
Change-Id: I3049e1b190c3cb2ddc198a45681f59782f770d6a
2019-07-01 18:02:54 -07:00
Piotr Miazga bb0071383a MinervaPermissions must respect $wgHideInterlanguageLinks config
MediaWiki Core defined $wgHideInterlanguageLinks that can be used to
disable the interwiki links. Minerva skin should respect this config,
furthermore, this config should take precedence over the Minerva's
$wgMinervaAlwaysShowLanguageButton config.

Bug: T214540
Bug: T221792
Change-Id: Id4fe8b67a17f9c28c00a8a3a207946e146502cde
2019-06-21 18:59:50 +00:00
Piotr Miazga 6352190684 Hygiene: Extract isAllowedPageAction into MinervaPagePermissions
The isAllowedPageAction is used in multiple places (SkinMinerva
and in PageActions toolbar builder). This logic should be defined
in separate service, easy accessible for different parts of the
Minerva skin.

Changes:
 - Introduced MinervaPagePermissions as a centralized place to manage
 user permissions
 - Introduced MinervaNoTitlePermissions, an NullObject pattern to
 handle situations when we do not have Title object (like in CLI)
 - removed Minerva.ContentHandler service as it's not required any
 more
 - moved all permission names into constants
 - moved isTalkAllowed() into MinervaPermissions
 - renamed isAllowedPageAction() it `isAllowed()` to not mix it
 with PageActions. Those checks are used in many places, not only
 on PageActions menu
 - made isAllowed( watch ) more robust - now it checks that Title
 is watchable

Bug: T221792
Change-Id: I87d44a9c717b5f752b8d1fd2f146d7f5eef3c53f
2019-06-21 15:30:11 +00:00
Stephen Niedzielski 1e61706e0e Hygiene: rename "secondary button" to "user notifications"
The secondary button is not generic. Rename it to match its specific
purpose.

Bug: T214540
Change-Id: I50b7e7fa7bea91a029a8ca71199b0309dff1c518
2019-06-19 11:31:16 -06:00
Stephen Niedzielski 02726555e0 Hygiene: rename user notification build method
Rename SkinMinerva->prepareUserButton() to
prepareUserNotificationsButton(). The function is responsible for
inflating the button that displays notifications when pressed. This name
would be especially confusing when an actual user button is added in
T214540.

Bug: T214540
Change-Id: I8965ef4c5b29ea692d67e821a06131ad5f287287
2019-06-19 11:16:23 -06:00
jenkins-bot 8b32918900 Merge "Revert "temporarily disabling failing browser tests for language selector"" 2019-06-13 18:23:53 +00:00
Niedzielski cb0460aaf5 Revert "temporarily disabling failing browser tests for language selector"
This reverts commit c0b4911670. These
tests seem to be running now.

Bug: T224605
Change-Id: If052e75376ea85d86d395b481f204d3d3049fb3f
2019-06-13 15:24:37 +00:00
jenkins-bot c99188376f Merge "Add method for getting menu entry by name" 2019-06-06 21:46:26 +00:00
Kosta Harlan b035d76d0f Add method for getting menu entry by name
* Also fix typo with $returnToQuery
* More usage of DomainException

Bug: T222834
Change-Id: I5623741779eebe4c5694bdbd7a1aa1bcdd7f04c6
2019-06-06 13:04:29 -04:00
Jan Drewniak 018d436bfe Ensure each api call creates a new instance of MWBot
As a hold-over from a previous porting attempt, thw World.js file
(a cucumber.js convention) exported an instance of MWBot. This
instance was used in several tests, however, since MWBot had been
instantiated multiple times since then, the original edit token
was invalid, causing several tests to fail.

Bug: T224947
Change-Id: I56c06600c43d53bbc4e103d446a1de7a52c2cfad
2019-06-06 13:33:54 +02:00
Piotr Miazga 047618c24d Hygiene: SkinUserPageHelper should support Title = null
In some edge cases the RequestContext::getTitle() can return null
instead of Title object. Similar situations already happened in the
past (see T179833). The RequestContext::getTitle() documentation
says it can return null, therefore code should be resilient and
support such situations, even if there are not common.

Bug: T221792
Change-Id: I842f8c49f20e511fda3b081e59a06586810bc748
2019-06-04 17:17:58 +02:00
Jan Drewniak 7af32bc309 Treat anonymouse user IP pages as UserPages
Ensure SkinUserPageHelper::isUserPage() returns true for user pages
that are IP addresses.

Also adds the page-action menu to all user pages.

Bug: T220114
Change-Id: I3703899bc9ff0042c74260d36f48a388b78b0b6b
2019-06-04 11:53:07 +02:00
jenkins-bot 3598618390 Merge "Hygiene: test method names should be written in cameCase" 2019-06-03 17:37:46 +00:00
jenkins-bot 89b9d58b93 Merge "temporarily disabling failing browser tests for language selector" 2019-06-03 16:55:26 +00:00
Piotr Miazga b3a7047d65 Hygiene: test method names should be written in cameCase
Change-Id: I12bd086c0ebd42133b6f7171847dbe50f8f7fe30
2019-06-03 18:53:40 +02:00
jenkins-bot 4ef947da28 Merge "Watchstar should respect viewmywatchlist|editmywatchlist permissions" 2019-06-03 16:16:58 +00:00
Jan Drewniak c0b4911670 temporarily disabling failing browser tests for language selector
Bug: T224605
Change-Id: I4dbc3c5355f795adfb162b4a1a649440e0f36ca0
2019-06-03 12:41:15 +02:00
Piotr Miazga 4ec9b06a77 Watchstar should respect viewmywatchlist|editmywatchlist permissions
If viewmywatchlist|editmywatchlist permisions were set to false for
anonymous user, MinervaSkin would show a watchstar icon that links
to LoginPage, even if user was logged in. Clicking watching action
would cause browser to reload the page without any effect.
Under the hood - system would redirect to login, and then the login
page would redirect user back to the article page because user is
logged in.

MinervaSkin should respect viewmywatchlist|editmywatchlist
permissions. If user do not have access to watchlist, do not show
watch icon.

Bug: T221792
Change-Id: I26a1133a7ccff6a4adcdc72d594d0902bfa8ff79
2019-05-31 17:34:35 +00:00
jdlrobson 94c0926614 QA: Don't chain things that cannot be chained
Causing builds to fail on
https://integration.wikimedia.org/ci/view/Reading-Web/job/selenium-daily-beta-Minerva/58/console

Bug: T223676
Change-Id: Ia285f8bd2f61e6e59aa38cd1909b450328eb053c
2019-05-28 15:43:39 +02:00
jenkins-bot c4b31067ab Merge "Provide IMenuEntry interface" 2019-05-17 13:12:09 +00:00
jenkins-bot 7a83809f4d Merge "Minerva shouldn't call Skin::getNewTalks() twice" 2019-05-14 15:34:44 +00:00
Piotr Miazga 39a2078472 Minerva shouldn't call Skin::getNewTalks() twice
The Skin::getNewTalks() is already called in SkinTemplate::prepareQuickTemplate.
There is no need to call this function again, as is pretty heavy. Instead of
calling it second time, just re-use the value stored in the QuickTemplate

Change-Id: I0e9491405f4d760278db3a423ee14e8f80720291
2019-05-14 16:09:18 +02:00
Piotr Miazga 6905b85d67 Provide IMenuEntry interface
The Group shouldn't depend upon concrete MenuEntry definition.
Different Menus can present different MenuElements. Code should
allow easy extensions, not limit only to single MenuEntry
definition.

Changes:
 - introduced IMenuEntry interface
 - MenuEntry implements IMenuEntry
 - removed isJSOnly from logic as it's related only to one menu
 element (Watchstar) and Group shouldn't be aware of some special
 handling for some elements. The IMenuEntry shouldn't define this
 method
 - getName, getComponents, getCSSClasses should have defined return
 types

Bug: 1221792
Change-Id: I0646df734e869c26bfa8c3a772200e8258a8acce
2019-05-14 13:12:37 +02:00
jdlrobson d455b88080 Skip the flaking watchstar test
Additional changes to tests:
* pageExists uses brower.call to avoid token error in talk
* use a before rather than beforeEach for creating articles
to avoid an unnecessary API action

Bug: T222517
Change-Id: I44cda7d62e5e4e58ed38b15ae13fdb0c8dc2e900
2019-05-08 13:50:47 -07:00
Nicholas Ray 60cfe3f134 Update Minerva Selenium ReferenceDrawer selector
This selector was changed in I9ded45388dbcb511cc4bf56859f54318e3e168d9
but the tests are still looking for the old selector which makes the
following tests fail:

- Reference popup drawer.Opening and closing the reference drawer
- Reference popup drawer.Opening a nested reference

Bug: T222475
Change-Id: I4ab8a21146dfd8204151659ff587e77bcadcaf9d
2019-05-03 13:54:11 -06:00
jenkins-bot ccea03c2f2 Merge "Change TalkSectionAddOverlay browser test's textarea selector" 2019-05-01 21:57:04 +00:00
jenkins-bot 558ebb37c7 Merge "QA: Two diff pages is enough" 2019-05-01 19:51:42 +00:00
jenkins-bot dcf2d589a3 Merge "Minerva is Hogan free" 2019-05-01 19:41:39 +00:00
Nicholas Ray 723deeb8bf Change TalkSectionAddOverlay browser test's textarea selector
In anticipation of the changes in
I30aa36a0cb89988d1bad8256e5d3f737380bc0a7 which removes the
.wikibase-editor selector from the TalkSectionAddOverlay textarea, the
browser tests need to be changed to a more accomodating selector.
Instead of finding the textarea from the .wikitext-editor selector, the
tests now look for the textarea in the overlay (there is only one). This
also makes it more in line with its method for finding the input element
(.talk-overlay input) as well.

Bug: T221624
Change-Id: Ifbba23e9aee6f68033efc3279ed737d519a7bf41
2019-04-29 17:41:38 -06:00
jdlrobson 0540abb30c QA: Two diff pages is enough
Use the more verbose SpecialMobileDiff page

Change-Id: I1e773b0a654d2b03601ae8ba37dc8bbc03910e7f
2019-04-26 07:46:04 +00:00
jdlrobson daef425ba1 Minerva is Hogan free
All hail Mustache!

Change-Id: Iaf83dc27addd00ffd65d003bd5d84441965124e8
Depends-On: If00010e092e3766f9812f9a69ce0dfe22298689a
Bug: T220620
2019-04-25 10:34:01 +08:00
jdlrobson 6e9d56efa6 Restore category step for CI
Per T199939#5096023 use job runner to execute the job runner
as part of the test to ensure the API can return categories for
a page.

Bug: T219920
Change-Id: I467f6635fd0d80a01428f6b06a8c750430d63d6d
2019-04-23 15:56:09 +08:00
jenkins-bot 9ceabb6bda Merge "Port remaining @login tests to Node.js" 2019-04-19 12:07:18 +00:00
jenkins-bot 6cd23276b2 Merge "QA: Port Notifications browser test to Node.js" 2019-04-19 12:07:16 +00:00
jenkins-bot fd5570cc1b Merge "Migrate editor_wikitext_saving.feature from Ruby to Node" 2019-04-19 12:07:14 +00:00
Piotr Miazga 1f4582cc09 Provide a code structure for menus handling and add Advanced menu
Changes:
 - moved all menu elements definitions from SkinMinerva into
 a separate Definitions.php file
 - moved menu building from SkinMinerva into includes/menu/Main
 folder
 - introduced Builder pattern for easy menu building
 Minerva/Menu/Main/Director takes an Minerva/Menu/Main/IBuilder
 and builds the menu. The IBuilders use definitions from
 Minerva/Menu/Definitions file, so all definitions can be shared
 across different menus
 - used ServiceWiring file to register MainMenu Director as Service
 - left class_alias for old MenuBuilder as some extensions still use it
 - The hooks system have to stay like that as some extensions
 are using it (BlueSpiceMultiUpload and GrowthExperiments).
 - introduced AdvancedMenu builder for the AMC mode

Bug: T216152
Change-Id: I210c3f1fa36bbd2f9108d728b12cbb21ee210354
2019-04-16 13:19:51 +02:00
Piotr Miazga 258e635ae5 Extract SkinOptions to separate class
SkinOptions array was used to determine which options are available
for current session. Once we started extracting things from
SkinMinerva class, we found out that lots of things depend on
SkinOptions.

For example MainMenu/PageActionsMenu depend on skinsOptions var.
We could pass $skin object as dependency to a menu builder, but
this would cause a circural dependency (Skin depends on menu builder,
menu builder depends on skin) which is an anti-pattern.
In order to avoid such situations lets prepare first, and extract
the SkinOptions to a separate class, register it as a service
so different parts of Skin Minerva can freely use a single instance
of SkinOptions object.

Bug: T216152
Bug: T221012
Change-Id: Icd5da546e1bfaf8d9bfe86dab3b659a88eae19e4
2019-04-15 20:34:12 +00:00
jenkins-bot 13153394a3 Merge "Use MediaWikiServices to cache commonly used helpers" 2019-04-15 19:19:45 +00:00
Piotr Miazga 572ffdf25a Use MediaWikiServices to cache commonly used helpers
SkinMinerva cached the ContentHandler object for better performance.
In the future the ContentHandler will be also used in the Menu,
for better readability, store ContentHandler as Service.

MediaWikiServices will initialize service on first access and cache
it for future needs. Same applies to SkinUserPageHelper,

Bug: T216152
Change-Id: Ia98dc860862360a68556272714669f0c3a13eb1e
2019-04-15 20:50:11 +02:00
jdlrobson 544b0e70c9 Port remaining @login tests to Node.js
Bug: T219920
Change-Id: I9f651d73cae8d6494ffa585ac3cbd791686b926a
2019-04-11 21:17:45 +00:00
jdlrobson c16c20a394 QA: Port Notifications browser test to Node.js
Uncover a bug and fix it in the process \o/ - it seems that the
close icon is misplaced between clicking the notifications icon
and loading the contents of the overlay - this confuses the webdriver
as the button is not clickable.

Bug: T219920
Change-Id: Ib4d076fd9b7ea1cd48b6b58940a50560eacd51a0
2019-04-11 13:26:39 -07:00
jdlrobson 7f2b69ac14 Migrate editor_wikitext_saving.feature from Ruby to Node
This migrates the first of the browser tests which had a @login
step from Ruby to Node.js

Bug: T219920
Change-Id: I84e217e2a781aab9eb10e7d873c527d578ec8fd4
2019-04-11 13:04:49 -07:00
jenkins-bot b2448e0d23 Merge "Adding "diff.feature" selenium test" 2019-04-11 18:19:56 +00:00
Jan Drewniak 6bd240389e Adding "diff.feature" selenium test
Bug: T219920
Change-Id: I34b5301a274fe90a7a2db58a8bec2b9398d998b6
2019-04-10 23:15:37 +00:00
Stephen Niedzielski cbea4fabd5 Hygiene: remove unused downloadPageAction argument
Remove unused Skin parameter from downloadPageAction.

Change-Id: I27cd85b1e4f2328d3d4fd0ece5580c4432181757
2019-04-10 15:21:27 -06:00
Jdlrobson dac9039246 Revert "Beta mode cookie must be set on mobile domain"
This reverts commit 1903d1adae.
This didn't actually solve the problem.

Change-Id: Ic789e96dcc17268abe3690647e1d82a764491646
2019-04-10 20:28:17 +00:00
jdlrobson 1903d1adae Beta mode cookie must be set on mobile domain
On the Selenium daily job, there are 2 domains -
https://en.wikipedia.beta.wmflabs.org
and
https://en.m.wikipedia.beta.wmflabs.org

Currently the cookie gets set on the former, meaning it doesn't work
This should take care of this, while also accounting for running the
browser tests (as we do in the zuul runs) in a single domain

Bug: T219920
Change-Id: I54838fb8aba559c4d72c444968493dff2de9b4f9
2019-04-10 16:34:01 +00:00
jdlrobson 377a899b12 QA: Do not use local paths for page objects
These will not run in the daily build!

Change-Id: I10c6c083949c043779b9ceca70d27fc0a303c39a
2019-04-10 00:30:11 +00:00
jdlrobson 6918c70780 QA: Remove test that has been ported to Node.js
Follow up to Iad954405a5ae0608fd5dc90dd5dfa434b3781037
This test now lives in tests/selenium
It should be removed as we don't want to run this test twice.

Change-Id: Idc99ffdf0fedf65d46095a77a0066c5eef95c960
2019-04-09 04:53:57 +00:00
Jan Drewniak 26e413e04d Adding initial webdriver.io test
Porting first selenium test from Ruby to Node.js using the
mocha framework. Starting with `category.feature` test.

Tests are placed in a new `tests/selenium` folder with their
own eslint config.

Bug: T190710
Change-Id: Iad954405a5ae0608fd5dc90dd5dfa434b3781037
2019-04-08 16:05:22 -07:00
jenkins-bot 1df9ad70df Merge "build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0" 2019-04-04 18:15:33 +00:00
James D. Forrester 75a751f1c6 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I36a88cbf8b468646c21d47c3b58433895e8ff31a
2019-04-04 18:01:40 +00:00
jdlrobson 0be05950af Desktop should use AMC mode
To help us test special pages prior to moving them on mobile it
would be useful to make AMC the default on desktop
where the special page override does not exist

This is also probably what editors on desktop using the Minerva
skin want out of the skin.

On top of this, add an amc class to the body tag so we can
target styles at AMC and/or non-AMC users

Change-Id: I7f3141bae71181131ae4878fd21fb6ff4322c8ca
2019-04-04 17:43:12 +00:00
jdlrobson d13959b8b5 QA: Disable some essential tests because no other options
These tests fail as the log_in step seems to be broken in the Ruby
Selenium gem. Disabling these makes it possible to merge code at
the cost of lowering test coverage and risk of regressions.

I'm hoping for help from RelEng to get these restored promptly

Bug: T219920
Change-Id: I8e0883e8988293828801be2769db88ac244cb866
2019-04-03 22:09:21 +00:00
jdlrobson 71f6e5519a Use getSingleton in OverlayManager tests
Simplifies the tests by making sure they don't need to know
about how OverlayManagers are created.
Change-Id: I38174d1c2d32290d2b1fde4340a85e362e5c102b
2019-03-19 19:17:04 +00:00
Stephen Niedzielski 88dd2530e7 Update: don't prompt to create User pages
Suppress the redlink drawer for User namespace pages. The redlink drawer
prompts the user to create a missing page but this hinders the usual
workflow for User page visits specifically. A User page is connection to
an account's contributions, age, and other activities and encouraging
the creation of a missing User page when trying to view these
connections is a hindrance, especially if the missing User page is not
associated with the current user.

Bug: T201339
Change-Id: I784493a8ecf28176b5a393cb52d7bfa9fa9b1309
2019-03-19 18:07:32 +00:00
jdlrobson 4b4e9d6399 Minerva should use the MobileFrontend eventBusSingleton
The talk overlay is created inside MobileFrontend, but the
overlay for creating a new talk overlay is here.

The two need to speak to either other - in particularly, the create
talk overlay must invalidate the current talk page before returning
the user to the former.

In preparation for the refactoring changes in MobileFrontend, the
same object is shared and the cache invalidation is moved here since
Minerva creates and manages the PageGateway instance that is given
to the talk overlay.

Additional change:
* Update a selector broken by changes in
I8c34646b7ba13a26facbb69684e65109870d27a1

Bug: T217102
Change-Id: I212ff044c4c608c6ea60a5fda043166cd434ec1f
2019-03-06 12:33:36 -08:00
Jan Drewniak 99aa7a28a4 HYGIENE: Remove element nav selector from mainmenu.less
The top level `nav` CSS selector (combined with the nested element
selectors, i.e. `nav ul li a`) represent a general DOM structure
which is not limited to the navigation menu and can interfere with
other styles.

This replaces the `nav` selectors (which have only been used to select
the main navigation) with a `#mw-mf-page-left` selector instead, since
that represents the main navigation as well.

Change-Id: I047108974fd295f196d9f7150c3721c05ac40c6d
2019-02-27 15:01:08 -08:00
jdlrobson 7fd843cd89 Fix talk overlay workflow
The talk overlay must subscribe to the creation of new topics
so that the list of topics in the talk overlay contains the
newly created topic. It does this by subscribing to the
talk-discussion-added event and forcing a route refresh when that
has completed.

Additional changes to browser tests:
1) QA: CSS selector changed for talk overlay
Since I42fd7b08c4b9d92dee549d06de8a0012ea037d28 the '.add' class
was removed from the talk button. This makes the browser test fail
but is a false positive.

2) One of the browser tests was using the same selector to mean
two different elements - the add discussion button in the talk overlay
is now clearly distinguish from the "add discussion" button that is blue
and appears at the bottom of talk pages

Change-Id: I935b3c5f37baf242c06585ae0e2f13d059b9c324
2019-02-25 14:14:53 -08:00
Stephen Niedzielski 2380e78f88 Hygiene: fix pageIssues QUnit test name
"cleanuptemplates" was the old page issues module name. The new name is
"pageIssues". Update the test module name.

Change-Id: Ie31e4d1548918463f6e33429ded3abc4bfb08dff
2019-02-21 11:41:26 -07:00
Stephen Niedzielski 7d4ca12a2e Hygiene: remove unused page issues function
Remove getAllIssuesSections(). This is no longer in use and does not
appear to be sufficiently general purpose to want to maintain.

Bug: T212371
Change-Id: I7ed73408705cba64b26dd318e78ae415b707e687
2019-02-13 01:34:32 +00:00
Stephen Niedzielski f54b4e75db Hygiene: move variable from file to local scope
Move allIssues from file scope to local scope.

Bug: T212371
Change-Id: I74693925ff0b20a36ec6acd53490cfde7273c984
2019-02-13 01:33:04 +00:00
Stephen Niedzielski 3dc9cff2c2 Hygiene: separate page issue view logic
- Move page issue view components that do not modify the DOM during
  during construction to PageIssueLearnMoreLink.js and PageIssueLink.js.
  PascalCase is used optimistically for filenaming in the hopes that
  these functions can become something like a JSX component. A "new"
  function prefix is used in the meantime.

- Move page issue view logic that munges the existing DOM to
  pageIssueFormatter.js. Substitute "create" prefixes for insert so that
  clients won't forget that calling the function is a modify operation.
  Alternative naming welcome but it shouldn't be confused with more
  idealistic components that do not depend on DOM state for
  construction.

- Consolidate createPageIssueBanner() and
  createPageIssueBannerMultiple() into insertPageIssueBanner() as the
  code was quite similar and were it a true component, it would probably
  be a single component.

All new files appear under page/ to keep their distinction from the
overlay code clear.

Some view logic remains in pageIssues.js but it shall be difficult to
isolate.

Bug: T212376
Change-Id: Iccce709c34fa8de5a28a5a00098add5775e3dc9a
2019-02-13 00:42:56 +00:00
jenkins-bot 42238a6be5 Merge "Hygiene: replace deepEqual tests with propEqual" 2019-02-08 00:02:55 +00:00
Stephen Niedzielski 118f4df828 Hygiene: replace deepEqual tests with propEqual
Replace QUnit deepEqual() assertions with propEqual(). The former is a
recursive == check, the latter is a recursive === check which seems
preferable.

  find tests -name \*.js|
  xargs -rd\\n sed -ri 's%deepEqual%propEqual%g'

Change-Id: I977244d24c47072cc62b7d9fc797505a5f39aa54
2019-02-07 14:55:36 -07:00
Stephen Niedzielski 5593b23aa8 Hygiene: replace mobile.startup/paths with props
Replace all occurrences of `M.require( 'mobile.startup/pathToModule' )`
with `M.require( 'mobile.startup' ).pathToModule`. Where multiple
requires existed, add an intermediate variable,
`var mobile = M.require( 'mobile.startup' )`, and dot off that.

This changes improves the consistency of MinervaNeue which currently
contains a mix of require styles and eliminates any deprecated requires.

Bug: T208915
Change-Id: If14f280672d914d07275197100b12421bb217b67
2019-02-07 14:55:04 -07:00
jenkins-bot 74a37b0412 Merge "Hygiene: revise lazyImageLoader.loadImages() API" 2019-01-25 20:52:49 +00:00
Stephen Niedzielski 0ce4fa8a66 Hygiene: revise lazyImageLoader.loadImages() API
There is no longer a need to pass in a jQuery dependency.

Don't use the stateful skin to query image placeholders. Use the lazy
image loader instead.

Depends-On: I3d023b3d96bf278666abb956142e5cee12b68b1f
Bug: T214658
Change-Id: I2bf42366c0e27462c32162124d07761b91d66166
2019-01-25 10:50:09 -07:00
Ed Sanders 63ead8075d build: Update eslint-config-wikimedia to 0.10.0
* Add inline exceptions for global selectors
* Exception for $.animate in scrolling code
* Fix $ prefixing in search.js
* Fix repeated selectors in search.js & toc.js
* Disable no-parse-html-literal in tests

Change-Id: Id58fe11d1e09714501a378e4ca7ed9588f02f32d
2019-01-24 17:59:40 +00:00
Ed Sanders 6c53e320bf eslint: Remove exception for computed-property-spacing
Change-Id: Ief22145c02379bdb3d37c96c5e1ef50f0ab519cf
2019-01-24 17:58:36 +00:00
jdlrobson db96b68d81 QA: Cleanup page issues browser test
* The check for whether the page issues code has been loaded should
be run just before clicking the banner. It's in the wrong place.
* Now page issues is live across all wikis, no need for "in beta"
check
* Seledctor can be simplified now no need to worry about beta
Change-Id: Ie24a9d9fc1966ca5db2cd0a6a37c1aa6d719924a
2019-01-22 19:47:02 +00:00
Stephen Niedzielski d1a20753fa Hygiene: revise lazy image loading API
Update the API usage for lazily loaded images. This is still clumsy and
may be further revised in future patches.

Bug: T211724
Depends-On: Ic73f78825eaab561e8ed694aa6cc102ccb471f95
Change-Id: Ia708cda688e6bdb12074d85d98f7e98fdf7b0ca8
2019-01-17 20:45:23 +00:00
jdlrobson 6d243c1df0 QA: Page Issues browser test should wait till JS has finished loading
Clicking the page issue banner (which is ready from first paint to
be clicked) will not yield the overlay. The user must wait for the JS
to load. Likely the reason for Minerva browser test failures against
beta cluster.

Change-Id: I06c488ca64dd44ad24368a1d6b47bb2646ad4552
2019-01-16 11:43:02 -08:00
jdlrobson b247beef3c QA: Run page issues browser test in beta
The test is failing in stable. Since page issues is going to production
next week this patch can be reverted as soon as that has happened

Change-Id: Idd8de17883006e3cc5f5615781a54a4072a78087
2019-01-15 10:08:05 -08:00
jenkins-bot 9e9442ecfc Merge "Constraint page issues CSS selector" 2019-01-09 01:11:04 +00:00
jdlrobson cb2634a78b Constraint page issues CSS selector
The 2 selector approach is flawed as the .ambox element matches a
hidden element in the old treatment which is not clickable.

I suspect this change will fix the failing browser test on the beta
cluster. Integration tests will continue to test the new selector
in the mean time.

Change-Id: I44a873b2e89069c4a47a428c528592159520568c
2019-01-08 20:23:37 +00:00
Stephen Niedzielski 672df850cb Hygiene: revise A/B test terminology
Improve the comments and APIs provided by AB.js:

- Control becomes unsampled.
- A becomes control.
- B becomes treatment.

This code does not appear to be in use presently, so it's a great time
to change it.

Change-Id: I31d619f889ee45102a4aed774a6ec41f0d95ba7d
2019-01-08 15:08:50 +00:00
jenkins-bot 9258806a0f Merge "pageIssuesOverlay is a factory function that returns an Overlay" 2019-01-04 15:39:48 +00:00
jdlrobson d29eca2bc8 pageIssuesOverlay is a factory function that returns an Overlay
This experiments with making PageIssuesOverlay an Overlay with
various options.

The appending of children is a little messy and points at a need
to standardise this some way
(see https://phabricator.wikimedia.org/T209647)

TODO:
* Remove the iconString property on PageIssueSummary which is no longer
needed

Bug: T209647
Change-Id: Iadd798a820dca6bbb31edc9a8570b6db7aac237a
2019-01-03 08:31:39 -08:00
jdlrobson c73ff1f7a5 Composition: DownloadIcon
The DownloadIcon is reduced to a factory function that
returns an instance of Icon

Depends-On: I4d703eef68d51bbe0b03579c5cca0845e17b8c9d
Depends-On: I4a4129b2cac7c7c49559beef0b8780f3211edf9c
Bug: T205592
Change-Id: Ib87390d17bef6f50842f52cd84c9ce2b162aaff0
2019-01-02 13:16:09 -08:00
Nicholas Ray 5bfd949f9a Remove usage of global event emitter from Minerva
This patch removes the remaining usages of M.on/M.off/M.emit
(functionality derived from moduleLoader.js in MobileFrontend) in
Minerva and continues the work of
Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 (patch for MobileFrontend).

This patch and the patch for MobileFrontend should be merged together as
they both depend on eachother.

Depends-On: Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2
Bug: T156186
Change-Id: I005d2fcdbf91c2f1ac98178dfa388aa8174e7530
2018-12-06 19:30:09 -07:00
jdlrobson c31da9a236 QA: Drop protected page test
* On commit it needs admin rights which it doesn't have
* On browser tests the toast flakes too much.

Bug: T208808
Change-Id: I1fa93c8f451f3f839030fa7a144b1cb285c4239d
2018-11-29 16:51:04 -08:00
jdlrobson f055f8d789 Drop toast tests from beta cluster
Given the fade in/out animation of the toasts and the instability of
the beta cluster and the round trips to Sauce labs, we're seeing lots
of false positives on our browser test reports

Running these per commit should ensure we see minimal regressions and
get some protection. We'll continue to test other scenarios which do not involve
the toast on beta cluster.

Provided we can rely on green browser tests, we will trust the browser
tests more and they will be more useful than they currently are.

Bug: T208808
Change-Id: Idc601ad462de36f2d6d52fe951194b429e6f824f
2018-11-29 16:40:02 -08:00
jdlrobson 0a41aa53ca QA: Browser tests should limit write operations
We use lots of write operations in Minerva browser tests. On the beta
cluster many of these are redundant, as the page already has the content
required or the page already exists

Limit where we do our creation... the less write operations we make the
more stable we can expect these browser tests to be.

Change-Id: If88b878e14bf4a0424fcf23213653cfc2cf8d87b
2018-11-29 07:34:41 -08:00