src/page_objects/web/contacts/details/personalContactDetails.panel.js
import BaseContactDetailsPanel from "./base.contactDetails.panel.js";
/** PersonalContactDetailsPanel
* @extends BaseContactDetailsPanel
*/
class PersonalContactDetailsPanel extends BaseContactDetailsPanel {
/**
* @param {args} args Args from controller
*/
constructor(args) {
super(args);
}
// PAGE ELEMENTS
/* eslint-disable require-jsdoc */
videoAddressDd() {
return this.elements("dd");
}
editButton() {
return this.element("button=Edit");
}
deleteButton() {
return this.element("button=Delete");
}
/* eslint-enable require-jsdoc */
// PAGE FUNCTIONS
/**
* Get details for personal contact
* @returns {Object} Object of details
*/
async parsePersonalContactDetails() {
const name = await this.contactName().getText();
const favorite = await this.isFavorite();
const presence = await this.presenceText().getText();
const videoAddress = await this.getVideoAddress();
const contactDetailsAll = await this.videoAddressDd().all();
const contactDetails = {
name: name,
favorite: favorite,
presence: presence.toLowerCase(),
videoAddress: videoAddress
};
// on adding a cloud user as a personal contact,
// meetingLink and extension will be displayed in contact details
if (contactDetailsAll.length > 2) {
contactDetails.meetingLink = await contactDetailsAll[0].getText();
contactDetails.extension = await contactDetailsAll[2].getText();
}
return contactDetails;
}
/**
* Gets the state of if the contact is a favorite
* @returns {Boolean} True if favorite, false if not
*/
async isFavorite() {
const favoriteClass = await this.favoriteStar().getAttribute("class");
return favoriteClass.match(/icon icon-favorite-outline/) ? false : true;
}
/**
* Get the text of the video address
* @returns {String} Video address
*/
async getVideoAddress() {
const videoAddressDd = await this.videoAddressDd().last();
return await videoAddressDd.getText();
}
}
export default PersonalContactDetailsPanel;