openvidu-test-e2e: Chrome Android emulator test

pull/203/head
pabloFuente 2019-02-10 19:21:00 +01:00
parent ca246d2d37
commit a68e831d29
2 changed files with 30 additions and 7 deletions

View File

@ -481,6 +481,30 @@ public class OpenViduTestAppE2eTest {
gracefullyLeaveParticipants(2); gracefullyLeaveParticipants(2);
} }
@Test
@DisplayName("One2One Chrome Android")
void oneToOneChromeAndroid() throws Exception {
setupBrowser("chromeAndroid");
log.info("One2One Chrome Android");
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
user.getDriver().findElement(By.id("one2one-btn")).click();
user.getEventManager().waitUntilEventReaches("connectionCreated", 4);
user.getEventManager().waitUntilEventReaches("accessAllowed", 2);
user.getEventManager().waitUntilEventReaches("streamCreated", 4);
user.getEventManager().waitUntilEventReaches("streamPlaying", 4);
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
.assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
gracefullyLeaveParticipants(2);
}
@Test @Test
@DisplayName("Cross-Browser test") @DisplayName("Cross-Browser test")
void crossBrowserTest() throws Exception { void crossBrowserTest() throws Exception {

View File

@ -34,19 +34,18 @@ public class ChromeAndroidUser extends BrowserUser {
super(userName, timeOfWaitInSeconds); super(userName, timeOfWaitInSeconds);
Map<String, String> mobileEmulation = new HashMap<>(); Map<String, String> mobileEmulation = new HashMap<>();
mobileEmulation.put("deviceName", "Nexus 5"); mobileEmulation.put("deviceName", "Pixel 2");
ChromeOptions options = new ChromeOptions(); ChromeOptions chromeOptions = new ChromeOptions();
options.setExperimentalOption("mobileEmulation", mobileEmulation); chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setAcceptInsecureCerts(true); capabilities.setAcceptInsecureCerts(true);
// This flag avoids to grant the user media // This flag avoids to grant the user media
options.addArguments("--use-fake-ui-for-media-stream"); chromeOptions.addArguments("--use-fake-ui-for-media-stream");
// This flag fakes user media with synthetic video // This flag fakes user media with synthetic video
options.addArguments("--use-fake-device-for-media-stream"); chromeOptions.addArguments("--use-fake-device-for-media-stream");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
String REMOTE_URL = System.getProperty("REMOTE_URL_CHROME"); String REMOTE_URL = System.getProperty("REMOTE_URL_CHROME");
if (REMOTE_URL != null) { if (REMOTE_URL != null) {
@ -58,7 +57,7 @@ public class ChromeAndroidUser extends BrowserUser {
} }
} else { } else {
log.info("Using local web driver"); log.info("Using local web driver");
this.driver = new ChromeDriver(capabilities); this.driver = new ChromeDriver(chromeOptions);
} }
this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS); this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);