Call integration tests for one2one calls and group calls

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-07-25 16:46:37 +02:00
Родитель 8c1691cdc1
Коммит 17205cdeda
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E166FD8976B3BAC8
4 изменённых файлов: 219 добавлений и 72 удалений

Просмотреть файл

@ -383,9 +383,6 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
private function createUser($user) {
$previous_user = $this->currentUser;
$this->currentUser = "admin";
$userProvisioningUrl = $this->baseUrl . 'ocs/v2.php/cloud/users';
$client = new Client();
$options = [
@ -408,8 +405,67 @@ class FeatureContext implements Context, SnippetAcceptingContext {
],
];
$client->send($client->createRequest('GET', $userProvisioningUrl . '/' . $user, $options2));
}
$this->currentUser = $previous_user;
/**
* @Given /^group "([^"]*)" exists$/
* @param string $group
*/
public function assureGroupExists($group) {
try {
$this->groupExists($group);
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->createGroup($group);
}
$response = $this->groupExists($group);
$this->assertStatusCode($response, 200);
}
private function groupExists($group) {
$client = new Client();
$options = [
'auth' => ['admin', 'admin'],
'headers' => [
'OCS-APIREQUEST' => 'true',
],
];
return $client->get($this->baseUrl . 'ocs/v2.php/cloud/groups/' . $group, $options);
}
private function createGroup($group) {
$userProvisioningUrl = $this->baseUrl . 'ocs/v2.php/cloud/groups';
$client = new Client();
$options = [
'auth' => ['admin', 'admin'],
'body' => [
'groupid' => $group,
],
'headers' => [
'OCS-APIREQUEST' => 'true',
],
];
$client->send($client->createRequest('POST', $userProvisioningUrl, $options));
}
/**
* @When /^user "([^"]*)" is member of group "([^"]*)"$/
* @param string $user
* @param string $group
*/
public function addingUserToGroup($user, $group) {
$userProvisioningUrl = $this->baseUrl . "ocs/v2.php/cloud/users/$user/groups";
$client = new Client();
$options = [
'auth' => ['admin', 'admin'],
'body' => [
'groupid' => $group,
],
'headers' => [
'OCS-APIREQUEST' => 'true',
],
];
$this->response = $client->send($client->createRequest('POST', $userProvisioningUrl, $options));
}
/*
@ -429,7 +485,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = ['admin', 'admin'];
} else {
} else if ($this->currentUser !== 'guest') {
$options['auth'] = [$this->currentUser, '123456'];
}
if ($body instanceof \Behat\Gherkin\Node\TableNode) {

Просмотреть файл

@ -0,0 +1,80 @@
Feature: callapi/group
Background:
Given user "participant1" exists
And user "participant2" exists
And user "participant3" exists
And group "attendees1" exists
And user "participant2" is member of group "attendees1"
Scenario: User has no rooms
Then user "participant1" is participant of the following rooms
Then user "participant2" is participant of the following rooms
Then user "participant3" is participant of the following rooms
Scenario: User1 invites user2 to a one2one room and they can do everything
When user "participant1" creates room "room"
| roomType | 2 |
| invite | attendees1 |
Then user "participant1" is participant of room "room"
And user "participant2" is participant of room "room"
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant2" sees 1 peers in call "room" with 200
And user "participant2" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "participant2" sees 2 peers in call "room" with 200
Then user "participant1" pings call "room" with 200
And user "participant2" pings call "room" with 200
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant2" sees 1 peers in call "room" with 200
Then user "participant2" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
Scenario: User1 invites user2 to a one2one room and user3 can't do anything
When user "participant1" creates room "room"
| roomType | 2 |
| invite | attendees1 |
Then user "participant1" is participant of room "room"
Then user "participant3" is not participant of room "room"
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
And user "participant3" joins call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
And user "participant3" pings call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant3" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Scenario: User1 invites user2 to a one2one room and guest can't do anything
When user "participant1" creates room "room"
| roomType | 2 |
| invite | attendees1 |
Then user "participant1" is participant of room "room"
And user "guest" sees 0 peers in call "room" with 404
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
And user "guest" joins call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
And user "guest" pings call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
Then user "guest" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404

Просмотреть файл

@ -0,0 +1,78 @@
Feature: callapi/one-to-one
Background:
Given user "participant1" exists
And user "participant2" exists
And user "participant3" exists
Scenario: User has no rooms
Then user "participant1" is participant of the following rooms
Then user "participant2" is participant of the following rooms
Then user "participant3" is participant of the following rooms
Scenario: User1 invites user2 to a one2one room and they can do everything
When user "participant1" creates room "room"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room"
And user "participant2" is participant of room "room"
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant2" sees 1 peers in call "room" with 200
And user "participant2" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "participant2" sees 2 peers in call "room" with 200
Then user "participant1" pings call "room" with 200
And user "participant2" pings call "room" with 200
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant2" sees 1 peers in call "room" with 200
Then user "participant2" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
Scenario: User1 invites user2 to a one2one room and user3 can't do anything
When user "participant1" creates room "room"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room"
Then user "participant3" is not participant of room "room"
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
And user "participant3" joins call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
And user "participant3" pings call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant3" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant3" sees 0 peers in call "room" with 404
Scenario: User1 invites user2 to a one2one room and guest can't do anything
When user "participant1" creates room "room"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room"
And user "guest" sees 0 peers in call "room" with 404
Then user "participant1" joins call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
And user "guest" joins call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
And user "guest" pings call "room" with 404
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
Then user "guest" leaves call "room" with 200
Then user "participant1" sees 1 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404
Then user "participant1" leaves call "room" with 200
Then user "participant1" sees 0 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 404

Просмотреть файл

@ -1,67 +0,0 @@
Feature: one-to-one-call
Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists
Scenario: User has no rooms
Then user "participant1" is participant of the following rooms
Then user "participant2" is participant of the following rooms
Then user "participant3" is participant of the following rooms
Scenario: User1 invites user2 to a one2one room and they get-peers and join/leave
When user "participant1" creates room "room1"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room1"
And user "participant2" is participant of room "room1"
Then user "participant1" sees 0 peers in call "room1" with 200
And user "participant2" sees 0 peers in call "room1" with 200
Then user "participant1" joins call "room1" with 200
Then user "participant1" sees 1 peers in call "room1" with 200
And user "participant2" sees 1 peers in call "room1" with 200
And user "participant2" joins call "room1" with 200
Then user "participant1" sees 2 peers in call "room1" with 200
And user "participant2" sees 2 peers in call "room1" with 200
Then user "participant1" leaves call "room1" with 200
Then user "participant1" sees 1 peers in call "room1" with 200
And user "participant2" sees 1 peers in call "room1" with 200
Then user "participant2" leaves call "room1" with 200
Then user "participant1" sees 0 peers in call "room1" with 200
And user "participant2" sees 0 peers in call "room1" with 200
Scenario: User1 invites user2 to a one2one room and they ping
When user "participant1" creates room "room2"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" pings call "room2" with 200
And user "participant2" pings call "room2" with 200
Scenario: User1 invites user2 to a one2one room and user3 can not get-peers
When user "participant1" creates room "room3"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room3"
Then user "participant3" is not participant of room "room3"
And user "participant3" sees 0 peers in call "room3" with 404
Then user "participant1" joins call "room3" with 200
Then user "participant1" sees 1 peers in call "room3" with 200
And user "participant3" sees 0 peers in call "room3" with 404
And user "participant3" joins call "room3" with 404
Then user "participant1" sees 1 peers in call "room3" with 200
And user "participant3" sees 0 peers in call "room3" with 404
Then user "participant3" leaves call "room3" with 200
Then user "participant1" sees 1 peers in call "room3" with 200
And user "participant3" sees 0 peers in call "room3" with 404
Then user "participant1" leaves call "room3" with 200
Then user "participant1" sees 0 peers in call "room3" with 200
And user "participant3" sees 0 peers in call "room3" with 404
Scenario: User1 invites user2 to a one2one room and user3 can not ping
When user "participant1" creates room "room4"
| roomType | 1 |
| invite | participant2 |
Then user "participant1" is participant of room "room4"
And user "participant3" is not participant of room "room4"
Then user "participant1" pings call "room4" with 200
And user "participant3" pings call "room4" with 404