package qa.softwaretesting.addressbook.tests;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import qa.softwaretesting.addressbook.model.ContactData;
import qa.softwaretesting.addressbook.model.Contacts;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.testng.Assert.*;

public class ContactDeletionTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    if (app.db().contacts().size() == 0) {
      app.goTo().addNewContact();
      app.contact().create(new ContactData()
              .withFirstName("Alex")
              .withGroup("test1")
              .withMiddleName("Popovich"), true);
    }
  }

  @Test
  public void testContactDeletion() throws InterruptedException {
    app.goTo().homePage();
    app.goTo().selectAllContacts();
    app.goTo().submitDeletion();
    app.goTo().acceptInDeletionWindow();
    Thread.sleep(1000);
    Contacts contactListAfterDeletion = app.db().contacts();

    assertThat(contactListAfterDeletion.size(), equalTo(0));
  }

}

@@ -966,16 +966,92 @@
 p(1000);
+ // %D0%94%D0%BE%D0%B1%D0%B0%D0%B2%D0%B8%D0%BB %D0%B8%D0%B7-%D0%B7%D0%B0 %D1%82%D0%BE%D0%B3%D0%BE %D1%87%D1%82%D0%BE %D1%83%D0%B4%D0%B0%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5 %D0%B8%D0%B7 %D0%91%D0%94 %D0%BF%D1%80%D0%BE%D0%B8%D1%81%D1%85%D0%BE%D0%B4%D0%B8%D1%82 %D1%81 1 %D1%81%D0%B5%D0%BA%D1%83%D0%BD%D0%B4%D0%BD%D0%BE%D0%B9 %D0%B7%D0%B0%D0%B4%D0%B5%D1%80%D0%B6%D0%BA%D0%BE%D0%B9
 %0A    Con

Update ContactDeletionTests.java