src/page_objects/web/call/incomingCall.page.js
import BasePage from "../../base.page.js";
/**
* IncomingCallPage
* @extends BasePage
*/
class IncomingCallPage extends BasePage {
/**
* @param {args} args Args from controller
*/
constructor(args) {
super(args);
}
// PAGE ELEMENTS
/* eslint-disable require-jsdoc */
cameraToggle() {
return this.element(
"a[class^=components-ToggleSwitch-ToggleSwitch__switchContainer]"
);
}
ignoreButton() {
return this.element("button=Ignore");
}
answerButton() {
return this.element("button=Answer");
}
closeButton() {
return this.element("button#closeModalButton");
}
addButton() {
return this.element("button=Add");
}
modalHeader() {
return this.element("h2[class*='IncomingCallModalComponent__modalHeader']");
}
/* eslint-enable require-jsdoc */
// PAGE FUNCTIONS
/**
* Answer call
*/
async answerCall() {
await this.waitForModalToBeDisplayed();
await this.answerButton().waitForEnabled(5000);
await this.answerButton().click();
}
/**
* Ignore call
*/
async ignoreCall() {
await this.waitForModalToBeDisplayed();
await this.ignoreButton().click();
}
/**
* Clicks the Add button from incoming call modal to add a participant to call
*/
async addCall() {
await this.waitForModalToBeDisplayed();
await this.addButton().waitForEnabled(5000);
await this.addButton().click();
}
/**
* Waits for modal header to become visible
*/
async waitForModalToBeDisplayed() {
await this.modalHeader().waitForVisible(30000);
}
}
export default IncomingCallPage;