package ggordeev.addressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.util.concurrent.TimeUnit;

/**
 * Created by g.gordeev on 03.03.2016.
 */
public class ApplicationManager {
  FirefoxDriver wd;

  private SessionHelper sessionHelper;
  private NavigationHelper navigationHelper;
  private GroupHelper groupHelper;

  public static boolean isAlertPresent(FirefoxDriver wd) {
    try {
      wd.switchTo().alert();
      return true;
    } catch (NoAlertPresentException e) {
      return false;
    }
  }

  public void init() {
    wd = new FirefoxDriver();
    wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
    wd.get("http://ggordeev.tmweb.ru/group.php");
    groupHelper = new GroupHelper(wd);
    navigationHelper = new NavigationHelper(wd);
    sessionHelper = new SessionHelper(wd);
    sessionHelper.login("admin", "secret1");
  }



  public void stop() {
    wd.quit();
  }

  public GroupHelper getGroupHelper() {
    return groupHelper;
  }

  public NavigationHelper getNavigationHelper() {
    return navigationHelper;
  }
}

@@ -39,91 +39,8 @@
 r;%0A%0A
-import org.openqa.selenium.By;%0Aimport org.openqa.selenium.NoAlertPresentException;%0A
 impo
@@ -351,196 +351,8 @@
 r;%0A%0A
-  public static boolean isAlertPresent(FirefoxDriver wd) %7B%0A    try %7B%0A      wd.switchTo().alert();%0A      return true;%0A    %7D catch (NoAlertPresentException e) %7B%0A      return false;%0A    %7D%0A  %7D
 %0A%0A  

Revert "Revert "общий класс2""