mirror of https://github.com/OpenVidu/openvidu.git
e2e subscribeTo tests
parent
705e7a4e82
commit
194f6fd3ce
|
@ -205,15 +205,17 @@ public class OpenViduEventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasAudioTracks(WebElement videoElement) {
|
private boolean hasAudioTracks(WebElement videoElement) {
|
||||||
long numberAudioTracks = (long) ((JavascriptExecutor) driver).executeScript(
|
boolean audioTracks = (boolean) ((JavascriptExecutor) driver).executeScript(
|
||||||
"return $('#" + videoElement.getAttribute("id") + "').prop('srcObject').getAudioTracks().length;");
|
"return ($('#" + videoElement.getAttribute("id") + "').prop('srcObject').getAudioTracks().length > 0)"
|
||||||
return (numberAudioTracks > 0);
|
+ "&& ($('#" + videoElement.getAttribute("id") + "').prop('srcObject').getAudioTracks()[0].enabled)");
|
||||||
|
return audioTracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasVideoTracks(WebElement videoElement) {
|
private boolean hasVideoTracks(WebElement videoElement) {
|
||||||
long numberAudioTracks = (long) ((JavascriptExecutor) driver).executeScript(
|
boolean videoTracks = (boolean) ((JavascriptExecutor) driver).executeScript(
|
||||||
"return $('#" + videoElement.getAttribute("id") + "').prop('srcObject').getVideoTracks().length;");
|
"return ($('#" + videoElement.getAttribute("id") + "').prop('srcObject').getVideoTracks().length > 0)"
|
||||||
return (numberAudioTracks > 0);
|
+ "&& ($('#" + videoElement.getAttribute("id") + "').prop('srcObject').getVideoTracks()[0].enabled)");
|
||||||
|
return videoTracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static org.openqa.selenium.OutputType.BASE64;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -95,16 +96,16 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupBrowser(String browser) {
|
void setupBrowser(String browser) {
|
||||||
|
|
||||||
switch (browser) {
|
switch (browser) {
|
||||||
case "chrome":
|
case "chrome":
|
||||||
this.user = new ChromeUser("TestUser", 50);
|
this.user = new ChromeUser("TestUser", 50);
|
||||||
break;
|
break;
|
||||||
case "firefox":
|
case "firefox":
|
||||||
this.user = new FirefoxUser("TestUser", 50);
|
this.user = new FirefoxUser("TestUser", 50);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.user = new ChromeUser("TestUser", 50);
|
this.user = new ChromeUser("TestUser", 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getDriver().get(APP_URL);
|
user.getDriver().get(APP_URL);
|
||||||
|
@ -127,7 +128,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2One Chrome [Video + Audio]")
|
@DisplayName("One2One Chrome [Video + Audio]")
|
||||||
void oneToOneVideoAudioSessionChrome() throws Exception {
|
void oneToOneVideoAudioSessionChrome() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("One2One Chrome [Video + Audio]");
|
log.info("One2One Chrome [Video + Audio]");
|
||||||
|
@ -136,7 +137,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getDriver().findElement(By.id("one2one-btn")).click();
|
user.getDriver().findElement(By.id("one2one-btn")).click();
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -145,14 +146,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2One [Audio]")
|
@DisplayName("One2One [Audio]")
|
||||||
void oneToOneAudioSession() throws Exception {
|
void oneToOneAudioSession() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("One2One [Audio]");
|
log.info("One2One [Audio]");
|
||||||
|
@ -174,7 +175,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 4);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 4);
|
||||||
user.getEventManager().waitUntilEventReaches("streamCreated", 1);
|
user.getEventManager().waitUntilEventReaches("streamCreated", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -183,14 +184,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, false));
|
true, false));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2One [Video]")
|
@DisplayName("One2One [Video]")
|
||||||
void oneToOneVideoSession() throws Exception {
|
void oneToOneVideoSession() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("One2One [Video]");
|
log.info("One2One [Video]");
|
||||||
|
@ -212,7 +213,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 4);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 4);
|
||||||
user.getEventManager().waitUntilEventReaches("streamCreated", 1);
|
user.getEventManager().waitUntilEventReaches("streamCreated", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -221,14 +222,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
false, true));
|
false, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2Many [Video + Audio]")
|
@DisplayName("One2Many [Video + Audio]")
|
||||||
void oneToManyVideoAudioSession() throws Exception {
|
void oneToManyVideoAudioSession() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("One2Many [Video + Audio]");
|
log.info("One2Many [Video + Audio]");
|
||||||
|
@ -237,7 +238,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getDriver().findElement(By.id("one2many-btn")).click();
|
user.getDriver().findElement(By.id("one2many-btn")).click();
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -245,14 +246,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true);
|
user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true);
|
||||||
|
|
||||||
gracefullyLeaveParticipants(4);
|
gracefullyLeaveParticipants(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Unique user remote subscription [Video + Audio]")
|
@DisplayName("Unique user remote subscription [Video + Audio]")
|
||||||
void oneRemoteSubscription() throws Exception {
|
void oneRemoteSubscription() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Unique user remote subscription [Video + Audio]");
|
log.info("Unique user remote subscription [Video + Audio]");
|
||||||
|
@ -265,7 +266,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 1);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("remoteVideoPlaying", 1);
|
user.getEventManager().waitUntilEventReaches("remoteVideoPlaying", 1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -274,14 +275,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(1);
|
gracefullyLeaveParticipants(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Unique user remote subscription Firefox [Video + Audio]")
|
@DisplayName("Unique user remote subscription Firefox [Video + Audio]")
|
||||||
void oneRemoteSubscriptionFirefox() throws Exception {
|
void oneRemoteSubscriptionFirefox() throws Exception {
|
||||||
|
|
||||||
setupBrowser("firefox");
|
setupBrowser("firefox");
|
||||||
|
|
||||||
log.info("Unique user remote subscription Firefox [Video + Audio]");
|
log.info("Unique user remote subscription Firefox [Video + Audio]");
|
||||||
|
@ -292,22 +293,22 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
|
user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
||||||
|
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
gracefullyLeaveParticipants(1);
|
gracefullyLeaveParticipants(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Unique user remote subscription [ScreenShare + Audio]")
|
@DisplayName("Unique user remote subscription [ScreenShare + Audio]")
|
||||||
void oneRemoteSubscriptionScreen() throws Exception {
|
void oneRemoteSubscriptionScreen() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Unique user remote subscription [ScreenShare + Audio]");
|
log.info("Unique user remote subscription [ScreenShare + Audio]");
|
||||||
|
@ -321,7 +322,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 1);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 1);
|
||||||
user.getEventManager().waitUntilEventReaches("remoteVideoPlaying", 1);
|
user.getEventManager().waitUntilEventReaches("remoteVideoPlaying", 1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -330,14 +331,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(1);
|
gracefullyLeaveParticipants(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Many2Many [Video + Audio]")
|
@DisplayName("Many2Many [Video + Audio]")
|
||||||
void manyToManyVideoAudioSession() throws Exception {
|
void manyToManyVideoAudioSession() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Many2Many [Video + Audio]");
|
log.info("Many2Many [Video + Audio]");
|
||||||
|
@ -357,7 +358,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 16);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 16);
|
||||||
user.getEventManager().waitUntilEventReaches("streamCreated", 6);
|
user.getEventManager().waitUntilEventReaches("streamCreated", 6);
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 16);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 16);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -366,14 +367,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(4);
|
gracefullyLeaveParticipants(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Secure Test")
|
@DisplayName("Secure Test")
|
||||||
void secureTest() throws Exception {
|
void secureTest() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Secure Test");
|
log.info("Secure Test");
|
||||||
|
@ -407,7 +408,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("videoElementCreated", 16);
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 16);
|
||||||
user.getEventManager().waitUntilEventReaches("streamCreated", 6);
|
user.getEventManager().waitUntilEventReaches("streamCreated", 6);
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 16);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 16);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -416,14 +417,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(4);
|
gracefullyLeaveParticipants(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2One Firefox [Video + Audio]")
|
@DisplayName("One2One Firefox [Video + Audio]")
|
||||||
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
||||||
|
|
||||||
setupBrowser("firefox");
|
setupBrowser("firefox");
|
||||||
|
|
||||||
log.info("One2One Firefox [Video + Audio]");
|
log.info("One2One Firefox [Video + Audio]");
|
||||||
|
@ -432,7 +433,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getDriver().findElement(By.id("one2one-btn")).click();
|
user.getDriver().findElement(By.id("one2one-btn")).click();
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -441,14 +442,14 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Cross-Browser test")
|
@DisplayName("Cross-Browser test")
|
||||||
void crossBrowserTest() throws Exception {
|
void crossBrowserTest() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Cross-Browser test");
|
log.info("Cross-Browser test");
|
||||||
|
@ -496,7 +497,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getDriver().findElement(By.className("join-btn")).click();
|
user.getDriver().findElement(By.className("join-btn")).click();
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(getBase64Screenshot(user));
|
System.out.println(getBase64Screenshot(user));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -505,7 +506,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(1);
|
gracefullyLeaveParticipants(1);
|
||||||
|
|
||||||
t.join();
|
t.join();
|
||||||
|
@ -516,11 +517,11 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Signal message")
|
@DisplayName("Signal message")
|
||||||
void oneToManySignalMessage() throws Exception {
|
void oneToManySignalMessage() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Signal message");
|
log.info("Signal message");
|
||||||
|
@ -529,12 +530,12 @@ public class OpenViduTestAppE2eTest {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
addUser.click();
|
addUser.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WebElement> publishCheckboxes = user.getDriver().findElements(By.className("publish-checkbox"));
|
List<WebElement> publishCheckboxes = user.getDriver().findElements(By.className("publish-checkbox"));
|
||||||
for (WebElement el : publishCheckboxes) {
|
for (WebElement el : publishCheckboxes) {
|
||||||
el.click();
|
el.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WebElement> joinButtons = user.getDriver().findElements(By.className("join-btn"));
|
List<WebElement> joinButtons = user.getDriver().findElements(By.className("join-btn"));
|
||||||
for (WebElement el : joinButtons) {
|
for (WebElement el : joinButtons) {
|
||||||
el.sendKeys(Keys.ENTER);
|
el.sendKeys(Keys.ENTER);
|
||||||
|
@ -543,50 +544,72 @@ public class OpenViduTestAppE2eTest {
|
||||||
user.getEventManager().waitUntilEventReaches("connectionCreated", 16);
|
user.getEventManager().waitUntilEventReaches("connectionCreated", 16);
|
||||||
user.getDriver().findElements(By.className(("message-btn"))).get(0).click();
|
user.getDriver().findElements(By.className(("message-btn"))).get(0).click();
|
||||||
user.getEventManager().waitUntilEventReaches("signal", 4);
|
user.getEventManager().waitUntilEventReaches("signal", 4);
|
||||||
|
|
||||||
gracefullyLeaveParticipants(4);
|
gracefullyLeaveParticipants(4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Subscribe Unsubscribe")
|
@DisplayName("Subscribe Unsubscribe")
|
||||||
void subscribeUnsubscribeTest() throws Exception {
|
void subscribeUnsubscribeTest() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Signal message");
|
log.info("Signal message");
|
||||||
|
|
||||||
user.getDriver().findElement(By.id("one2one-btn")).click();
|
user.getDriver().findElement(By.id("one2one-btn")).click();
|
||||||
user.getDriver().findElements(By.className("publish-checkbox")).get(0).click();
|
user.getDriver().findElements(By.className("publish-checkbox")).get(0).click();
|
||||||
|
|
||||||
List<WebElement> joinButtons = user.getDriver().findElements(By.className("join-btn"));
|
List<WebElement> joinButtons = user.getDriver().findElements(By.className("join-btn"));
|
||||||
for (WebElement el : joinButtons) {
|
for (WebElement el : joinButtons) {
|
||||||
el.sendKeys(Keys.ENTER);
|
el.sendKeys(Keys.ENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
||||||
|
|
||||||
Assert.assertEquals(user.getDriver().findElements(By.tagName("video")).size(), 2);
|
Assert.assertEquals(user.getDriver().findElements(By.tagName("video")).size(), 2);
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
|
// Global unsubscribe-subscribe
|
||||||
|
|
||||||
user.getDriver().findElements(By.className(("sub-btn"))).get(0).click();
|
user.getDriver().findElements(By.className(("sub-btn"))).get(0).click();
|
||||||
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 1));
|
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 1));
|
||||||
user.getDriver().findElements(By.className(("sub-btn"))).get(0).click();
|
user.getDriver().findElements(By.className(("sub-btn"))).get(0).click();
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 3);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 3);
|
||||||
|
|
||||||
Assert.assertEquals(user.getDriver().findElements(By.tagName("video")).size(), 2);
|
Assert.assertEquals(user.getDriver().findElements(By.tagName("video")).size(), 2);
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
|
// Video unsubscribe
|
||||||
|
|
||||||
|
Iterable<WebElement> firstVideo = Arrays.asList(user.getDriver().findElements(By.tagName("video")).get(0));
|
||||||
|
user.getDriver().findElements(By.className(("sub-video-btn"))).get(0).click();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(firstVideo, true, false));
|
||||||
|
|
||||||
|
// Audio unsubscribe
|
||||||
|
|
||||||
|
user.getDriver().findElements(By.className(("sub-audio-btn"))).get(0).click();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(firstVideo, false, false));
|
||||||
|
|
||||||
|
// Video and audio subscribe
|
||||||
|
|
||||||
|
user.getDriver().findElements(By.className(("sub-video-btn"))).get(0).click();
|
||||||
|
user.getDriver().findElements(By.className(("sub-audio-btn"))).get(0).click();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(firstVideo, true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Publish Unpublish")
|
@DisplayName("Publish Unpublish")
|
||||||
void publishUnpublishTest() throws Exception {
|
void publishUnpublishTest() throws Exception {
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Signal message");
|
log.info("Signal message");
|
||||||
|
@ -605,41 +628,41 @@ public class OpenViduTestAppE2eTest {
|
||||||
for (WebElement el : publishButtons) {
|
for (WebElement el : publishButtons) {
|
||||||
el.click();
|
el.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("streamDestroyed", 4);
|
user.getEventManager().waitUntilEventReaches("streamDestroyed", 4);
|
||||||
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 0));
|
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 0));
|
||||||
|
|
||||||
for (WebElement el : publishButtons) {
|
for (WebElement el : publishButtons) {
|
||||||
el.click();
|
el.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 8);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 8);
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Change publisher dynamically")
|
@DisplayName("Change publisher dynamically")
|
||||||
void changePublisher() throws Exception {
|
void changePublisher() throws Exception {
|
||||||
|
|
||||||
List<Boolean> listOfThreadAssertions = new ArrayList<>();
|
List<Boolean> listOfThreadAssertions = new ArrayList<>();
|
||||||
|
|
||||||
setupBrowser("chrome");
|
setupBrowser("chrome");
|
||||||
|
|
||||||
log.info("Change publisher dynamically");
|
log.info("Change publisher dynamically");
|
||||||
|
|
||||||
WebElement oneToManyInput = user.getDriver().findElement(By.id("one2many-input"));
|
WebElement oneToManyInput = user.getDriver().findElement(By.id("one2many-input"));
|
||||||
oneToManyInput.clear();
|
oneToManyInput.clear();
|
||||||
oneToManyInput.sendKeys("1");
|
oneToManyInput.sendKeys("1");
|
||||||
|
|
||||||
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
|
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
|
||||||
|
|
||||||
// First publication (audio + video [CAMERA])
|
// First publication (audio + video [CAMERA])
|
||||||
user.getEventManager().on("videoPlaying", (event)-> {
|
user.getEventManager().on("videoPlaying", (event) -> {
|
||||||
listOfThreadAssertions.add(((String)event.get("eventContent")).contains("CAMERA"));
|
listOfThreadAssertions.add(((String) event.get("eventContent")).contains("CAMERA"));
|
||||||
});
|
});
|
||||||
user.getDriver().findElement(By.id("one2many-btn")).click();
|
user.getDriver().findElement(By.id("one2many-btn")).click();
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 2);
|
||||||
|
@ -651,10 +674,10 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
// Second publication (only video (SCREEN))
|
// Second publication (only video (SCREEN))
|
||||||
user.getEventManager().on("videoPlaying", (event)-> {
|
user.getEventManager().on("videoPlaying", (event) -> {
|
||||||
listOfThreadAssertions.add(((String)event.get("eventContent")).contains("SCREEN"));
|
listOfThreadAssertions.add(((String) event.get("eventContent")).contains("SCREEN"));
|
||||||
});
|
});
|
||||||
user.getDriver().findElements(By.className("change-publisher-btn")).get(0).click();
|
user.getDriver().findElements(By.className("change-publisher-btn")).get(0).click();
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 4);
|
||||||
|
@ -663,13 +686,13 @@ public class OpenViduTestAppE2eTest {
|
||||||
Assert.assertTrue(iter.next());
|
Assert.assertTrue(iter.next());
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
false, true));
|
false, true));
|
||||||
|
|
||||||
// Third publication (audio + video [CAMERA])
|
// Third publication (audio + video [CAMERA])
|
||||||
user.getEventManager().on("videoPlaying", (event)-> {
|
user.getEventManager().on("videoPlaying", (event) -> {
|
||||||
listOfThreadAssertions.add(((String)event.get("eventContent")).contains("CAMERA"));
|
listOfThreadAssertions.add(((String) event.get("eventContent")).contains("CAMERA"));
|
||||||
});
|
});
|
||||||
user.getDriver().findElements(By.className("change-publisher-btn")).get(0).click();
|
user.getDriver().findElements(By.className("change-publisher-btn")).get(0).click();
|
||||||
user.getEventManager().waitUntilEventReaches("videoPlaying", 6);
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 6);
|
||||||
|
@ -678,20 +701,22 @@ public class OpenViduTestAppE2eTest {
|
||||||
Assert.assertTrue(iter.next());
|
Assert.assertTrue(iter.next());
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
true, true));
|
true, true));
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gracefullyLeaveParticipants(int numberOfParticipants) throws Exception {
|
private void gracefullyLeaveParticipants(int numberOfParticipants) throws Exception {
|
||||||
int accumulatedConnectionDestroyed = 0;
|
int accumulatedConnectionDestroyed = 0;
|
||||||
for (int j = 1; j <= numberOfParticipants; j++) {
|
for (int j = 1; j <= numberOfParticipants; j++) {
|
||||||
user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER);
|
user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER);
|
||||||
user.getEventManager().waitUntilEventReaches("sessionDisconnected", j);
|
user.getEventManager().waitUntilEventReaches("sessionDisconnected", j);
|
||||||
accumulatedConnectionDestroyed = (j != numberOfParticipants) ? (accumulatedConnectionDestroyed + numberOfParticipants - j) : (accumulatedConnectionDestroyed);
|
accumulatedConnectionDestroyed = (j != numberOfParticipants)
|
||||||
|
? (accumulatedConnectionDestroyed + numberOfParticipants - j)
|
||||||
|
: (accumulatedConnectionDestroyed);
|
||||||
user.getEventManager().waitUntilEventReaches("connectionDestroyed", accumulatedConnectionDestroyed);
|
user.getEventManager().waitUntilEventReaches("connectionDestroyed", accumulatedConnectionDestroyed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue