mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: API REST testing improved
parent
cc1bb3aedf
commit
75ae4695a8
|
@ -787,12 +787,37 @@ public class OpenViduTestAppE2eTest {
|
|||
user.getDriver().findElement(By.id("session-name-input-0")).clear();
|
||||
user.getDriver().findElement(By.id("session-name-input-0")).sendKeys(sessionName);
|
||||
|
||||
// Try to record a non-existing session
|
||||
// API REST test
|
||||
user.getDriver().findElement(By.id("session-api-btn-0")).click();
|
||||
Thread.sleep(1000);
|
||||
|
||||
// Try to record a non-existing session
|
||||
user.getDriver().findElement(By.id("start-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [404]"));
|
||||
|
||||
listEmptyRecordings();
|
||||
|
||||
// Try to stop a non-existing recording
|
||||
user.getDriver().findElement(By.id("recording-id-field")).sendKeys("FAIL");
|
||||
user.getDriver().findElement(By.id("stop-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [404]"));
|
||||
|
||||
listEmptyRecordings();
|
||||
|
||||
// Try to get a non-existing recording
|
||||
user.getDriver().findElement(By.id("get-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [404]"));
|
||||
|
||||
listEmptyRecordings();
|
||||
|
||||
// Try to delete a non-existing recording
|
||||
user.getDriver().findElement(By.id("get-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [404]"));
|
||||
|
||||
user.getDriver().findElement(By.id("close-dialog-btn")).click();
|
||||
Thread.sleep(1000);
|
||||
|
||||
|
@ -826,6 +851,28 @@ public class OpenViduTestAppE2eTest {
|
|||
|
||||
user.getDriver().findElement(By.id("recording-id-field")).clear();
|
||||
user.getDriver().findElement(By.id("recording-id-field")).sendKeys(sessionName);
|
||||
|
||||
// Try to start an ongoing recording
|
||||
user.getDriver().findElement(By.id("start-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [409]"));
|
||||
|
||||
// Try to get a existing recording
|
||||
user.getDriver().findElement(By.id("get-recording-btn")).click();
|
||||
user.getWaiter().until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value",
|
||||
"Recording got [" + sessionName + "]"));
|
||||
|
||||
// Try to delete a ongoing recording
|
||||
user.getDriver().findElement(By.id("delete-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Error [409]"));
|
||||
|
||||
// List existing recordings (one)
|
||||
user.getDriver().findElement(By.id("list-recording-btn")).click();
|
||||
user.getWaiter().until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value",
|
||||
"Recording list [" + sessionName + "]"));
|
||||
|
||||
// Stop ongoing recording
|
||||
user.getDriver().findElement(By.id("stop-recording-btn")).click();
|
||||
user.getWaiter().until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value",
|
||||
"Recording stopped [" + sessionName + "]"));
|
||||
|
@ -841,6 +888,17 @@ public class OpenViduTestAppE2eTest {
|
|||
Assert.assertTrue(file2.exists() || file2.length() > 0);
|
||||
Assert.assertTrue(file3.exists() || file3.length() > 0);
|
||||
|
||||
// Try to get the stopped recording
|
||||
user.getDriver().findElement(By.id("get-recording-btn")).click();
|
||||
user.getWaiter().until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value",
|
||||
"Recording got [" + sessionName + "]"));
|
||||
|
||||
// Try to list the stopped recording
|
||||
user.getDriver().findElement(By.id("list-recording-btn")).click();
|
||||
user.getWaiter().until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value",
|
||||
"Recording list [" + sessionName + "]"));
|
||||
|
||||
// Delete the recording
|
||||
user.getDriver().findElement(By.id("delete-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Recording deleted"));
|
||||
|
@ -853,6 +911,13 @@ public class OpenViduTestAppE2eTest {
|
|||
|
||||
}
|
||||
|
||||
private void listEmptyRecordings() {
|
||||
// List existing recordings (empty)
|
||||
user.getDriver().findElement(By.id("list-recording-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "Recording list []"));
|
||||
}
|
||||
|
||||
private ExpectedCondition<Boolean> waitForVideoDuration(WebElement element, int durationInSeconds) {
|
||||
return new ExpectedCondition<Boolean>() {
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ import { StreamManager } from 'openvidu-browser';
|
|||
|
||||
@Component({
|
||||
selector: 'app-ov-video',
|
||||
template: '<video #videoElement [poster]=""></video>'
|
||||
template: '<video #videoElement [poster]="poster"></video>'
|
||||
})
|
||||
export class OpenViduVideoComponent implements AfterViewInit {
|
||||
|
||||
|
|
|
@ -291,13 +291,6 @@ export class VideoComponent implements OnInit, OnDestroy {
|
|||
if (this.eventCollection.videoElementCreated) {
|
||||
if (!oldValues.videoElementCreated) {
|
||||
sub.on('videoElementCreated', (event: VideoElementEvent) => {
|
||||
if (!sub.stream.hasVideo) {
|
||||
this.videoClasses = 'grey-background';
|
||||
this.videoPoster = 'assets/images/volume.png';
|
||||
} else {
|
||||
this.videoClasses = '';
|
||||
this.videoPoster = '';
|
||||
}
|
||||
this.updateEventListInParent.emit({
|
||||
event: 'videoElementCreated',
|
||||
content: event.element.id
|
||||
|
@ -325,6 +318,13 @@ export class VideoComponent implements OnInit, OnDestroy {
|
|||
if (this.eventCollection.streamPlaying) {
|
||||
if (!oldValues.streamPlaying) {
|
||||
sub.on('streamPlaying', (event: StreamManagerEvent) => {
|
||||
if (!sub.stream.hasVideo) {
|
||||
this.videoClasses = 'grey-background';
|
||||
this.videoPoster = 'assets/images/volume.png';
|
||||
} else {
|
||||
this.videoClasses = '';
|
||||
this.videoPoster = '';
|
||||
}
|
||||
this.showButtons = true;
|
||||
this.updateEventListInParent.emit({
|
||||
event: 'streamPlaying',
|
||||
|
@ -341,13 +341,6 @@ export class VideoComponent implements OnInit, OnDestroy {
|
|||
if (this.eventCollection.videoElementCreated) {
|
||||
if (!oldValues.videoElementCreated) {
|
||||
pub.on('videoElementCreated', (event: VideoElementEvent) => {
|
||||
if (!pub.stream.hasVideo) {
|
||||
this.videoClasses = 'grey-background';
|
||||
this.videoPoster = 'assets/images/volume.png';
|
||||
} else {
|
||||
this.videoClasses = '';
|
||||
this.videoPoster = '';
|
||||
}
|
||||
this.updateEventListInParent.emit({
|
||||
event: 'videoElementCreated',
|
||||
content: event.element.id
|
||||
|
@ -452,6 +445,13 @@ export class VideoComponent implements OnInit, OnDestroy {
|
|||
if (this.eventCollection.streamPlaying) {
|
||||
if (!oldValues.streamPlaying) {
|
||||
pub.on('streamPlaying', (event: StreamManagerEvent) => {
|
||||
if (!pub.stream.hasVideo) {
|
||||
this.videoClasses = 'grey-background';
|
||||
this.videoPoster = 'assets/images/volume.png';
|
||||
} else {
|
||||
this.videoClasses = '';
|
||||
this.videoPoster = '';
|
||||
}
|
||||
this.showButtons = true;
|
||||
this.updateEventListInParent.emit({
|
||||
event: 'streamPlaying',
|
||||
|
|
Loading…
Reference in New Issue