public void hoverAndViewStudentPhotoOnBody(int panelBodyIndex, String urlRegex) throws Exception {
    String idOfPanelBody = "panelBodyCollapse-" + panelBodyIndex;
    WebElement photoLink =
        browser
            .driver
            .findElements(By.cssSelector('#' + idOfPanelBody + "> .panel-body > .row"))
            .get(0)
            .findElements(By.className("profile-pic-icon-hover"))
            .get(0);
    Actions actions = new Actions(browser.driver);
    actions.moveToElement(photoLink).perform();

    waitForElementPresence(By.cssSelector(".popover-content > img"));
    ThreadHelper.waitFor(500);

    AssertHelper.assertContainsRegex(
        urlRegex,
        browser
            .driver
            .findElements(By.cssSelector(".popover-content > img"))
            .get(0)
            .getAttribute("src"));

    JavascriptExecutor jsExecutor = (JavascriptExecutor) browser.driver;
    jsExecutor.executeScript(
        "document.getElementsByClassName('popover')[0].parentNode.removeChild(document.getElementsByClassName('popover')[0])");
  }
  public void verifyParticipantPanelIsCollapsed(int id, int timeToWait) {
    WebElement panel = browser.driver.findElement(By.id("panelBodyCollapse-" + id));

    // Need to wait for the total duration according to the number of collapse/expand intervals
    // between panels before checking final state of the panel
    ThreadHelper.waitFor(timeToWait);
    assertFalse(panel.isDisplayed());
  }
Ejemplo n.º 3
0
 public static void waitForTaskQueueExecution(int tasks, int buffer) {
   /*
    *  Current rate of task execution is 1/s
    *  Wait for 1 more second to see if erroneous or unwanted tasks
    *  are added too
    */
   ThreadHelper.waitFor((tasks + buffer) * 1000);
 }
  public void editFeedbackResponseComment(String commentIdSuffix, String newCommentText) {
    WebElement commentRow =
        browser.driver.findElement(By.id("responseCommentRow" + commentIdSuffix));
    commentRow.findElements(By.tagName("a")).get(1).click();

    WebElement commentEditForm =
        browser.driver.findElement(By.id("responseCommentEditForm" + commentIdSuffix));
    fillTextBox(commentEditForm.findElement(By.name("responsecommenttext")), newCommentText);
    commentEditForm
        .findElement(By.className("col-sm-offset-5"))
        .findElement(By.tagName("a"))
        .click();
    ThreadHelper.waitFor(1000);
  }
 public void clickVisibilityOptionForResponseCommentAndSave(
     String idString, int numOfTheCheckbox) {
   String idSuffix = idString.substring(18);
   WebElement commentRow = browser.driver.findElement(By.id(idString));
   commentRow.findElements(By.tagName("a")).get(1).click();
   WebElement commentEditForm =
       browser.driver.findElement(By.id("responseCommentEditForm" + idSuffix));
   commentRow.findElement(By.id("frComment-visibility-options-trigger" + idSuffix)).click();
   commentRow.findElements(By.cssSelector("input[type='checkbox']")).get(numOfTheCheckbox).click();
   commentEditForm
       .findElement(By.className("col-sm-offset-5"))
       .findElement(By.tagName("a"))
       .click();
   ThreadHelper.waitFor(1000);
 }
  public boolean verifyAllResultsPanelBodyVisibility(boolean visible) {
    int numOfQns =
        browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse")).size();
    assertTrue(numOfQns > 0);

    // Wait for the total duration according to the number of collapse/expand intervals between
    // questions
    ThreadHelper.waitFor((numOfQns * 50) + 1000);

    for (WebElement e :
        browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse"))) {
      if (e.isDisplayed() != visible) {
        return false;
      }
    }
    return true;
  }
 public void waitForPanelsToCollapse() {
   List<WebElement> panelBodies =
       browser.driver.findElements(By.cssSelector("div[id^='panelBodyCollapse-']"));
   waitForElementsVisibility(panelBodies);
   ThreadHelper.waitFor(1000);
 }
 public void deleteFeedbackResponseComment(String commentIdSuffix) {
   WebElement commentRow =
       browser.driver.findElement(By.id("responseCommentRow" + commentIdSuffix));
   commentRow.findElement(By.tagName("form")).findElement(By.tagName("a")).click();
   ThreadHelper.waitFor(1500);
 }
Ejemplo n.º 9
0
 // TODO: rename course-add-eval-for-test
 public InstructorFeedbacksPage clickCourseAddEvaluationLink(String courseId) {
   getCourseLinkInRow("course-add-eval-for-test", getCourseRowId(courseId)).click();
   waitForPageToLoad();
   ThreadHelper.waitBriefly();
   return changePageType(InstructorFeedbacksPage.class);
 }
Ejemplo n.º 10
0
 public void clickRemindParticularUsersLink(String courseId, String evalName) {
   getRemindParticularUsersLink(courseId, evalName).click();
   ThreadHelper.waitFor(1000);
 }