@Test
  public void specificProfile() throws IOException {
    driver = new TestOperaDesktopDriver(capabilities);

    assertTrue(driver.isRunning());
    assertEquals(
        profileDirectory.getCanonicalPath(),
        driver.getSettings().profile().getDirectory().getCanonicalPath());
  }
  /**
   * This test is known to fail if OPERA_PATH points to a shell script or a symlink, as is the case
   * on Debian.
   */
  @Test
  @Ignore(platforms = LINUX)
  public void environmentalBinaryPathWorks() throws IOException {
    File binary = new OperaBinary(OperaProduct.DESKTOP).getFile();
    environment.set(OperaBinary.OPERA_PATH_ENV_VAR, binary.getPath());

    driver = new TestOperaDesktopDriver();
    assertEquals(binary.getCanonicalPath(), driver.getSettings().getBinary().getCanonicalPath());
    assertEquals(binary.getCanonicalPath(), new File(driver.getOperaPath()).getCanonicalPath());
    assertEquals(binary.getCanonicalPath(), driver.utils().getBinaryPath());
  }
  @Test
  public void startAndQuitOperaFourTimes() {
    for (int i = 0; i < 5; i++) {
      driver = new TestOperaDesktopDriver();
      assertTrue("Opera should be running", driver.isRunning());

      // TODO: What does this do?  Why is it here?
      driver.resetOperaPrefs("");
      assertTrue("Opera should be running", driver.isRunning());

      driver.quit();
    }
  }
  @Test
  @NeedsLocalEnvironment
  public void browserDoesNotQuit() {
    OperaSettings settings = new OperaSettings();
    settings.setDetach(true);

    driver = new TestOperaDesktopDriver(settings);
    int processID = driver.utils().getPID();
    driver.quit();

    // Driver should be shut down, and there should be no connection to browser
    assertFalse(driver.getServices().isConnected());

    // But browser should be running
    assertTrue(ProcessManager.isPidRunning(processID));

    ProcessManager.killPID(processID);
  }
  @Test
  public void capabilitiesForDesktopAreCorrect() {
    capabilities.setCapability(NO_QUIT.getCapability(), true);

    driver = new TestOperaDesktopDriver(capabilities);

    Capabilities actual = driver.getSettings().toCapabilities();
    assertEquals(actual.getCapability(AUTOSTART.getCapability()), true);
    assertEquals(actual.getCapability(PRODUCT.getCapability()), OperaProduct.DESKTOP);
    assertEquals(actual.getCapability(NO_QUIT.getCapability()), true);
    assertEquals(actual.getCapability(NO_RESTART.getCapability()), false);
  }
 @After
 public void tearDownDriver() {
   if (driver != null && driver.isRunning()) {
     driver.quit();
   }
 }