Skip to content

Commit

Permalink
Merge pull request #37502 from owncloud/adjust-tests-so-they-run-with…
Browse files Browse the repository at this point in the history
…-numeric-usernames

[Tests-Only] Adjust tests so they run with numeric usernames
  • Loading branch information
phil-davis authored Jun 9, 2020
2 parents 7250f1f + a46fdca commit 90d738e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Feature: sharing
#And user "brian" should see the following elements
# | /randomfile.txt |
#And the content of file "randomfile.txt" for user "brian" should be "Random data"
And user "brian" should not see the following elements
And user "brian" should not see the following elements if the upper and lower case username are different
| /randomfile.txt |

@skipOnLDAP
Expand Down
20 changes: 20 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,26 @@ public function userShouldSeeTheElements($user, $shouldOrNot, $elements) {
$this->checkElementList($user, $elements, $should);
}

/**
* @Then /^user "([^"]*)" should not see the following elements if the upper and lower case username are different/
*
* @param string $user
* @param TableNode $elements
*
* @return void
* @throws InvalidArgumentException
*
*/
public function userShouldNotSeeTheElementsIfUpperAndLowerCaseUsernameDifferent($user, $elements) {
$effectiveUser = $this->getActualUsername($user);
if (\strtoupper($effectiveUser) === \strtolower($effectiveUser)) {
$expectedToBeListed = true;
} else {
$expectedToBeListed = false;
}
$this->checkElementList($user, $elements, $expectedToBeListed);
}

/**
* asserts that a the user can or cannot see a list of files/folders by propfind
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SharingDialog extends OwncloudPage {
private $suffixToIdentifyUsers = " User";
private $suffixToIdentifyRemoteUsers = " Federated";
private $sharerInformationXpath = ".//*[@class='reshare']";
private $sharedWithAndByRegEx = "^(?:[A-Z]\s)?Shared with you(?: and the group (.*))? by (.*)$";
private $sharedWithAndByRegEx = "Shared with you(?: and the group (.*))? by (.*)$";
private $permissionsFieldByUserNameWithExtraInfo = "//*[@id='shareWithList']//span[contains(text(), '%s')]/parent::li[@data-share-with='%s']";
private $permissionsFieldByUserName = "//*[@id='shareWithList']//span[contains(text(), '%s')]/parent::li";
private $permissionsFieldByGroupName = "//*[@id='shareWithList']//span[contains(text(), '%s (group)')]/parent::li";
Expand Down

0 comments on commit 90d738e

Please sign in to comment.