Skip to content

Commit

Permalink
Adds disabled user acceptance tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
  • Loading branch information
weeman1337 authored and danxuliu committed Jul 24, 2018
1 parent de7606d commit 801bf81
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/acceptance/features/bootstrap/LoginPageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ public static function wrongPasswordMessage() {
describedAs("Wrong password message in Login page");
}

/**
* @return Locator
*/
public static function userDisabledMessage() {
return Locator::forThe()->xpath("//*[@class = 'warning userDisabledMsg' and normalize-space() = 'User disabled']")->
describedAs('User disabled message on login page');
}

/**
* @When I log in with user :user and password :password
*/
Expand All @@ -96,6 +104,14 @@ public function iSeeThatAWrongPasswordMessageIsShown() {
$this->actor->find(self::wrongPasswordMessage(), 10)->isVisible());
}

/**
* @Then I see that the disabled user message is shown
*/
public function iSeeThatTheDisabledUserMessageIsShown() {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::userDisabledMessage(), 10)->isVisible());
}

/**
* @BeforeScenario
*/
Expand Down
6 changes: 6 additions & 0 deletions tests/acceptance/features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Feature: login
Then I see that the current page is the Login page
And I see that a wrong password message is shown

Scenario: try to log in as disabled user
Given I visit the Home page
When I log in with user disabledUser and password 123456acb
Then I see that the current page is the Login page
And I see that the disabled user message is shown

Scenario: log in with invalid user once fixed by admin
Given I act as John
And I can not log in with user unknownUser and password 123456acb
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/installAndConfigureServer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ fi
php occ maintenance:install --admin-pass=admin

OC_PASS=123456acb php occ user:add --password-from-env user0
OC_PASS=123456acb php occ user:add --password-from-env disabledUser
php occ user:disable disabledUser

if [ "$NEXTCLOUD_SERVER_DOMAIN" != "" ]; then
# Default first trusted domain is "localhost"; replace it with given domain.
Expand Down

0 comments on commit 801bf81

Please sign in to comment.