mediawiki-skins-MinervaNeue/tests/selenium/features/step_definitions/notification_steps.js
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

33 lines
1 KiB
JavaScript

const ArticlePage = require( '../support/pages/article_page' );
const { iClickTheOverlayCloseButton, iSeeAnOverlay, iDoNotSeeAnOverlay } = require( './common_steps' );
const iHaveNoNotifications = () => {
ArticlePage.notifications_button_element.waitForVisible();
// This is somewhat hacky, but we don't want this test making use of
// Echo's APIs which may change
browser.execute( '$( function () { $( ".notification-count span" ).hide(); } );' );
};
const iClickOnTheNotificationIcon = () => {
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.scripts' );
ArticlePage.notifications_button_element.click();
};
const iShouldSeeTheNotificationsOverlay = () => {
iSeeAnOverlay();
};
const iClickTheNotificationsOverlayCloseButton = () => {
iClickTheOverlayCloseButton();
};
const iShouldNotSeeTheNotificationsOverlay = () => {
iDoNotSeeAnOverlay();
};
module.exports = {
iHaveNoNotifications, iClickOnTheNotificationIcon,
iShouldSeeTheNotificationsOverlay, iClickTheNotificationsOverlayCloseButton,
iShouldNotSeeTheNotificationsOverlay
};