package ru.stqua.pft.addressbook.tests;

import org.testng.annotations.Test;
import ru.stqua.pft.addressbook.model.ContactData;

/**
 * Created by Alexander Gorny on 1/29/2017.
 */
public class ContactModificationTests extends TestBase {

  @Test
  public void testContactModification(){
    app.getNavigationHelper().gotoHomePage();

    if (! app.getContactHelper().isThereAContact()){
      // create new contact
      app.getContactHelper().createContact(new ContactData("Alex", "Gorny", "Cool Woker", "Mr", "GE", "New Orleans", "444-555-6666", "cool@mail.com", "woker@mail.com", "www.homepage.com", "test1"), true);
      app.getNavigationHelper().gotoHomePage();
      // modify created contact
      app.getContactHelper().modifyContact(new ContactData("Chuck", "Norris", "Walker", "Mr", "Texas Ranger", "Ryan", "444-555-6666", "cool@mail.com", "woker@mail.com", "www.homepage.com", null), 1);
      app.getNavigationHelper().gotoHomePage();
      // delete previously created contact
      app.getContactHelper().selectContactFromTheList(1);
      app.getContactHelper().deleteSelectedContant();
    } else {
      app.getContactHelper().modifyContact(new ContactData("Chuck", "Norris", "Walker", "Mr", "Texas Ranger", "Ryan", "444-555-6666", "cool@mail.com", "woker@mail.com", "www.homepage.com", null), 1);
    }

    app.getNavigationHelper().gotoHomePage();

  }


}

@@ -670,454 +670,11 @@
     
-  // modify created contact%0A      app.getContactHelper().modifyContact(new ContactData(%22Chuck%22, %22Norris%22, %22Walker%22, %22Mr%22, %22Texas Ranger%22, %22Ryan%22, %22444-555-6666%22, %22cool@mail.com%22, %22woker@mail.com%22, %22www.homepage.com%22, null), 1);%0A      app.getNavigationHelper().gotoHomePage();%0A      // delete previously created contact%0A      app.getContactHelper().selectContactFromTheList(1);%0A      app.getContactHelper().deleteSelectedContant();%0A    %7D else %7B%0A  
+%7D%0A%0A
     
@@ -867,23 +867,16 @@
 l), 1);%0A
-    %7D%0A%0A
     app.
@@ -913,17 +913,16 @@
 Page();%0A
-%0A
   %7D%0A%0A%0A%7D%0A

Remove Contact Deletion from ContactModification