private void AreaOfStudy() throws IOException, InterruptedException {
   // Click Area of School
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Area of Study\")]"))
       .click();
   // Select One Area Study
   new Select(driver.findElement(By.id("edit-area-of-study-parent")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies");
   // Wait For Another Select List To Load
   Thread.sleep(5000);
   // Select Subareas of Study
   new Select(driver.findElement(By.xpath("//div[@id='child-area-of-study-wrapper']//select")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies, Other");
   // Click Apply
   driver.findElement(By.id("edit-area-of-study-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
 private void SpecialNeeds() throws IOException {
   // Click Special Needs
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Special Needs\")]"))
       .click();
   // Select Special Needs
   Select SpecialNeeds = new Select(driver.findElement(By.id("edit-special-needs")));
   // Select Learning Center
   SpecialNeeds.selectByVisibleText("Learning Center");
   // Select Early Syllabus
   SpecialNeeds.selectByVisibleText("Early syllabus");
   // Click Apply
   driver.findElement(By.id("edit-special-needs-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
 private void TypesOfSchool() throws IOException {
   // Click Type of School
   driver.findElement(By.cssSelector("strong")).click();
   // Click Private
   driver.findElement(By.id("edit-public-private-private")).click();
   // Move School Size Slider
   // TODO Slider not working properly
   WebElement Slider1 = driver.findElement(By.id("population_jq_slider"));
   Actions moveSlider1 = new Actions(driver);
   Action action1 = moveSlider1.dragAndDropBy(Slider1, 0, 10).build();
   action1.perform();
   // Select Religious Affiliation
   new Select(driver.findElement(By.id("edit-religious-affiliation")))
       .selectByVisibleText("Church of Christ");
   // Move Tuition Range Slider
   // TODO Slider not working properly
   WebElement Slider2 = driver.findElement(By.id("tuition_range_jq_slider"));
   Actions moveSlider2 = new Actions(driver);
   Action action2 = moveSlider2.dragAndDropBy(Slider2, 0, 10).build();
   action2.perform();
   // Click Apply
   driver.findElement(By.id("edit-type-of-school-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
 private void Location() throws IOException {
   // Click Location
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Location\")]"))
       .click();
   // Click West Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[3]/input")).click();
   // Click South Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[6]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-location-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
 private void ActivitiesOfInterest() throws IOException {
   // Click Activities of Interest
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Activities of Interest\")]"))
       .click();
   // Click Student Newspaper Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[11]/input")).click();
   // Click TV Station Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[13]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-activities-interests-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
Beispiel #6
0
  @Test
  public void testOtsi() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Kandidaadid")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    driver.findElement(By.id("nimi")).clear();
    driver.findElement(By.id("nimi")).sendKeys("Magdalena");
    try {
      assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    driver.findElement(By.id("sButton")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextNotPresent may require manual changes
    try {
      assertFalse(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
 private void SearchButton() throws IOException {
   // Enter Text To Be Search
   driver.findElement(By.id("edit-keys")).clear();
   driver.findElement(By.id("edit-keys")).sendKeys("Abilene");
   // Click Search
   driver.findElement(By.id("edit-submit")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
Beispiel #8
0
 public static void assumeNotHeadless() {
   boolean headless = true;
   try {
     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     headless = ge.isHeadless();
   } catch (Exception e) {
     e.printStackTrace();
   } catch (Error e) {
     // Really not sure why this ever happens, maybe just jenkins issues
     e.printStackTrace();
   }
   if (headless) {
     System.out.println("You are trying to start a GUI in a headless environment. Aborting test");
   }
   org.junit.Assume.assumeTrue(!headless);
 }
  @Test(
      dataProvider = "addNewAgentApplicant",
      dataProviderClass = applicantDataInternationalNewApplicant.class)
  public void testEnterDataAddNewApplicant(
      String loginEmail,
      String loginPassword,
      String firstName,
      String lastName,
      String birthDay,
      String birthMonth,
      String birthYear)
      throws Exception {

    // Add new applicant to Agent
    Thread.sleep(300);
    // Test case from HERE to CITIZENSHIP will fail if the applicant already exists.
    driver.findElement(By.id("field-email")).clear();
    driver.findElement(By.id("field-email")).sendKeys(loginEmail);
    Thread.sleep(150);
    driver.findElement(By.id("field-confirmEmail")).clear();
    driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail);

    Thread.sleep(100);
    driver.findElement(By.id("field-firstName")).clear();
    driver.findElement(By.id("field-firstName")).sendKeys(firstName);

    driver.findElement(By.id("field-lastName")).clear();
    driver.findElement(By.id("field-lastName")).sendKeys(lastName);

    new Select(driver.findElement(By.name("dayOfBirth"))).selectByVisibleText(birthDay);
    new Select(driver.findElement(By.name("monthOfBirth"))).selectByVisibleText(birthMonth);
    new Select(driver.findElement(By.name("yearOfBirth"))).selectByVisibleText(birthYear);

    driver.findElement(By.xpath("//button[@type='submit']")).click();

    System.out.println("Applicant = " + loginEmail);
    Thread.sleep(500);

    try {
      assertEquals(
          "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("enterDataAddNewAppl");
      verificationErrors.append(e.toString());
    }
  }
 private void Sports() throws IOException {
   // Click Sports
   driver
       .findElement(
           By.xpath("//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Sports\")]"))
       .click();
   // Select Sports
   Select Sports = new Select(driver.findElement(By.id("edit-varsity-sports")));
   // Select Baseball
   Sports.selectByVisibleText("baseball");
   // Select Basketball
   Sports.selectByVisibleText("basketball");
   // Click Apply
   driver.findElement(By.id("edit-varsity-sports-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
 @Test
 public void testRegistreerimine() throws Exception {
   driver.get(baseUrl + "/login");
   driver.findElement(By.xpath("//button[5]")).click();
   driver.findElement(By.id("kasutajanimi")).clear();
   driver.findElement(By.id("kasutajanimi")).sendKeys("Testkasutaja");
   driver.findElement(By.id("eesnimi")).clear();
   driver.findElement(By.id("eesnimi")).sendKeys("Test");
   driver.findElement(By.id("perenimi")).clear();
   driver.findElement(By.id("perenimi")).sendKeys("Kasutaja");
   driver.findElement(By.id("parool")).clear();
   driver.findElement(By.id("parool")).sendKeys("testkasutaja");
   driver.findElement(By.id("email")).clear();
   driver.findElement(By.id("email")).sendKeys("*****@*****.**");
   driver.findElement(By.id("telnr")).clear();
   driver.findElement(By.id("telnr")).sendKeys("55123123");
   driver.findElement(By.id("regamisnupp")).click();
   try {
     assertEquals(
         "Registreerimine õnnestus!", driver.findElement(By.xpath("//div/div/div/div")).getText());
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
 }
Beispiel #12
0
  @Test
  public void testWeather() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Edmonton")).click();
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (isElementPresent(By.id("cityjump"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Forecast[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
  @Test(
      dataProvider = "addNewApplicant",
      dataProviderClass = applicantDataDomesticNewApplicant.class)
  public void testRegisterAccount(
      String loginEmail,
      String loginPassword,
      String firstName,
      String lastName,
      String birthDay,
      String birthMonth,
      String birthYear)
      throws Exception {
    // Register New Account
    driver.findElement(By.id("field-firstName")).clear();
    driver.findElement(By.id("field-firstName")).sendKeys(firstName);

    driver.findElement(By.id("field-lastName")).clear();
    driver.findElement(By.id("field-lastName")).sendKeys(lastName);

    new Select(driver.findElement(By.name("day"))).selectByVisibleText(birthDay);
    new Select(driver.findElement(By.name("month"))).selectByVisibleText(birthMonth);
    new Select(driver.findElement(By.name("year"))).selectByVisibleText(birthYear);

    driver.findElement(By.id("field-email")).clear();
    driver.findElement(By.id("field-email")).sendKeys(loginEmail);

    driver.findElement(By.id("field-confirmEmail")).clear();
    driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail);

    driver.findElement(By.id("field-password")).clear();
    driver.findElement(By.id("field-password")).sendKeys(loginPassword);

    driver.findElement(By.id("field-confirmPassword")).clear();
    driver.findElement(By.id("field-confirmPassword")).sendKeys(loginPassword);

    driver.findElement(By.id("field-terms")).click();

    driver.findElement(By.xpath("(//button[@type='submit'])[2]")).click();
    try {
      assertEquals(
          "Successfully registered.",
          driver.findElement(By.cssSelector("div.alert.alert-success")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("registerAcct_outp");
      verificationErrors.append(e.toString());
    }
    System.out.println("Applicant = " + loginEmail + " Password = " + loginPassword);

    // Write out the Applicants email address to the output file created in gotoSite.java
    // First create object of java FileWriter and BufferedWriter class.
    String WriteFile = generateFileName();
    FileWriter FW = new FileWriter(WriteFile);
    BufferedWriter BW = new BufferedWriter(FW);
    BW.write(loginEmail); // Writing applicants login to File.
    BW.newLine(); // To write next string on new line.
    BW.write(lastName); // Writing applicants lastname to File.
    BW.newLine(); // To write next string on new line.
    BW.write(firstName); // Writing applicants first name to File.
    BW.newLine(); // To write next string on new line.
    BW.close();
  }