Package com.opera.core.systems.testing.drivers

Examples of com.opera.core.systems.testing.drivers.TestDriver


      currentPlatform();
    }
  }

  public void removeDriverIfNecessary() {
    TestDriver driver = getWrappedDriver();
    if (!spawnDriver && (driver != null && driver.isRunning())) {
      removeDriver();
    }
  }
View Full Code Here


      removeDriver();
    }
  }

  public static void removeDriver() {
    TestDriver current = storedDriver.get();

    if (current == null) {
      return;
    }

    try {
      current.quit();
    } catch (RuntimeException ignored) {
      // fall through
    } finally {
      storedDriver.remove();
    }
View Full Code Here

      testException = e;
    }

    if (test instanceof TestCase) {
      TestCase base = (TestCase) test;
      TestDriver driver = base.getWrappedDriver();

      // If any driver is present we don't need a different supplier's driver to initialize
      // TestIgnorance.  This skips the supplies(klass) check in createDriverIfNecessary().
      if (driver == null || !driver.isRunning()) {
        base.createDriverIfNecessary();
        driver = base.getWrappedDriver();
      }

      ignorance = new TestIgnorance(driver.getServices().getAvailableServices(),
                                    driver.getRunner() != null,
                                    driver.getServices().isOperaIdleAvailable(),
                                    driver.utils().getPlatform(),
                                    driver.utils().getProduct());
    } else {
      ignorance = new TestIgnorance(new LinkedHashMap<ScopeService, String>(),
                                    false,
                                    false,
                                    Platform.getCurrent(),
View Full Code Here

  @Test
  public void operaExtensionIsInstalled() throws IOException {
    File oexSource = resourceCopy(resources.locate("dummy-extension.oex"));

    settings.profile().addExtension(oexSource);
    TestDriver driver = new TestDriverBuilder().using(settings).get();

    assertNotNull(driver);
    assertTrue("Expected Opera to run", driver.isRunning());
    driver.navigate().to(pages.oex);

    try {
      // The dummy extension sets a HTML attribute on the <html> element.
      By by = By.cssSelector("html[isoexinstalled759='yes']");
      (new WebDriverWait(driver, 2)).until(ExpectedConditions.presenceOfElementLocated(by));
    } catch (TimeoutException e) {
      fail("Custom opera extension not detected!");
    }

    driver.quit();
  }
View Full Code Here

  @Ignore(products = CORE, value = "core does not reset port number if -debugproxy is omitted")
  public void testDefaultPort() {
    DesiredCapabilities c = new DesiredCapabilities();
    c.setCapability(OperaSettings.Capability.PORT.getCapability(), -1);

    TestDriver a = new TestDriverBuilder().using(c).get();
    assertEquals(7001, a.preferences().get("Developer Tools", "Proxy Port").getValue());
    a.quit();
  }
View Full Code Here

  @Test
  public void testRandomPort() {
    DesiredCapabilities c = new DesiredCapabilities();
    c.setCapability(OperaSettings.Capability.PORT.getCapability(), 0);

    TestDriver a;
    try {
      a = new TestDriverBuilder().using(c).get();
    } catch (Exception e) {
      // If immediately exited, then it doesn't support the flags
      if (e.getMessage().contains("Opera exited immediately")) {
        return;
      } else {
        fail("Unexpected exception: " + e);
        return;
      }
    }
    Assert.assertNotSame("7001", a.preferences().get("Developer Tools", "Proxy Port").toString());
    a.quit();
  }
View Full Code Here

          value = "Once this is set the autotestmode profile no longer connects on 7001, breaking future tests")
  public void testSetPort() {
    OperaSettings settings = new OperaSettings();
    settings.setPort(9876);

    TestDriver a;
    try {
      a = new TestDriverBuilder().using(settings).get();
    } catch (Exception e) {
      // If immediately exited, then it doesn't support the flags
      if (e.getMessage().contains("Opera exited immediately")) {
        return;
      } else {
        fail("Unexpected exception: " + e);
        return;
      }
    }

    assertEquals(9876, a.preferences().get("Developer Tools", "Proxy Port").getValue());
    a.quit();
  }
View Full Code Here

  }

  @Test
  public void binaryIsCorrectlyLaunched() {
    settings.setBinary(OperaBinary.find());
    TestDriver driver = new TestDriverBuilder().using(settings).get();

    assertNotNull(driver);
    assertTrue("Expected Opera to run", driver.isRunning());

    driver.quit();
  }
View Full Code Here

  public void binaryRegistersProduct() {
    assumeTrue(System.getenv(OperaBinary.OPERA_PATH_ENV_VAR) == null);

    settings.setBinary(OperaBinary.find(OperaProduct.MOBILE));

    TestDriver driver = new TestDriverBuilder().using(settings).get();

    assertEquals(OperaProduct.MOBILE, driver.utils().getProduct());
    assertEquals(OperaProduct.MOBILE, driver.getSettings().getProduct());

    driver.quit();
  }
View Full Code Here

  }

  @Test
  public void proxyIsRecognized() {
    settings.getProxy().setHttpProxy("4.4.4.4");
    TestDriver driver = new TestDriverBuilder().using(settings).get();
    assertEquals("4.4.4.4", driver.getSettings().getProxy().getHttpProxy());
  }
View Full Code Here

TOP

Related Classes of com.opera.core.systems.testing.drivers.TestDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.