Java Code Examples for org.openqa.selenium.Platform#VISTA

The following examples show how to use org.openqa.selenium.Platform#VISTA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlatformMatcherTest.java    From selenium-api with MIT License 6 votes vote down vote up
@DataProvider
public Object[][] external() {
    return new Object[][]{
            {"win7", Platform.VISTA},
            {"vista", Platform.VISTA},
            {"Vista", Platform.VISTA},
            {"win8_1", Platform.WIN8_1},
            {"XP", Platform.XP},
            {"Win7", Platform.VISTA},
            {"win7", Platform.VISTA},
            {"Windows Server 2012", Platform.WIN8},
            {"windows 8", Platform.WIN8},
            {"win8", Platform.WIN8},
            {"windows 8.1", Platform.WIN8_1},
            {"win8.1", Platform.WIN8_1},
            {null, null},
            {"w8", null},
            {Platform.ANDROID, Platform.ANDROID}
    };
}
 
Example 2
Source File: TestEnvironmentTest.java    From senbot with MIT License 6 votes vote down vote up
@Test
public void testEquals_OS() {
    TestEnvironment left = new TestEnvironment(null, null, Platform.WINDOWS);
    TestEnvironment right = new TestEnvironment(null, null, Platform.WINDOWS);

    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.LINUX);
    assertFalse(left.matches(right));

    right = new TestEnvironment(null, null, Platform.XP);
    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.VISTA);
    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.ANY);
    assertTrue(left.matches(right));
}
 
Example 3
Source File: PlatformMatcherTest.java    From selenium-api with MIT License 5 votes vote down vote up
@DataProvider
public Object[][] platforms() {
    return new Object[][]{
            {"win7", Platform.VISTA, true},
            {"win7", "windows 7", true},
            {"vista", Platform.VISTA, true},
            {"darwin", Platform.MAC, true},
            {Platform.ANY, Platform.LINUX, true},
            {"linux", Platform.LINUX, true},
            {"linux", Platform.UNIX, false},
            {null, Platform.XP, true},
    };
}
 
Example 4
Source File: DriverFactoryTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldRegisterCorrectDefaultsOnWindows() {
  DefaultDriverFactory factory = new DefaultDriverFactory(Platform.VISTA);

  assertTrue(canInstantiate(factory, CHROME));
  assertTrue(canInstantiate(factory, EDGE));
  assertTrue(canInstantiate(factory, FIREFOX));
  assertFalse(canInstantiate(factory, SAFARI));
  assertTrue(canInstantiate(factory, IE));
}
 
Example 5
Source File: DriverFactoryTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldMatchAgainstAnyPlatformWhenRequestingAny() {
  DesiredCapabilities windowsVista = new DesiredCapabilities("browser", "v1", Platform.VISTA);
  DesiredCapabilities windowsXp = new DesiredCapabilities("browser", "v1", Platform.XP);
  DesiredCapabilities anyWindows = new DesiredCapabilities("browser", "v1", Platform.ANY);

  DriverProvider provider = mockDriverProviderFor(windowsVista);

  factory.registerDriverProvider(provider);

  assertEquals(provider, factory.getProviderMatching(windowsVista));
  assertEquals(provider, factory.getProviderMatching(anyWindows));
  assertEquals("Should always get a match if a driver has been registered",
               provider, factory.getProviderMatching(windowsXp));
}
 
Example 6
Source File: CapabilitiesComparatorTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void pickingVistaFromVariousLists() {
  Capabilities any = capabilities(BrowserType.IE, "", Platform.ANY, true);
  Capabilities windows = capabilities(BrowserType.IE, "", Platform.WINDOWS, true);
  Capabilities xp = capabilities(BrowserType.IE, "", Platform.XP, true);
  Capabilities vista = capabilities(BrowserType.IE, "", Platform.VISTA, true);

  Platform current = Platform.WINDOWS;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);

  current = Platform.VISTA;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(any, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);

  current = Platform.XP;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(any, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);
}
 
Example 7
Source File: AssumeCapabilityTest.java    From hifive-pitalium with Apache License 2.0 4 votes vote down vote up
@CapabilityFilter(platform = Platform.VISTA)
@Test
public void nonMatchParam() throws Exception {
	assertAllAssumed();
}
 
Example 8
Source File: Browser.java    From kurento-java with Apache License 2.0 4 votes vote down vote up
private void createChromeBrowser(DesiredCapabilities capabilities) throws MalformedURLException {

    if (scope == BrowserScope.LOCAL) {
      // Management of chromedriver
      WebDriverManager.chromedriver().setup();
    }

    // Chrome options
    ChromeOptions options = new ChromeOptions();

    // Chrome extensions
    if (extensions != null && !extensions.isEmpty()) {

      for (Map<String, String> extension : extensions) {
        InputStream is = getExtensionAsInputStream(extension.values().iterator().next());
        if (is != null) {
          try {
            File crx = File.createTempFile(extension.keySet().iterator().next(), ".crx");
            FileUtils.copyInputStreamToFile(is, crx);
            options.addExtensions(crx);
          } catch (Throwable t) {
            log.error("Error loading Chrome extension {} ({} : {})", extension, t.getClass(),
                t.getMessage());
          }
        }
      }
    }

    if (enableScreenCapture) {
      // This flag enables the screen sharing
      options.addArguments("--enable-usermedia-screen-capturing");

      String windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT;
      if (platform != null
          && (platform == Platform.WINDOWS || platform == Platform.XP || platform == Platform.VISTA
              || platform == Platform.WIN8 || platform == Platform.WIN8_1)) {

        windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT_WIN;
      }
      options.addArguments("--auto-select-desktop-capture-source="
          + getProperty(TEST_SCREEN_SHARE_TITLE_PROPERTY, windowTitle));

    } else {
      // This flag avoids grant the camera
      options.addArguments("--use-fake-ui-for-media-stream");
    }

    // This flag avoids warning in Chrome. See:
    // https://code.google.com/p/chromedriver/issues/detail?id=799
    options.addArguments("--test-type");

    // To avoid problems with DevToolsActivePort
    options.addArguments("--no-sandbox");

    if (protocol == Protocol.FILE) {
      // This flag allows reading local files in video tags
      options.addArguments("--allow-file-access-from-files");
    }

    if (!usePhysicalCam) {
      // This flag makes using a synthetic video (green with
      // spinner) in WebRTC. Or it is needed to combine with
      // use-file-for-fake-video-capture to use a file faking the
      // cam
      options.addArguments("--use-fake-device-for-media-stream=fps=30");

      if (video != null && (isLocal() || isDocker() || isElastest())) {

        if (!Files.exists(Paths.get(video))) {
          throw new RuntimeException("Trying to create a browser using video file " + video
              + ", but this file doesn't exist.");
        }

        File videoFile = new File(video);
        log.debug("Using video {} in browser {} (exists {}, {} bytes, can read {})", video, id,
            videoFile.exists(), videoFile.length(), videoFile.canRead());
        options.addArguments("--use-file-for-fake-video-capture=" + video);
      }
    }

    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());

    createDriver(capabilities, options);
  }