Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 42 additions & 10 deletions tests/ui/features/bootstrap/BasicStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode;
use TestHelpers\DownloadHelper;
use TestHelpers\SetupHelper;

require_once 'bootstrap.php';
Expand Down Expand Up @@ -80,32 +81,48 @@ public function iLogout() {
}

/**
* @Given a regular user exists
* @Given /^a regular user exists\s?(but is not initialized|)$/
* @param string $doNotInitialize just create the user, do not trigger creating skeleton files etc
* @return void
*/
public function aRegularUserExists() {
$this->createUser($this->regularUserName, $this->regularUserPassword);
public function aRegularUserExists($doNotInitialize) {
$this->createUser(
$this->regularUserName,
$this->regularUserPassword,
null,
null,
($doNotInitialize === "")
);
}

/**
* @Given regular users exist
* @Given /^regular users exist\s?(but are not initialized|)$/
* @param string $doNotInitialize just create the user, do not trigger creating skeleton files etc
* @return void
*/
public function regularUsersExist() {
public function regularUsersExist($doNotInitialize) {
foreach ($this->regularUserNames as $user) {
$this->createUser($user, $this->regularUserPassword);
$this->createUser(
$user,
$this->regularUserPassword,
null,
null,
($doNotInitialize === "")
);
}
}

/**
* @Given these users exist:
* @Given /^these users exist\s?(but are not initialized|):$/
* expects a table of users with the heading
* "|username|password|displayname|email|"
* displayname & email are optional
*
* @param string $doNotInitialize just create the user, do not trigger creating skeleton files etc
* @param TableNode $table
* @return void
*/
public function theseUsersExist(TableNode $table) {
public function theseUsersExist($doNotInitialize, TableNode $table) {
foreach ($table as $row) {
if (isset($row['displayname'])) {
$displayName = $row['displayname'];
Expand All @@ -118,7 +135,11 @@ public function theseUsersExist(TableNode $table) {
$email = null;
}
$this->createUser(
$row ['username'], $row ['password'], $displayName, $email
$row ['username'],
$row ['password'],
$displayName,
$email,
($doNotInitialize === "")
);
}
}
Expand All @@ -130,11 +151,12 @@ public function theseUsersExist(TableNode $table) {
* @param string $password
* @param string $displayName
* @param string $email
* @param bool $initialize initialize the user skeleton files etc
* @return void
* @throws Exception
*/
private function createUser(
$user, $password, $displayName = null, $email = null
$user, $password, $displayName = null, $email = null, $initialize = true
) {
$user = trim($user);
$result = SetupHelper::createUser(
Expand All @@ -146,6 +168,16 @@ private function createUser(
. $result["stdOut"] . " " . $result["stdErr"]
);
}
if ($initialize) {
// Download a skeleton file. That will force the server to fully
// initialize the user, including their skeleton files.
DownloadHelper::download(
$this->getMinkParameter("base_url"),
$user,
$password,
"lorem.txt"
);
}
$this->addUserToCreatedUsersList($user, $password, $displayName, $email);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/features/other/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ I want only authorised users to log in
So that unauthorised access is impossible

Scenario: simple user login
Given a regular user exists
Given a regular user exists but is not initialized
And I am on the login page
When I login as a regular user with a correct password
Then I should be redirected to a page with the title "Files - ownCloud"
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/features/restrictSharing/restrictReSharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ I want to be able to forbid a user that received a share from me to share it fur
And the user "user1" is in the group "grp1"
And the user "user2" is in the group "grp1"
And I am on the login page
And I login with username "user1" and password "1234"
And I logout
And I login with username "user2" and password "1234"

@skipOnMICROSOFTEDGE
Expand Down
4 changes: 0 additions & 4 deletions tests/ui/features/restrictSharing/restrictSharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ So that users can only share files with specific users and groups
And the user "user2" is in the group "grp1"
And the user "user3" is in the group "grp2"
And I am on the login page
And I login with username "user1" and password "1234"
And I logout
And I login with username "user3" and password "1234"
And I logout
And I login with username "user2" and password "1234"

Scenario: Restrict users to only share with users in their groups
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/features/sharing/federationSharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ So that other users have access to these files
|user1 |1234 |User One |u1@oc.com.np|
|user2 |1234 |User Two |u2@oc.com.np|
And I am on the login page
And I login with username "user1" and password "1234"
And I logout
And I login with username "user2" and password "1234"

Scenario: test the single steps of federation sharing
Expand Down
6 changes: 2 additions & 4 deletions tests/ui/features/sharing/sharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ So that those groups and users can access the files and folders
And the user "user1" is in the group "grp1"
And the user "user2" is in the group "grp1"
And I am on the login page
And I login with username "user1" and password "1234"
And I logout
And I login with username "user2" and password "1234"

Scenario: share a file & folder with another internal user
And I login with username "user2" and password "1234"
When the folder "simple-folder" is shared with the user "User One"
And the file "testimage.jpg" is shared with the user "User One"
And I logout
Expand All @@ -34,7 +32,6 @@ So that those groups and users can access the files and folders
But the folder "simple-folder (2)" should not be listed

Scenario: share a folder with an internal group
And I logout
And I login with username "user3" and password "1234"
When the folder "simple-folder" is shared with the group "grp1"
And the file "testimage.jpg" is shared with the group "grp1"
Expand All @@ -53,6 +50,7 @@ So that those groups and users can access the files and folders

@skipOnMICROSOFTEDGE
Scenario: share a folder with another internal user and prohibit deleting
And I login with username "user2" and password "1234"
When the folder "simple-folder" is shared with the user "User One"
And the sharing permissions of "User One" for "simple-folder" are set to
| delete | no |
Expand Down