Ejemplo n.º 1
0
 /** Fill in the required fields for a record type */
 public static void fillRequiredFieldsFor(String recordType, WebDriver driver) throws Exception {
   Record record = loadRecordOfType(recordType);
   Map<String, String> requiredMap = record.getRequiredMap();
   for (String required : requiredMap.keySet()) {
     driver.findElement(By.id(required)).sendKeys(generateTestFieldDataFor(recordType));
   }
 }
Ejemplo n.º 2
0
  public static void verifyAllFieldsCleared(String recordType, WebDriver driver) {
    try {
      Record record = loadRecordOfType(recordType);
      verifyFieldsAreCleared(driver, record.getFieldMap());
      verifySelectFieldsCleared(driver, record.getSelectMap());

    } catch (Exception e) {
      log(e.getMessage());
    }
  }
Ejemplo n.º 3
0
  /** Clears all fields except required fields */
  public static void clearAllFieldsFor(String recordType, WebDriver driver) {
    try {
      Record record = loadRecordOfType(recordType);
      clearFields(driver, record.getFieldMap());
      clearSelectFields(driver, record.getSelectMap());
      clearVocabFields(driver, record.getVocabMap());
      // TODO ADD Dates and Checkboxes

    } catch (Exception e) {
      log(e.getMessage());
    }
  }
Ejemplo n.º 4
0
 /** Finds an Element by either its class name or its xPath */
 public static WebElement findElementWithLabel(
     WebDriver driver, String recordType, String fieldName) throws Throwable {
   Record record;
   record = loadRecordOfType(recordType);
   String selector = record.getFieldSelectorByLabel(fieldName);
   WebElement element;
   if (selector == null) {
     selector = record.getXPath(fieldName);
     element = driver.findElement(By.xpath(selector));
   } else {
     selector = record.getFieldSelectorByLabel(fieldName);
     element = driver.findElement(By.className(selector));
   }
   return element;
 }