openvidu-test-e2e: test Node client Session.createConnection

pull/553/head
pabloFuente 2020-10-21 11:48:38 +02:00
parent 83648d56cd
commit 2bf1b2cccb
3 changed files with 37 additions and 2 deletions

View File

@ -3614,6 +3614,29 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
checkNodeFetchChanged(true, false); checkNodeFetchChanged(true, false);
checkNodeFetchChanged(true, false); checkNodeFetchChanged(true, false);
// Create and delete connection with openvidu-node-client
final String successMessage = "Connection created: ";
user.getDriver().findElement(By.id("crate-connection-api-btn")).click();
user.getWaiter()
.until(ExpectedConditions.attributeContains(By.id("api-response-text-area"), "value", successMessage));
String value = user.getDriver().findElement(By.id("api-response-text-area")).getAttribute("value");
String connectionId = value.substring(value.lastIndexOf(successMessage) + successMessage.length());
Assert.assertTrue("Java fetch should be true", session.fetch());
Assert.assertFalse("Java fetch should be false", OV.fetch());
checkNodeFetchChanged(true, false);
checkNodeFetchChanged(false, false);
checkNodeFetchChanged(true, false);
user.getDriver().findElement(By.id("connection-id-field")).clear();
user.getDriver().findElement(By.id("connection-id-field")).sendKeys(connectionId);
user.getDriver().findElement(By.id("force-disconnect-api-btn")).click();
user.getWaiter()
.until(ExpectedConditions.attributeToBe(By.id("api-response-text-area"), "value", "User disconnected"));
Assert.assertTrue("Java fetch should be true", OV.fetch());
Assert.assertFalse("Java fetch should be false", session.fetch());
checkNodeFetchChanged(false, false);
checkNodeFetchChanged(true, false);
checkNodeFetchChanged(false, false);
// RECORD // RECORD
user.getDriver().findElement(By.id("rec-properties-btn")).click(); user.getDriver().findElement(By.id("rec-properties-btn")).click();
user.getDriver().findElement(By.id("rec-hasvideo-checkbox")).click(); user.getDriver().findElement(By.id("rec-hasvideo-checkbox")).click();

View File

@ -28,10 +28,11 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<button mat-button id="force-disconnect-api-btn" (click)="forceDisconnect()" <button mat-button id="crate-connection-api-btn" (click)="createConnection()">Create connection</button>
[disabled]="!connectionId">Disconnect</button>
<button mat-button id="update-connection-api-btn" (click)="updateConnection()" [disabled]="!connectionId">Update <button mat-button id="update-connection-api-btn" (click)="updateConnection()" [disabled]="!connectionId">Update
connection</button> connection</button>
<button mat-button id="force-disconnect-api-btn" (click)="forceDisconnect()"
[disabled]="!connectionId">Disconnect</button>
<button mat-button id="force-unpublish-api-btn" (click)="forceUnpublish()" <button mat-button id="force-unpublish-api-btn" (click)="forceUnpublish()"
[disabled]="!streamId">Unpublish</button> [disabled]="!streamId">Unpublish</button>
<mat-divider></mat-divider> <mat-divider></mat-divider>

View File

@ -172,6 +172,17 @@ export class SessionApiDialogComponent {
}); });
} }
createConnection() {
console.log('Creating connection');
this.session.createConnection(this.connectionOptions)
.then(connection => {
this.response = 'Connection created: ' + connection.connectionId;
})
.catch(error => {
this.response = 'Error [' + error.message + ']';
});
}
updateConnection() { updateConnection() {
console.log('Updating connection'); console.log('Updating connection');
this.session.updateConnection(this.connectionId, this.connectionOptions) this.session.updateConnection(this.connectionId, this.connectionOptions)