mirror of https://github.com/OpenVidu/openvidu.git
e2e updated to test local recorder feature
parent
20277a4c1d
commit
b5698a75dc
File diff suppressed because it is too large
Load Diff
|
@ -9,29 +9,29 @@
|
||||||
"merge": "1.2.0",
|
"merge": "1.2.0",
|
||||||
"platform": "^1.3.5",
|
"platform": "^1.3.5",
|
||||||
"sdp-translator": "0.1.24",
|
"sdp-translator": "0.1.24",
|
||||||
"ua-parser-js": "0.7.17",
|
"ua-parser-js": "0.7.18",
|
||||||
"uuid": "3.2.1",
|
"uuid": "3.2.1",
|
||||||
"webrtc-adapter": "6.1.4",
|
"webrtc-adapter": "6.1.5",
|
||||||
"wolfy87-eventemitter": "5.2.4"
|
"wolfy87-eventemitter": "5.2.4"
|
||||||
},
|
},
|
||||||
"description": "OpenVidu Browser",
|
"description": "OpenVidu Browser",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browserify": "16.1.1",
|
"browserify": "16.1.1",
|
||||||
"grunt": "^1.0.1",
|
"grunt": "1.0.2",
|
||||||
"grunt-autoprefixer": "^3.0.4",
|
"grunt-autoprefixer": "3.0.4",
|
||||||
"grunt-cli": "^1.2.0",
|
"grunt-cli": "1.2.0",
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
"grunt-contrib-copy": "1.0.0",
|
||||||
"grunt-contrib-sass": "^1.0.0",
|
"grunt-contrib-sass": "1.0.0",
|
||||||
"grunt-contrib-uglify": "^2.3.0",
|
"grunt-contrib-uglify": "3.3.0",
|
||||||
"grunt-contrib-watch": "~1.0.0",
|
"grunt-contrib-watch": "1.1.0",
|
||||||
"grunt-string-replace": "^1.0.0",
|
"grunt-string-replace": "1.3.1",
|
||||||
"grunt-ts": "^5.5.1",
|
"grunt-ts": "6.0.0-beta.19",
|
||||||
"tsify": "4.0.0",
|
"tsify": "4.0.0",
|
||||||
"tslint": "^5.9.1",
|
"tslint": "5.10.0",
|
||||||
"typedoc": "^0.11.1",
|
"typedoc": "0.11.1",
|
||||||
"typedoc-plugin-sourcefile-url": "^1.0.3",
|
"typedoc-plugin-sourcefile-url": "1.0.3",
|
||||||
"typescript": "2.8.3",
|
"typescript": "2.8.3",
|
||||||
"uglify-js": "3.3.20"
|
"uglify-js": "3.3.25"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
@ -36,7 +37,9 @@ import org.junit.Assert;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.Keys;
|
import org.openqa.selenium.Keys;
|
||||||
import org.openqa.selenium.TakesScreenshot;
|
import org.openqa.selenium.TakesScreenshot;
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.support.ui.ExpectedCondition;
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
|
|
||||||
import io.github.bonigarcia.SeleniumExtension;
|
import io.github.bonigarcia.SeleniumExtension;
|
||||||
|
@ -646,7 +649,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Change publisher dynamically")
|
@DisplayName("Change publisher dynamically")
|
||||||
void changePublisher() throws Exception {
|
void changePublisherTest() throws Exception {
|
||||||
|
|
||||||
List<Boolean> listOfThreadAssertions = new ArrayList<>();
|
List<Boolean> listOfThreadAssertions = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -709,6 +712,64 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Local record")
|
||||||
|
void localRecordTest() throws Exception {
|
||||||
|
|
||||||
|
setupBrowser("chrome");
|
||||||
|
|
||||||
|
log.info("Local record");
|
||||||
|
|
||||||
|
user.getDriver().findElement(By.id("add-user-btn")).click();
|
||||||
|
user.getDriver().findElement(By.className("join-btn")).click();
|
||||||
|
|
||||||
|
user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
|
||||||
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
||||||
|
user.getEventManager().waitUntilEventReaches("videoElementCreated", 1);
|
||||||
|
user.getEventManager().waitUntilEventReaches("videoPlaying", 1);
|
||||||
|
|
||||||
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
|
true, true));
|
||||||
|
|
||||||
|
WebElement recordBtn = user.getDriver().findElements(By.className("publisher-rec-btn")).get(0);
|
||||||
|
WebElement pauseRecordBtn = user.getDriver().findElements(By.className("publisher-rec-pause-btn")).get(0);
|
||||||
|
|
||||||
|
recordBtn.click();
|
||||||
|
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
pauseRecordBtn.click();
|
||||||
|
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
pauseRecordBtn.click();
|
||||||
|
|
||||||
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
recordBtn.click();
|
||||||
|
|
||||||
|
user.getWaiter().until(ExpectedConditions.elementToBeClickable(By.cssSelector("#recorder-preview video")));
|
||||||
|
|
||||||
|
user.getWaiter().until(waitForVideoDuration(
|
||||||
|
user.getDriver().findElements(By.cssSelector("#recorder-preview video")).get(0), 4));
|
||||||
|
|
||||||
|
user.getDriver().findElements(By.id("close-record-btn")).get(0).click();
|
||||||
|
|
||||||
|
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.cssSelector("#recorder-preview video"), 0));
|
||||||
|
|
||||||
|
gracefullyLeaveParticipants(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ExpectedCondition<Boolean> waitForVideoDuration(WebElement element, int durationInSeconds) {
|
||||||
|
return new ExpectedCondition<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean apply(WebDriver input) {
|
||||||
|
return element.getAttribute("duration").matches(durationInSeconds - 1 + "\\.9[0-9]{0,5}|" + durationInSeconds + "\\.[0-1][0-9]{0,5}");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,15 +28,6 @@
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
"@types/node": "10.0.8",
|
"@types/node": "10.0.8",
|
||||||
"codelyzer": "4.3.0",
|
"codelyzer": "4.3.0",
|
||||||
"jasmine-core": "3.1.0",
|
|
||||||
"jasmine-spec-reporter": "4.2.1",
|
|
||||||
"karma": "2.0.2",
|
|
||||||
"karma-chrome-launcher": "2.2.0",
|
|
||||||
"karma-cli": "1.0.1",
|
|
||||||
"karma-coverage-istanbul-reporter": "1.4.2",
|
|
||||||
"karma-jasmine": "1.1.2",
|
|
||||||
"karma-jasmine-html-reporter": "1.1.0",
|
|
||||||
"protractor": "5.3.2",
|
|
||||||
"ts-node": "6.0.3",
|
"ts-node": "6.0.3",
|
||||||
"tslint": "5.10.0",
|
"tslint": "5.10.0",
|
||||||
"typescript": "2.7.2"
|
"typescript": "2.7.2"
|
||||||
|
|
|
@ -283,7 +283,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
'" aria-label="Start/Stop recording" class="mat-icon material-icons" role="img"' +
|
'" aria-label="Start/Stop recording" class="mat-icon material-icons" role="img"' +
|
||||||
'aria-hidden="true">fiber_manual_record</mat-icon></button>' +
|
'aria-hidden="true">fiber_manual_record</mat-icon></button>' +
|
||||||
'<button style="display:none" id="pause-btn-' + this.session.connection.connectionId + '-' + connection.connectionId +
|
'<button style="display:none" id="pause-btn-' + this.session.connection.connectionId + '-' + connection.connectionId +
|
||||||
'" class="sub-btn rec-btn" title="Pause/Resume"><mat-icon id="pause-icon-' +
|
'" class="sub-btn rec-btn rec-pause-btn" title="Pause/Resume"><mat-icon id="pause-icon-' +
|
||||||
this.session.connection.connectionId + '-' + connection.connectionId +
|
this.session.connection.connectionId + '-' + connection.connectionId +
|
||||||
'" aria-label="Pause/Resume recording" class="mat-icon material-icons" role="img"' +
|
'" aria-label="Pause/Resume recording" class="mat-icon material-icons" role="img"' +
|
||||||
'aria-hidden="true">pause</mat-icon></button>';
|
'aria-hidden="true">pause</mat-icon></button>';
|
||||||
|
@ -310,7 +310,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
'" aria-label="Start/Stop local recording" class="mat-icon material-icons" role="img" aria-hidden="true">' +
|
'" aria-label="Start/Stop local recording" class="mat-icon material-icons" role="img" aria-hidden="true">' +
|
||||||
'fiber_manual_record</mat-icon></button>' +
|
'fiber_manual_record</mat-icon></button>' +
|
||||||
'<button style="display:none" id="local-pause-btn-' + this.session.connection.connectionId +
|
'<button style="display:none" id="local-pause-btn-' + this.session.connection.connectionId +
|
||||||
'" class="sub-btn rec-btn publisher-rec-btn" title="Pause/Resume">' +
|
'" class="sub-btn rec-btn publisher-rec-btn publisher-rec-pause-btn" title="Pause/Resume">' +
|
||||||
'<mat-icon id="local-pause-icon-' + this.session.connection.connectionId +
|
'<mat-icon id="local-pause-icon-' + this.session.connection.connectionId +
|
||||||
'" aria-label="Pause/Resume local recording" class="mat-icon material-icons" role="img" aria-hidden="true">' +
|
'" aria-label="Pause/Resume local recording" class="mat-icon material-icons" role="img" aria-hidden="true">' +
|
||||||
'pause</mat-icon></button>';
|
'pause</mat-icon></button>';
|
||||||
|
|
|
@ -9,9 +9,9 @@ import { LocalRecorder } from 'openvidu-browser';
|
||||||
<div id="recorder-preview"></div>
|
<div id="recorder-preview"></div>
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button mat-button mat-dialog-close>Close</button>
|
<button id="close-record-btn" mat-button mat-dialog-close>Close</button>
|
||||||
<button mat-button (click)="recorder.download()">Download</button>
|
<button id="download-record-btn" mat-button (click)="recorder.download()">Download</button>
|
||||||
<button mat-button [disabled]="endpoint == ''" (click)="uploadFile()">Upload to</button>
|
<button id="upload-record-btn" mat-button [disabled]="endpoint == ''" (click)="uploadFile()">Upload to</button>
|
||||||
<mat-form-field [style.font-size]="'14px'" [style.width]="'170px'">
|
<mat-form-field [style.font-size]="'14px'" [style.width]="'170px'">
|
||||||
<input matInput name="endpoint" [(ngModel)]="endpoint">
|
<input matInput name="endpoint" [(ngModel)]="endpoint">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
Loading…
Reference in New Issue