mediawiki-skins-MinervaNeue/tests/selenium/features/support/pages/article_page.js

46 lines
2 KiB
JavaScript
Raw Normal View History

/**
* Represents a generic article page
*
* @extends MinervaPage
* @example
* https://en.m.wikipedia.org/wiki/Barack_Obama
*/
'use strict';
const MinervaPage = require( './minerva_page' );
class ArticlePage extends MinervaPage {
get contributions_link_element() {
return $( '.page-actions-menu .menu__item--page-actions-contributions' );
}
get watch_element() { return $( '#ca-watch' ); }
get reference_element() { return $( 'sup a' ); }
get drawer_reference_element() { return $( '.drawer sup a' ); }
get talk_tab_element() { return $( '.minerva__tab-container a[rel="discussion"]' ); }
get talk_element() { return $( '.talk ' ); }
get mask_element() { return $( '.mw-mf-page-center__mask' ); }
get drawer_mask_element() { return $( '.drawer-container__mask--visible' ); }
Render talk page as a tab instead of an overlay Following up on Jon's POC, this will get rid of the talk board component in favor of linking to the server rendered talk page. Additional Changes: * Cleaned up talk selenium tests. Removed talk_steps.rb which doesn't appear to be used anymore. * Changed talk add button classes to a single class * Moved "Add discussion" button to postheadinghtml per design mock * Added "...talk-explained", "...talk-explained-empty" messages to postheadinghtml per design mock * Due to undesirable jumps in window scroll caused by the section anchor & Toggler.js code when opening the TalkSectionOverlay (read fixme in code), a Promise is always returned from OverlayManager route to reset the scroll position to the top when the section overlay is opened. * Moved "mobile-frontend-talk-fullpage", "mobile-frontend-talk-reply-success", "mobile-frontend-talk-topic-feedback", "mobile-frontend-talk-explained" "mobile-frontend-talk-explained-empty" messages to minerva as minerva is the one who initiates those messages now. * Limited $talk selector to only `.talk` elements since amc talk tab does not need to be targeted * After saving a reply from TalkSectionOverlay, the DOM that is not part of the overlay becomes out of sync since a new reply was created. To get around this, an `onSaveComplete` callback was passed (similar to the TalkSectionAddOverlay) to execute a full page refresh. Although this is clunky, it is the easiest way to resync. Bug: T230695 Depends-On: I80201394fd7015db6700446142b0b4b20829f12e Change-Id: I243f1193bce0da9fa710fc3b5379f90b2d079680
2019-10-17 22:46:07 +00:00
get talk_add_element() { return $( '.minerva-talk-add-button' ); }
get first_section_element() {
return $( '.section-heading' );
}
get watched_element() { return $( '.mw-ui-icon-wikimedia-unStar-progressive, .mw-ui-icon-mf-watched' ); }
get menu_button_element() { return $( '#mw-mf-main-menu-button' ); }
get search_icon_element() { return $( '#searchIcon' ); }
get menu_element() { return $( 'nav' ); }
get user_links_element() { return $( '.user-links' ); }
get notifications_button_element() { return $( '#pt-notifications-alert' ); }
get drawer_element() { return $( '.drawer' ); }
get edit_link_element() { return $( '#ca-edit' ); }
get first_heading_element() { return $( 'h1.mw-first-heading' ); }
get notification_element() { return $( '.mw-notification-area .mw-notification' ); }
get overlay_heading_element() { return $( '.overlay-title h2' ); }
get overlay_category_topic_item_element() { return $( '.topic-title-list li' ); }
get red_link_element() { return $( '#mw-content-text a.new' ); }
get is_authenticated_element() { return $( 'body.is-authenticated' ); }
get last_modified_bar_history_link_element() { return $( 'a.last-modified-bar__text[href*=\'Special:History\']' ); }
}
module.exports = new ArticlePage();