import { Button, Input, Label, WebElement } from '@contour/fet/lib/elements'; import { ContourBasePage } from '../../base/basePage'; import { P2P_SPECIAL_VALUE } from '../../enum/p2p'; import locator from './p2pMessageListing.locator'; export default class P2PMessageListing extends ContourBasePage { constructor(url?: string) { super(locator, url); } getNewButton() { return new Button(this.getLocatorAsString('newButton')); } getSearchButton() { return new Button(this.getLocatorAsString('searchButton')); } getSearchInput() { return new Input(this.getLocatorAsString('searchInput')); } getMessageBySubject(subject) { return new WebElement(this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject)); } getListedMessageChildSubject(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildSubject').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) ); } getListedMessageChildSentDate(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildSentDate') ); } // getListedMessageChildLastSender(subject) { // return new Label( // this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + // this.getLocatorAsString('listedMessageChildLastSender') // ); // } getListedMessageChildLastSender(subject, senderName = null) { if (senderName) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildLastSender').replace(P2P_SPECIAL_VALUE.COMPANY_NAME, senderName) ); } else { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildLastSender') ); } } getListedMessageChildDeliveredMessageCount(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildDeliveredMessageCount') ); } getListedMessageChildPendingMessageCount(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildPendingMessageCount') ); } getListedMessageChildMessageStatusSection(subject) { return new WebElement( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildPendingMessageCount') + '/parent::span/parent::div' + '|' + this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildDeliveredMessageCount') + '/parent::span/parent::div' ); } getListedMessageChildPendingIcon(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildPendingIcon') ); } getListedMessageChildDeliveredPendingIcon(subject) { return new Label( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildDeliveredIcon') ); } getListedMessageChildAttachmentIcon(subject) { return new WebElement( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildAttachmentIcon') ); } getListedMessageChildOptionButton(subject) { return new Button( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildOptionButton') ); } getListedMessageChildMarkAsReadOrUnreadButton(subject) { return new Button( this.getLocatorAsString('listedMessageRoot').replace(P2P_SPECIAL_VALUE.P2P_SUBJECT, subject) + this.getLocatorAsString('listedMessageChildReadButton') ); } }