Search in sources :

Example 86 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project CollectiveOneWebapp by CollectiveOne.

the class NotificationsModule method checkInitiativeNotification.

public boolean checkInitiativeNotification(WebDriver driver) {
    try {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        // waiting for the animation to finish
        (new WebDriverWait(driver, 10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'testing')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'testing')]"))).click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("edit-container")));
        (driver.findElement(By.id("T_editMenuButton"))).click();
        (driver.findElement(By.id("T_notificationInitiativeButton"))).click();
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_notificationNoSubscribedButton")));
        (driver.findElement(By.id("T_notificationNoSubscribedButton"))).click();
        (driver.findElement(By.id("T_notificationYesSubscribedButton"))).click();
        (driver.findElement(By.id("T_notificationEmailNeverButton"))).click();
        (driver.findElement(By.id("T_notificationEmailImmediatelyButton"))).click();
        (driver.findElement(By.id("T_notificationEmailDayButton"))).click();
        (driver.findElement(By.id("T_notificationEmailWeekButton"))).click();
        (driver.findElement(By.id("T_notificationAcceptButton"))).click();
        return true;
    } catch (Exception exception) {
        System.out.println("Failed @ checkInitiativeNotification(): " + exception);
        return false;
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 87 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project CollectiveOneWebapp by CollectiveOne.

the class PeopleModule method deletePeople.

public boolean deletePeople(WebDriver driver) {
    try {
        // name of user to be deleted
        String name = "carla";
        WebDriverWait wait = new WebDriverWait(driver, 10);
        // click on testing initiative
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'testing')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'testing')]"))).click();
        // click on people tab
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_peopleTab")));
        (driver.findElement(By.id("T_peopleTab"))).click();
        // enter the name of user to add T_peopleDeleteIcon
        wait.until(ExpectedConditions.elementToBeClickable(By.tagName("input")));
        WebElement usernameTable = driver.findElement(By.cssSelector("table tbody tr #T_username"));
        // System.out.println(usernameTable.getText());
        int rowCount = driver.findElements(By.tagName("tr")).size();
        for (int i = 1; i <= rowCount; i++) {
            String sCellValue = driver.findElement(By.xpath("//table/tbody/tr[" + i + "]/td[2]")).getText();
            System.out.println(sCellValue);
            if (sCellValue.equalsIgnoreCase(name)) {
                System.out.println(driver.findElement(By.xpath("//table/tbody/tr[" + i + "]/td[4]/i")));
                wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//table/tbody/tr[" + i + "]/td[4]/i")));
                (driver.findElement(By.xpath("//table/tbody/tr[" + i + "]/td[4]/i"))).click();
                Thread.sleep(1000);
                (driver.findElement(By.id("T_confirmButton_DeletePople"))).click();
                break;
            }
        }
        return true;
    } catch (Exception exception) {
        System.out.println("Failed @ deletePeople(): " + exception);
        return false;
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Example 88 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project CollectiveOneWebapp by CollectiveOne.

the class PeopleModule method addPeople.

public boolean addPeople(WebDriver driver) {
    try {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        // click on testing initiative
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'testing')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'testing')]"))).click();
        // click on people tab
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_peopleTab")));
        (driver.findElement(By.id("T_peopleTab"))).click();
        // enter the name of user to add
        wait.until(ExpectedConditions.elementToBeClickable(By.tagName("input")));
        WebElement selectUserModal = driver.findElement(By.tagName("input"));
        WebElement addUserButtonModal = driver.findElement(By.id("T_addButton"));
        selectUserModal.click();
        // to select from the list
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'carla')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'carla')]"))).click();
        // select the role of user
        Select dropdown = new Select(driver.findElement(By.id("T_memberRoleDropDown")));
        dropdown.selectByValue("EDITOR");
        Thread.sleep(1000);
        addUserButtonModal.click();
        return true;
    } catch (Exception exception) {
        System.out.println("Failed @ addPeople(): " + exception);
        return false;
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement)

Example 89 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project CollectiveOneWebapp by CollectiveOne.

the class TransferModule method transferToInitiatives.

public boolean transferToInitiatives(WebDriver driver) {
    try {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        // waiting for the animation to finish
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(text(),'testing')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'testing')]"))).click();
        // click on transfer tab
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_transferTab")));
        (driver.findElement(By.id("T_transferTab"))).click();
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_transferModal")));
        (driver.findElement(By.id("T_transferModal"))).click();
        (driver.findElement(By.id("T_transferModalUser"))).click();
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_selectMemberTransferModal")));
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_amountToBeTransferred")));
        WebElement memberInput_ModalTransfer = driver.findElement(By.id("T_selectMemberTransferModal"));
        // WebElement disableButton_Modal = driver.findElement(By.id("T_disableVisionButton"));
        WebElement amountTransferred_ModalTransfer = driver.findElement(By.id("T_amountToBeTransferred"));
        WebElement percentageTransferred_ModalTransfer = driver.findElement(By.id("T_percentageToBeTransferred"));
        WebElement motiveModal = driver.findElement(By.id("T_motiveModal"));
        WebElement notesModal = driver.findElement(By.id("T_notesModal"));
        WebElement acceptButton_ModalTransfer = driver.findElement(By.id("T_acceptButton_ModalTransfer"));
        memberInput_ModalTransfer.click();
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'emily')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'emily')]"))).click();
        amountTransferred_ModalTransfer.sendKeys("350");
        percentageTransferred_ModalTransfer.sendKeys("20");
        motiveModal.sendKeys("Motive Sample");
        notesModal.sendKeys("Notes Sample");
        acceptButton_ModalTransfer.click();
        return true;
    } catch (Exception exception) {
        System.out.println("Failed @ editInitiative(): " + exception);
        return false;
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Example 90 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project CollectiveOneWebapp by CollectiveOne.

the class TransferModule method transferToUsersPeer.

public boolean transferToUsersPeer(WebDriver driver) {
    try {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        // waiting for the animation to finish
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(text(),'testing')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'testing')]"))).click();
        // click on transfer tab
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_transferTab")));
        (driver.findElement(By.id("T_transferTab"))).click();
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_transferModal")));
        (driver.findElement(By.id("T_transferModal"))).click();
        (driver.findElement(By.id("T_transferModalUser"))).click();
        // go to peer reviewed
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_peerReviewedTransferUser")));
        (driver.findElement(By.id("T_peerReviewedTransferUser"))).click();
        Thread.sleep(1000);
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_selectMemberTransferModal")));
        wait.until(ExpectedConditions.elementToBeClickable(By.id("T_amountToBeTransferred")));
        WebElement memberInput_ModalTransfer = driver.findElement(By.id("T_selectMemberTransferModal"));
        // WebElement disableButton_Modal = driver.findElement(By.id("T_disableVisionButton"));
        WebElement amountTransferred_ModalTransfer = driver.findElement(By.id("T_amountToBeTransferred"));
        WebElement percentageTransferred_ModalTransfer = driver.findElement(By.id("T_percentageToBeTransferred"));
        WebElement motiveModal = driver.findElement(By.id("T_motiveModal"));
        WebElement notesModal = driver.findElement(By.id("T_notesModal"));
        WebElement acceptButton_ModalTransfer = driver.findElement(By.id("T_acceptButton_ModalTransfer"));
        memberInput_ModalTransfer.click();
        // waiting for the animation to finish
        wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'emily')]")));
        (driver.findElement(By.xpath("//*[contains(text(),'emily')]"))).click();
        amountTransferred_ModalTransfer.sendKeys("350");
        percentageTransferred_ModalTransfer.sendKeys("20");
        motiveModal.sendKeys("Motive Sample");
        notesModal.sendKeys("Notes Sample");
        acceptButton_ModalTransfer.click();
        return true;
    } catch (Exception exception) {
        System.out.println("Failed @ editInitiative(): " + exception);
        return false;
    }
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)527 WebElement (org.openqa.selenium.WebElement)166 WebDriver (org.openqa.selenium.WebDriver)131 Test (org.junit.Test)86 By (org.openqa.selenium.By)54 Actions (org.openqa.selenium.interactions.Actions)53 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)43 TimeoutException (org.openqa.selenium.TimeoutException)38 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)36 IOException (java.io.IOException)28 List (java.util.List)26 Wait (org.openqa.selenium.support.ui.Wait)25 BeforeClass (org.junit.BeforeClass)24 NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)21 ArrayList (java.util.ArrayList)21 WebDriverException (org.openqa.selenium.WebDriverException)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)21 Dimension (org.openqa.selenium.Dimension)20 File (java.io.File)16 NoSuchElementException (org.openqa.selenium.NoSuchElementException)16