package ru.stqa.pft.addressbook.appmanager;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.BrowserType;
import sun.plugin.dom.exception.BrowserNotSupportedException;

import java.util.concurrent.TimeUnit;

public class ApplicationManager {
    private String browser;
    WebDriver driver;

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

    public ApplicationManager(String browser) {
        this.browser = browser;
    }

    public void init() {
        if (browser == BrowserType.FIREFOX) {
            driver = new FirefoxDriver();
        } else if (browser == BrowserType.CHROME) {
            driver = new ChromeDriver();
        } else if (browser == BrowserType.IE) {
            driver = new InternetExplorerDriver();
        }

        driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
        groupHelper = new GroupHelper(driver);
        navigationHelper = new NavigationHelper(driver);
        sessionHelper = new SessionHelper(driver);
        contactHelper = new ContactHelper(driver);
        sessionHelper.openHomePage();
        sessionHelper.login("admin", "secret");
    }

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

    public GroupHelper getGroupHelper() {
        return groupHelper;
    }

    public NavigationHelper getNavigationHelper() {
        return navigationHelper;
    }

    public SessionHelper getSessionHelper() {
        return sessionHelper;
    }

    public ContactHelper getContactHelper() {
        return contactHelper;
    }
}

@@ -752,36 +752,40 @@
      if (browser
- == 
+.equals(
 BrowserType.FIRE
@@ -788,16 +788,17 @@
 FIREFOX)
+)
  %7B%0A     
@@ -852,36 +852,40 @@
 else if (browser
- == 
+.equals(
 BrowserType.CHRO
@@ -887,16 +887,17 @@
 .CHROME)
+)
  %7B%0A     
@@ -962,12 +962,16 @@
 wser
- == 
+.equals(
 Brow
@@ -981,16 +981,17 @@
 Type.IE)
+)
  %7B%0A     

change == to equals