List of usage examples for org.openqa.selenium Platform MAC
Platform MAC
To view the source code for org.openqa.selenium Platform MAC.
Click Source Link
From source file:com.rmn.qa.AutomationRunRequestTest.java
License:Open Source License
@Test // Tests that two run request objects do match each other due to mismatching OS public void testMatchesOtherRunRequestBadOs() { String uuid = "testUuid"; String browser = "firefox"; String browserVersion = "20"; Platform os = Platform.LINUX;//from ww w . ja v a 2 s. co m AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os); AutomationRunRequest second = new AutomationRunRequest(uuid, null, browser, browserVersion, Platform.MAC); Assert.assertFalse("Run requests should NOT match due to browser", first.matchesCapabilities(second)); }
From source file:com.rmn.qa.AutomationRunRequestTest.java
License:Open Source License
@Test // Tests that two run request objects match each other when option fields are not set on the first object public void testMatchesCapabilitiesOptionalParameters() { String uuid = "testUuid"; String browser = "firefox"; String browserVersion = null; Platform os = null;/*from w w w. ja v a 2 s .c om*/ Map<String, Object> map = Maps.newHashMap(); map.put(CapabilityType.BROWSER_NAME, browser); map.put(CapabilityType.VERSION, "20"); map.put(CapabilityType.PLATFORM, Platform.MAC); AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os); Assert.assertTrue("Capabilities should match", first.matchesCapabilities(map)); }
From source file:com.rmn.qa.AutomationRunRequestTest.java
License:Open Source License
@Test // Tests that two run request objects do NOT match each other since the optional fields are on the second object public void testMatchesCapabilitiesNonOptionalParameters() { String uuid = "testUuid"; String browser = "firefox"; String browserVersion = "21"; Platform os = Platform.LINUX;/*from www. jav a 2 s .c om*/ Map<String, Object> map = Maps.newHashMap(); map.put(CapabilityType.BROWSER_NAME, browser); map.put(CapabilityType.VERSION, "20"); map.put(CapabilityType.PLATFORM, Platform.MAC); AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os); Assert.assertFalse("Capabilities should NOT match", first.matchesCapabilities(map)); }
From source file:com.rmn.qa.AutomationUtils.java
License:Open Source License
/** * Returns the underlying 'family' of the specified platform * @param platform// w w w . j a v a 2s .c o m * @return */ public static Platform getUnderlyingFamily(Platform platform) { if (platform == null) { return null; } if (platform == Platform.UNIX || platform == Platform.WINDOWS || platform == Platform.MAC || platform == Platform.ANY) { return platform; } else { return getUnderlyingFamily(platform.family()); } }
From source file:com.rmn.qa.aws.VmManagerTest.java
License:Open Source License
@Test // Test if a bad OS is specified, it is handled correctly public void testLaunchNodesBadOs() throws NodesCouldNotBeStartedException { MockAmazonEc2Client client = new MockAmazonEc2Client(null); RunInstancesResult runInstancesResult = new RunInstancesResult(); Reservation reservation = new Reservation(); reservation.setInstances(Arrays.asList(new Instance())); runInstancesResult.setReservation(reservation); client.setRunInstances(runInstancesResult); Properties properties = new Properties(); String region = "east", uuid = "uuid", browser = "chrome"; Platform os = Platform.MAC; Integer threadCount = 5, maxSessions = 5; MockManageVm manageEC2 = new MockManageVm(client, properties, region); String userData = "userData"; String securityGroup = "securityGroup", subnetId = "subnetId", keyName = "keyName", windowsImage = "windowsImage"; properties.setProperty(region + "_security_group", securityGroup); properties.setProperty(region + "_subnet_id", subnetId); properties.setProperty(region + "_key_name", keyName); properties.setProperty(region + "_windows_node_ami", windowsImage); manageEC2.setUserData(userData);// w ww. j ava 2 s .c om try { manageEC2.launchNodes(uuid, os, browser, null, threadCount, maxSessions); } catch (RuntimeException e) { Assert.assertTrue("Failure message should be correct", e.getMessage().contains(os.toString())); return; } Assert.fail("Call should fail due to invalid OS"); }
From source file:com.rmn.qa.aws.VmManagerTest.java
License:Open Source License
@Test // Test that the correct exception is throw when you specified a bad OS for the node config public void testGetNodeConfigBadOs() { MockManageVm manageEC2 = new MockManageVm(null, null, null); String uuid = "uuid", hostName = "hostName", browser = "chrome"; Platform os = Platform.MAC; int maxSessions = 5; try {// ww w. j ava 2 s . c o m manageEC2.getNodeConfig(uuid, hostName, browser, os, maxSessions); } catch (RuntimeException e) { Assert.assertTrue("Failure message should be correct", e.getMessage().contains(os.toString())); return; } Assert.fail("Node config should not work due to bad OS"); }
From source file:com.seleniumtests.browserfactory.mobile.InstrumentsWrapper.java
License:Apache License
private void checkInstallation() { if (OSUtility.getCurrentPlatorm() != Platform.MAC) { throw new ConfigurationException("InstrumentsWrapper can only be used on Mac"); }//from ww w.j a va 2s . c o m String out = OSCommand.executeCommandAndWait("instruments"); if (!out.contains("instruments, version")) { throw new ConfigurationException("Instruments is not installed"); } }
From source file:com.seleniumtests.core.SeleniumTestsContext.java
License:Apache License
/** * From platform name, in case of Desktop platform, do nothing and in case of mobile, extract OS version from name * as platformName will be 'Android 5.0' for example * * @throws ConfigurationException in mobile, if version is not present *///from w w w . j a v a 2 s .co m private void updatePlatformVersion() { try { Platform currentPlatform = Platform.fromString(getPlatform()); if (currentPlatform.is(Platform.WINDOWS) || currentPlatform.is(Platform.MAC) || currentPlatform.is(Platform.UNIX) || currentPlatform.is(Platform.ANY) && getRunMode() == DriverMode.GRID) { return; } else { throw new WebDriverException(""); } } catch (WebDriverException e) { if (getPlatform().toLowerCase().startsWith("android") || getPlatform().toLowerCase().startsWith("ios")) { String[] pfVersion = getPlatform().split(" ", 2); try { setPlatform(pfVersion[0]); setMobilePlatformVersion(pfVersion[1]); return; } catch (IndexOutOfBoundsException x) { setMobilePlatformVersion(null); logger.warn( "For mobile platform, platform name should contain version. Ex: 'Android 5.0' or 'iOS 9.1'. Else, first found device is used"); } } else { throw new ConfigurationException( String.format("Platform %s has not been recognized as a valid platform", getPlatform())); } } }
From source file:com.seleniumtests.ut.browserfactory.mobile.TestInstrumentsWrapper.java
License:Apache License
@Test(groups = { "ut" }) public void testOnMac() { PowerMockito.mockStatic(OSUtility.class); PowerMockito.mockStatic(OSCommand.class); when(OSCommand.executeCommandAndWait("instruments")).thenReturn("instruments, version 8.3.2 (62124)"); when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.MAC); new InstrumentsWrapper(); }
From source file:com.seleniumtests.ut.browserfactory.mobile.TestInstrumentsWrapper.java
License:Apache License
@Test(groups = { "ut" }) public void testiOSDeviceRetrieving() { PowerMockito.mockStatic(OSCommand.class); PowerMockito.mockStatic(OSUtility.class); when(OSCommand.executeCommandAndWait("instruments")).thenReturn("instruments, version 8.3.2 (62124)"); when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.MAC); when(OSCommand.executeCommandAndWait("instruments -s devices")) .thenReturn("Mac mini de Thoraval [CBFA063D-2535-5FD8-BA05-CE8D3683D6BA]\n" + "Apple TV 1080p (10.2) [6444F65D-DA15-4505-8307-4520FD346ACE] (Simulator)\n" + "iPad Air (10.3) [77FCE24A-EC11-490B-AFA6-D5950EACD33D] (Simulator)\n" + "iPad Air 2 (10.3) [EF9D4D32-285D-4D08-B145-1B704A6E1B14] (Simulator)\n" + "iPad Pro (12.9 inch) (10.3) [D723D123-C176-4CDD-937E-34060F9AC31A] (Simulator)\n" + "iPhone 5 (10.3) [5621105C-180C-438D-9AC4-1361F9BFA553] (Simulator)\n" + "iPhone 6 (10.3) [8CAD959E-4AD2-4CA1-9072-300E1A738027] (Simulator)\n" + "iPhone 6 Plus (10.3) [FEB56FF6-5705-45F6-8D0F-4958ACA91FF5] (Simulator)\n" + "iPhone 7 (10.3) [D11D74FE-A620-403C-BAAA-1E0FF4486238] (Simulator)\n" + "iPhone 7 (10.3) + Apple Watch Series 2 - 38mm (3.2) [84DA8FFA-F743-4EA6-8E98-DC38165B9ACB] (Simulator)\n" + "iPhone SE (10.3.1) [2FD40F1E-45A2-4580-95D4-5B850E438953] (Simulator)"); InstrumentsWrapper wrapper = new InstrumentsWrapper(); List<MobileDevice> devs = wrapper.parseIosDevices(); Assert.assertEquals(devs.size(), 10); Assert.assertEquals(devs.get(8).getName(), "iPhone 7"); Assert.assertEquals(devs.get(3).getName(), "iPad Pro"); Assert.assertEquals(devs.get(8).getVersion(), "10.3"); Assert.assertEquals(devs.get(8).getId(), "84DA8FFA-F743-4EA6-8E98-DC38165B9ACB"); Assert.assertEquals(devs.get(8).getPlatform(), "iOS"); Assert.assertEquals(devs.get(8).getBrowsers().get(0).getBrowser(), BrowserType.SAFARI); Assert.assertEquals(devs.get(9).getVersion(), "10.3.1"); }