diff --git a/src/main/java/com/orasi/bluesource/AccountBurnDownDataReportForm.java b/src/main/java/com/orasi/bluesource/AccountBurnDownDataReportForm.java new file mode 100644 index 0000000..47efbf0 --- /dev/null +++ b/src/main/java/com/orasi/bluesource/AccountBurnDownDataReportForm.java @@ -0,0 +1,52 @@ +package com.orasi.bluesource; + +import com.orasi.web.OrasiDriver; +import com.orasi.web.PageLoaded; +import com.orasi.web.webelements.Element; +import com.orasi.web.webelements.Listbox; +import com.orasi.web.webelements.impl.internal.ElementFactory; +import org.openqa.selenium.support.FindBy; + +public class AccountBurnDownDataReportForm { + private OrasiDriver driver = null; + + /**Page Elements**/ + @FindBy(xpath = "//input[@name='commit']") private Element elmGenerateReport; + @FindBy(xpath = "//select[@id='account_select']") private Listbox lstAccountSelect; + + /** + * Constructor + **/ + public AccountBurnDownDataReportForm(OrasiDriver driver) { + this.driver = driver; + ElementFactory.initElements(driver, this); + } + + /**Page Interactions**/ + + public boolean verifyFormLoaded(){ + return PageLoaded.isElementLoaded(this.getClass(),driver,elmGenerateReport,5) && + PageLoaded.isElementLoaded(this.getClass(),driver,lstAccountSelect,5); + } + + public void clickGenerateReport(){ + if (canInteract(elmGenerateReport)) + elmGenerateReport.click(); + } + + public void selectAccount(String strAccount){ + if (canInteract(lstAccountSelect)){ + lstAccountSelect.select(strAccount); + } + } + + /** + * This method provides standard checks that an element can be interacted with + * @author David Grayson + * @param elm {@link Element} Element to check + * @return {@link Boolean} Returns true if the element is enabled and visible, false otherwise + */ + private boolean canInteract(Element elm){ + return elm.syncEnabled(5) && elm.syncVisible(5); + } +} \ No newline at end of file diff --git a/src/main/java/com/orasi/bluesource/Accounts.java b/src/main/java/com/orasi/bluesource/Accounts.java index e24471f..bb5468d 100644 --- a/src/main/java/com/orasi/bluesource/Accounts.java +++ b/src/main/java/com/orasi/bluesource/Accounts.java @@ -1,30 +1,17 @@ package com.orasi.bluesource; -import java.lang.reflect.UndeclaredThrowableException; -import java.util.List; - -import javax.lang.model.util.Elements; - -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - import com.orasi.utils.Randomness; import com.orasi.utils.TestReporter; import com.orasi.web.OrasiDriver; import com.orasi.web.PageLoaded; -import com.orasi.web.webelements.Button; -import com.orasi.web.webelements.Element; -import com.orasi.web.webelements.Link; -import com.orasi.web.webelements.Listbox; -import com.orasi.web.webelements.Textbox; -import com.orasi.web.webelements.Webtable; +import com.orasi.web.webelements.*; import com.orasi.web.webelements.impl.internal.ElementFactory; +import org.openqa.selenium.By; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.support.FindBy; + +import java.lang.reflect.UndeclaredThrowableException; +import java.util.List; public class Accounts { private OrasiDriver driver = null; @@ -46,6 +33,12 @@ public class Accounts { @FindBy(css = "div.btn.btn-secondary.btn-xs.quick-nav") private Button btnQuickNav; @FindBy(xpath = "//a[contains(@ng-bind, 'n + 1')]") private List