mediawiki-extensions-Echo/tests/browser/features/support/pages/article_page.rb
Moriel Schottlender 8b2c6355cc Add browser test for notifications in Echo
This browser test checks that mentions go to alerts and talk page
messages go to messages popup. This also upgrades the MW-Selenium
version in Echo tests to 1.6.1.

Depends on MW-Selenium version 1.6.1 (See T114061)

Bug: T113081
Change-Id: I40a17500cdfb838420c04dc0b9268ba56515cc2c
2015-10-04 22:23:51 -07:00

40 lines
1.7 KiB
Ruby

# Page Object describing Headings, Flyouts, and Overlay in Echo
class ArticlePage
include PageObject
h1(:first_heading, id: 'firstHeading')
li(:notifications_alert, css: '#pt-notifications-alert')
li(:notifications_message, css: '#pt-notifications-message')
link(:notifications_badge_alert, css: '#pt-notifications-alert a')
link(:notifications_badge_message, css: '#pt-notifications-message a')
div(:popup_alert,
css: '#pt-notifications-alert .mw-echo-ui-notificationBadgeButtonPopupWidget-popup')
div(:popup_message,
css: '#pt-notifications-message .mw-echo-ui-notificationBadgeButtonPopupWidget-popup')
link(:notifications_badge_alert_unseen,
css: '#pt-notifications-alert a.mw-echo-unseen-notifications')
link(:notifications_badge_message_unseen,
css: '#pt-notifications-message a.mw-echo-unseen-notifications')
# Popup elements
button(:mark_all_read_button, css: '.mw-echo-ui-notificationsWidget-markAllReadButton')
def popup_title(popupElement)
popupElement.when_present.span_element(
css: '.oo-ui-popupWidget-head > .oo-ui-labelElement-label')
end
# Notification elements
a(:notification_option, css: '.mw-echo-ui-notificationOptionWidget')
a(:notification_option_unread, css: '.mw-echo-ui-notificationOptionWidget-unread')
a(:notification_option_markRead, css: '.mw-echo-ui-notificationOptionWidget-markAsReadButton')
def num_unread_message_notifications
# Count the number of elements that are unseen notification divs
# Taken from http://stackoverflow.com/questions/6433084/how-to-get-the-number-of-elements-having-same-attribute-in-html-in-watir
browser.elements(
css: '.mw-echo-ui-notificationOptionWidget-unread.mw-echo-ui-notificationOptionWidget-message'
).size
end
end