Skip to content

Instantly share code, notes, and snippets.

@tdharris
Last active August 29, 2015 14:23
Show Gist options
  • Save tdharris/3470e8a14089ff4a74a7 to your computer and use it in GitHub Desktop.
Save tdharris/3470e8a14089ff4a74a7 to your computer and use it in GitHub Desktop.
public class InboundCall extends PowerDialer
{
@FindBy(id = "inbound_callerid_span")
private WebElement inboundCallerId;
@FindBy(id = "inbound_acd_span")
private WebElement inboundRepQueue;
@FindBy(id = "close_inbound")
private WebElement closeInbound;
@FindBy(id= "inbound_call_pending")
private WebElement inboundCallPending;
public InboundCall(SeleniumManager sm)
{
super(sm);
PageFactory.initElements(driver, this); // Initialize the POM objects.
}
public String getCallerId()
{
return inboundCallerId.getText();
}
public String getRepQueue()
{
return inboundRepQueue.getText();
}
public PowerDialer closeInbound()
{
sm.click(closeInbound);
return PowerDialer.this;
}
public boolean isVisibleAcceptReject()
{
return inboundCallPending.isDisplayed();
}
}
// PD Inbound objects
@FindBy(id = "ISC2C_Li_StatusAvailable")
private WebElement statusAvailable;
@FindBy(id = "ISC2C_Li_StatusUnavailable")
private WebElement statusUnavailable;
@FindBy(id = "ISC2C_CurrentInboundStatus")
private WebElement currentInboundStatus;
@FindBy(id = "id_accept_inbound")
private WebElement acceptInboundCallButton;
@FindBy(id = "id_reject_inbound")
private WebElement ignoreInboundCall;
@FindBy(id = "dp_sect___inbound_summary")
private WebElement inboundSummary;
@FindBy(css = "#object_name > span")
private WebElement recordName;
private String inboundCallFrame = "inboundCallFrame";
/**
* Client Leg Connected
* @return boolean
*/
public boolean isClientLegConnected()
{
return disconnect.isEnabled();
}
/**
* Agent Leg Connected
* @return boolean
*/
public boolean isAgentLegConnected()
{
//this.openSettings().refreshSettingsPage();
PowerDialerSettings settings = this.openSettings();
boolean status = settings.disconnectAgentLeg.isEnabled();
settings.cancel();
return status;
}
/** Set the inbound status for the agent
* @param agentStatus
*/
public PowerDialer setAgentStatus(String agentStatus)
{
sm.click(currentInboundStatus);
sm.waitForVisibility(statusAvailable);
switch (agentStatus) {
case "Ready for Inbound":
sm.click(statusAvailable);
break;
case "Not ready for Inbound":
default:
sm.click(statusUnavailable);
break;
}
return this;
}
/**
* Get the Current Record Name
* @return String
*/
public String getCurrentRecord()
{
return recordName.getText();
}
/**
* Accept Inbound Call
* @return InboundCall
*/
public InboundCall acceptInboundCall()
{
sm.waitForVisibility(inboundSummary);
sm.click(acceptInboundCallButton);
return new InboundCall(sm);
}
/**
* Reject Inbound Call
* @return
*/
public PowerDialer ignoreInboundCall()
{
sm.waitForVisibility(inboundSummary);
sm.click(ignoreInboundCall);
return this;
}
/**
* Get the visibility of the Inbound Panel
* @return boolean
*/
public boolean isInboundVisible()
{
sm.waitForVisibility(inboundSummary);
return inboundSummary.isDisplayed();
}
/**
* Get the button status of transfer (enabled/disabled)
* @return boolean
*/
public boolean isTransferEnabled()
{
return transferCall.isDisplayed();
}
/**
* Get the button status of disconnect (enabled/disabled)
* @return boolean
*/
public boolean isDisconnectEnabled()
{
return disconnect.isDisplayed();
}
/**
* Get the button status of transfer, disconnect (enabled/disabled)
* @return boolean
*/
public boolean isOutboundEnabled()
{
return transferCall.isDisplayed() && disconnect.isDisplayed();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment