Commit graph

286 commits

Author SHA1 Message Date
jdlrobson bf8d325388 Use core watchstar code
Apply the mediawiki core watchstar to the
Minerva skin. Note, watchstars in search and other locations will
continue to be provided by the MobileFrontend library (see
follow up patch I7b748dc87089389400b0035c62a3b9a00c2e43f9)

Bug: T234970
Change-Id: I11bbe976412b50dba76a55f37887e4c9235d0be1
2019-10-15 15:33:25 -07:00
Edward Tadros b9af3c8844 Temporarily fixed waitForPropogation.
Replaced waitForPropagation code with a browser.pause because the
time delta computation was not working propertly. This will be changed
with a more dynamic sync operation in the future.

Bug: T224947
Change-Id: I30bd7969e4c2c691622fd63c6f88aadadb8065e9
2019-10-11 16:12:53 -07:00
James D. Forrester e8d227b78e build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: I8ce5f16f496f048f6bcf587c545745193dbfe151
2019-10-11 12:04:00 -07:00
jdlrobson ab61dbb173 Echo is removed from Minerva
Managing the transition from old implementation to new:
* A version number is exported from skins.minerva.scripts to
tell dormant code added to Echo in I09c27a084100b223662f84de6cbe01bebe1fe774
to begin running.
* A skinStyle is added for the new `ext.echo.mobile` module.
`mobile.notifications.overlay` will soon cease to exist but is kept registered for
backwards compatibility reasons
- Drop ev.preventDefault call from onSkinClick - it is no longer necessary and will ensure
notifications overlay closes when shield is clicked while it is open.

Integration:
* A server side hook SkinMinervaReplaceNotificationsBadge allows Echo to replace
the current Minerva notification badge
* A to-be-created client side hook is subscribed to to deal with the navigations drawer
like functionality using the mainMenu code
* id and class names are added to the container for the NotificationBadge for compatibility with
ext.echo.init in Minerva's desktop mode (it will work like Vector)

See I09c27a084100b223662f84de6cbe01bebe1fe774 for understanding the bigger
picture.

Depends-On:  I09c27a084100b223662f84de6cbe01bebe1fe774
Bug: T221007
Change-Id: I4c11f1b241d629e1b294ebaec17472fbf944f8c7
2019-10-08 23:21:12 +00:00
jenkins-bot 09c915ddc0 Merge "Render main menu and shield on server side" 2019-10-04 20:43:20 +00:00
jdlrobson e72c0d7ba4 Render main menu and shield on server side
This is a second attempt at I3892afb5ed3df628e2845043cf3bbc22a9928921
that is cached HTML friendly and won't cause T234599.

This time rather than solving the entire problem, we'll start rendering
the menu on the server, to allow us in future to drop the Menu code

Bug: T234650
Change-Id: Iea5406ef1c561f2907ec6132481007673aabf1e9
2019-10-04 19:35:28 +00:00
Ed Sanders d54798ec6b build: Update eslint-config-wikimedia
Change-Id: Id14552b5663340ffc1e2ae02599a1df99685e464
2019-10-04 15:28:49 +00:00
Jdlrobson 93b16db1c5 Revert "MainMenu is a controller not a View and server rendered"
This reverts commit 111757970e.

Although I cannot replicate the performance issue, the menu doesn't seem to be rendering at all on cached HTML so this is a deal breaker. Back to the drawing board..

Bug: T234599
Change-Id: Idadc5a079340f44ec66d20a38259b6b337d2dcee
2019-10-04 15:03:19 +00:00
jdlrobson 111757970e MainMenu is a controller not a View and server rendered
As Stephen pointed out somewhere, this is a bit of a micro-optimisation
Let's simplify this code by always rendering it in the HTML. MainMenu.js
as a result becomes a controller that just decides when to show it.

The geolocation check for Nearby is removed given the fact that all
grade A browsers for mediawiki have Geolocation support

Additional changes
* Browser support suggests "animations" class is redundant now
* `open` event no longer filed - not being used anywhere
* Transparent shield is now managed by the MainMenu controller not
the skin (which was confusing)
* Test geolocation using a simple feature tests
rather than abstracting it away inside Browser
* The main menu button is always hidden under either a translucent shield
and/or the main menu itself when it has been opened
so so it's not possible to ever click it while the menu is open
 - the click handler is thus simplified
removing a check for the class of the button

Depends-On: I7fd243366cceae780bd46e1aef2c08dae073f647
Change-Id: I3892afb5ed3df628e2845043cf3bbc22a9928921
2019-10-03 13:13:09 -07:00
jenkins-bot 27f9422613 Merge "Curtail use of mw.mobileFrontend in Minerva" 2019-10-02 00:10:40 +00:00
Ammar 6a0192bf37 Remove "uploads" link from userpages
*This commit also removes it from tests and references

Bug: T233985
Change-Id: I0d7eb72a2663f1d1138afe09124a154ad0502498
2019-10-02 00:11:13 +01:00
jdlrobson ef5003f310 Curtail use of mw.mobileFrontend in Minerva
The MobileFrontend dependency in Minerva is problematic.
Code that Minerva needs should live in core.
MobileFrontend should load code on all skins when they operate on
a mobile domain.
This eslint check reminds developers of this in a hope it encourages
more upstreaming to core when possible.
Of course disabling is also an option, but this check will at least
make us aware of when we are moving further away from the goal.

Change-Id: I62183c9aefc81053e4ad81fb746decef2dd24b44
2019-10-01 14:54:59 +00:00
jdlrobson 7eb2e3bd07 Notification icon doesn't show to non-JS users
If JS is disabled and you are logged in, no icon shows.
Icon class is incorrect.

I also update the test.

Change-Id: I786ced58171f4ffb4a9d75dcfc6f993647399065
2019-09-30 14:38:59 -07:00
Jan Drewniak 51049c0ceb Refactor "last-modified" bar to use flexbox layout.
Brings the last-modified toolbar (links to history page at the bottom
of articles) in line with recent icon changes. Removes the icon
class from the toolbar itself and by employing a flexbox layout,
reducing the amount of CSS required for this toolbar.

Bug: T233172
Change-Id: I27658477aaeed3290aced844caa64fc5e1c34fbd
2019-09-27 00:03:14 +00:00
jdlrobson e888b487f4 Merge skins.minerva.talk and skins.minerva.watchstar into skins.minerva.script
Logic is moved from server to client. Config is added via getSkinConfigVariables (e.g.
passed to mw.config ) and a JavaScript if statement.

The IIFE in watchstar and talk files is replaced with a module.exports function to avoid
refactoring at this point and added risk. The file contents remain the same.

skins.minerva.options is left as is, given the code is more experimental and used in
the beta mode - should not be sent to all clients.

Additional change:
* Remove skins.minerva.toggling (that module has been empty for a week now and functionality
moved to mobile.init module)

Depends-On: Ie71adbe18e8dbeb661ddb9d7d3d1d0897891d515
Bug: T233048
Change-Id: Ife777e76d9d77894fb5d09e7c8f0238b00596a7a
2019-09-24 14:19:18 -06:00
jenkins-bot 1dd359d824 Merge "Migrate from onResourceLoaderTestModules to QUnitTestModule" 2019-09-23 18:37:46 +00:00
jdlrobson 6e71367168 Update Minerva watchstar browser test
Change-Id: I31bff635c3f122c89690a364201ba08c8755e409
2019-09-20 22:36:40 +00:00
Timo Tijhof 30c12b3ddd Migrate from onResourceLoaderTestModules to QUnitTestModule
The hook is deprecated as of this release cycle, see:
<https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules>.

Moving away from PHP code. This can now be done from JSON, and
encourages use of a single module that is automatically named and
registered as needed.

Change-Id: I382692c70ca8e5f5ea658b07ebea6c47dd541724
2019-09-20 22:14:56 +00:00
Ed Sanders 8e579c373b build: Update linters
Change-Id: Ie0983466ad0eed0a30d62f28b10efebd0f2eacba
2019-09-17 14:21:30 +01:00
Jan Drewniak 73e87fdc08 Align right-most header icon with content.
uses the CSS :last-child selector to align the last item in the header
with the edge of the container.
This is usually the notification icon in "normal" mode and
the user menu icon in AMC mode.

Bug: T229440
Change-Id: I4430f5659093f76896e2b86e076526a0b51d9630
2019-09-16 11:05:36 +02:00
Jdlrobson 9ec7217d47 Merge "Adjust notification icon to be the same size as the other icons" 2019-09-13 21:53:37 +00:00
jdlrobson 109b24e0ee Adjust notification icon to be the same size as the other icons
Bug: T232011
Change-Id: I0300685d38551bc9ee2c2bd32d6348f32d4df4de
2019-09-13 13:55:01 -07:00
Jan Drewniak 35e489de25 Fix truncated text showing through icons & last-modified bar
To accommodate for cached HTML a new class last-modified-bar__text
replaces last-modifier-tagline to help us distinguish between old
out dated HTML and the new HTML.

Bug: T232792
Bug: T232800
Change-Id: I53fa45058dbc81c91089840073e03113ff1a4b9c
2019-09-13 18:35:31 +00:00
jdlrobson c0f08790ea Remove the mw-ui-icon hacks and overrides
Note: this agitates T230232 again - when merging this please
make sure a merge for I929090848f3e04647a97f4979ec78682623fa070
is pending.

In various places we try to override the default mw-ui-icon behaviours
The hacks need to be removed as part of addressing the core problem.

Changes:
* Wherever we use mw-ui-icon-before in PHP - wrap the label with a span
so that label font-size is altered where needed - not the icon
* Where a small icon is needed us isSmall parameter for the Icon component
* Apply font-size to labels of mw-ui-icon-before elements
* The browser tests need a slight update to access the span element inside
a menu item - in the case of the logout button the label is always hidden,
so we need to check the visibility of the parent element (secondary_action)

Bug: T229440
Depends-On:  I3f803ec4c9068b30aa93b803391aa4d65d8310ff
Change-Id: I07e4ae233979636b739f1117dd7703571e0a9366
2019-09-10 10:53:20 -07:00
jdlrobson 497044290a MobileFrontend is now managing the toggling code. Remove.
Depends-On: I6bdeb7198082c4b1d0a32960cc4dc679ff4c6762
Change-Id: I1815a730fc12f68c287d58f2de6f92e05db3abd2
2019-09-06 15:50:00 +02:00
Stephen Niedzielski fcf1deb9de [dev] [edit] rename EDIT permission to CONTENT_EDIT
The Minerva permission manager distinguishes between user edit
permissions and content model edit support. Rename EDIT constant to
CONTENT_EDIT to help clarify the distinction.

The resolved name in skin.json is not updated to avoid deprecation
policy.

Change-Id: If86b8b5cd9d04ec2881931a3b629bc50e1dd9252
2019-09-04 19:29:38 +02:00
jenkins-bot 7671df359e Merge "[edit] [UI] hide edit section links for blocked users" 2019-09-04 16:56:29 +00:00
jenkins-bot 76897f3b1d Merge "Use core table of contents in Minerva" 2019-09-03 21:03:32 +00:00
Stephen Niedzielski 54060a3cc4 [edit] [UI] hide edit section links for blocked users
When a user is blocked, only present the "locked" page edit link. Omit
the section edit links entirely.

The logic for checking user permissions already existed in
ToolbarBuilder. Move this logic to MinervaPagePermissions and add a new
"EDIT_OR_CREATE" action distinct from IMinervaPagePermissions::EDIT.
These names will be revisited in a following patch.

Bug: T206265
Change-Id: Ia43a670a259cabc313c004fe06c91e078bd41562
2019-09-03 22:29:43 +02:00
jdlrobson a93656e491 Reflect terser labers
Follow up to I3cac0e231e254755dc2618e1c2d3b4aef2758c67 which broke
these browser tests

Bug: T226562
Change-Id: Ie2709efe8e3d588d506c2a16e807c517621e4fbb
2019-09-03 19:08:53 +00:00
jdlrobson 15323b3d63 Use core table of contents in Minerva
No more using the TableOfContents component in MobileFrontend. It's
just creating more work for us. The end result is exactly the same - we can make
a table of contents using the checkbox hack rule and CSS that looks identical to
the current table of contents.

For now, this change can only be tested on Minerva desktop.
I2ea1c23bc86871e2a095c4c6674a08ff2f04b160
is the patch that goes for the jugular and applies this to mobile Minerva. It's
important we merge the two together to avoid disruption to this feature, as
currently MobileFrontend strips the table of contents from core from the HTML
using the MobileFormatter.

Change-Id: I720e62a578f0c7a14f4b5a698004471c85e54bc8
2019-09-03 19:02:31 +00:00
jenkins-bot a75049f4b4 Merge "Track all menu interactions" 2019-08-27 10:01:47 +00:00
Piotr Miazga c5f38e466d Track all menu interactions
Changes:
 - added support of event-data-name to toggle list and all menu
 entries
 - track main menu open actions
 - prefix all menu interactions with `menu.`
 - prefix menu opening with `ui.`
 - track tab clicks (also a part of new ui)
 - track notification icon clicks

We're not tracking the Download icon as it has it's own
instrumentation.

Bug: T220016
Change-Id: I442103c1f8967c6710429329f024f266c9b11ea6
2019-08-26 11:43:16 -07:00
jdlrobson 9150aec131 Feature flag overhaul
Two new feature flags:
1) MinervaPersonalMenu
2) MinervaAdvancedMainMenu

Changes:
* AMC defaults to false on desktop - desktop doesn't have AMC mode it just
enables several skin options.
* WHen inserting a link at the bottom of the page check whether the talk at top
of the page (tabs) is enabled.. not AMC
* Update ServiceWiring to construct menu based on MinervaAdvancedMainMenu
and  MinervaPersonalMenu - note when former is enabled but not latter there is
no way to logout. Noted in README.
* Use one entry point for skins.minerva.amc.styles/index.less
* Document files inside skins.minerva.amc.styles to make it clear which features
they are associated with
* Drop history page styles when AMC is disabled - it's not possible to ever get to
these as the history page redirects in non-AMC mode
* Rename the class .minerva--amc-enabled to minerva--history-page-action-enabled
to reflect its real purpose and move styles from skins.minerva.base.styles to skins.minerva.amc.styles
No need to worry about cached HTML as AMC runs without cache...
* Remove isAnyAMCOptionEnabled - it's an antipattern and should be discouraged as it discourages the
art of feature flagging. Nothing is using it after these changes.
* The AMC_MODE flag is disabled. There is no need for this - AMC is not a feature and therefore not a
skin option. It is a mechanism for turning on other skin options. Tests are updated.

Testing:
It should now be possible to enable any feature in `beta` and see it in the beta of the
site.

Bug: T229295
Change-Id: I48959905f5c09721b14a27aa1a5ad82849ac6263
2019-08-23 10:48:14 -07:00
Stephen Niedzielski bfdfc1165c [UI] [menu] slide the main menu over the page
Slide the main menu over the page instead of sliding the page over the
menu. Also, use viewport units for the main and notification menus.

Note, this lays foundation work for T225213.

Bug: T206354
Change-Id: I14b67d1e97b84086ea13e28df8148824a1f493e3
2019-08-12 18:22:45 +00:00
jdlrobson 9aae174a15 AMC features should default to true in desktop
It is expected that in mobile mode, onRequestContextCreateSkinMobile
hook will explicitly set skin options based on the user configuration.

The desktop should however reflect everything with AMC enabled.

Bug: T229295
Change-Id: Ib3bf09c25d9bcf9b31d994b92a1d016cca8a6224
2019-08-01 18:04:00 -07:00
jenkins-bot 721e63f19f Merge "Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions" 2019-08-01 19:55:08 +00:00
Piotr Miazga 4efd72a879 Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions
Additionally, renamed couple options for better readability.

Bug: T221012
Change-Id: Ia347a60d469fba8f35afa7c70aa806a46271dccd
2019-08-01 10:34:03 -07:00
jdlrobson a0e5139e40 Don't show download button on missing pages
Additional: Pass in a page rather than a skin - skin is not
used anywhere other than to get the page

Bug: T211775
Change-Id: Ia7c56158773ac16992fb1ebf002131e9c24dda14
2019-08-01 16:11:57 +00:00
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