private static void saveContactsToCsvFile(List<ContactData> contacts, File file)
     throws IOException {
   FileWriter writer = new FileWriter(file);
   for (ContactData contact : contacts) {
     writer.write(
         contact.getFirstname()
             + ","
             + contact.getLastname()
             + ","
             + contact.getAddress()
             + ","
             + contact.getHometelephone()
             + ","
             + contact.getMobile()
             + ","
             + contact.getWorktelephone()
             + ","
             + contact.getEmail1()
             + ","
             + contact.getEmail2()
             + ","
             + contact.getSecondaryaddress()
             + ","
             + contact.getPhone2()
             + ","
             + contact.getBday()
             + ","
             + contact.getByear()
             + ","
             + contact.getBmonth()
             + ",!"
             + "\n");
   }
   writer.close();
 }
 @Test
 public void addNonEmptyContactToGroup() throws Exception {
   app.getNavigationHelper().openMainPage();
   app.getNavigationHelper().gotoGroupsPage();
   app.getGroupHelper().initGroupsPage();
   GroupData groupData = new GroupData();
   groupData.name = "Auto_addNonEmptyContactToGroup1";
   groupData.header = "header test for new contact";
   groupData.footer = "footer test for new contact";
   app.getGroupHelper().fillGroupForm(groupData);
   app.getGroupHelper().submitGroupCreation();
   app.getNavigationHelper().openMainPage();
   app.getContactHelper().initCreateContactPage();
   ContactData contactData = new ContactData();
   contactData.firstName = "firstName";
   contactData.lastName = "lastName";
   contactData.address = "address";
   contactData.homePhone = "homePhone";
   contactData.modilePhone = "modilePhone";
   contactData.workPhone = "workPhone";
   contactData.emailFirsts = "emailFirsts";
   contactData.emailSecond = "emailSecond";
   contactData.birthdayDay = "1";
   contactData.bithdayMounth = "January";
   contactData.birthdayYear = "1990";
   contactData.selectGroup = groupData.name;
   contactData.secondaryAddressSecond = "secondaryAddressSecond";
   contactData.secondaryAddressHome = "secondaryAddressHome";
   app.getContactHelper().fillContactForm();
   app.getContactHelper().submitContactCreation();
   app.getNavigationHelper().returnToHomePage();
 }
예제 #3
0
 public ContactHelper fillContactForm(ContactData contact, boolean formType) {
   type(By.name("firstname"), contact.getFname());
   type(By.name("lastname"), contact.getLname());
   type(By.name("address"), contact.getAddress1());
   type(By.name("home"), contact.getHnumber());
   type(By.name("mobile"), contact.getMnumber());
   type(By.name("work"), contact.getWnumber());
   type(By.name("email"), contact.getMail1());
   type(By.name("email2"), contact.getMail2());
   type(By.name("byear"), contact.getYear());
   if (formType == CREATION) {
   } else {
     if (driver.findElements(By.name("new_group")).size() != 0) {
       throw new Error("Group selector exists in contact modification form");
     }
   }
   type(By.name("address2"), contact.getAddress2());
   type(By.name("phone2"), contact.getPhonenumber());
   return this;
 }