зеркало из https://github.com/nextcloud/spreed.git
Add basic acceptance tests for the public share authentication page
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
7a10cb94b2
Коммит
b3f65b742d
|
@ -17,6 +17,7 @@ default:
|
|||
- FilesAppContext
|
||||
- FilesAppSharingContext
|
||||
- LoginPageContext
|
||||
- PublicShareContext
|
||||
|
||||
# Talk app contexts
|
||||
- ChatContext
|
||||
|
@ -25,6 +26,7 @@ default:
|
|||
- FilesAppChatTabContext
|
||||
- FilesAppRoomSharingContext
|
||||
- ParticipantListContext
|
||||
- PublicSharePasswordRequestContext
|
||||
- TalkAppContext
|
||||
|
||||
extensions:
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @copyright Copyright (c) 2018, Daniel Calviño Sánchez (danxuliu@gmail.com)
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
|
||||
class PublicSharePasswordRequestContext implements Context, ActorAwareInterface {
|
||||
|
||||
use ActorAware;
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function requestPasswordButton() {
|
||||
return Locator::forThe()->button("Request password")->
|
||||
describedAs("Request password button in the public share authentication page");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the request password button is shown
|
||||
*/
|
||||
public function iSeeThatTheRequestPasswordButtonIsShown() {
|
||||
if (!WaitFor::elementToBeEventuallyShown(
|
||||
$this->actor,
|
||||
self::requestPasswordButton(),
|
||||
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
|
||||
PHPUnit_Framework_Assert::fail("The request password button is not shown yet after $timeout seconds");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the request password button is not shown
|
||||
*/
|
||||
public function iSeeThatTheRequestPasswordButtonIsNotShown() {
|
||||
try {
|
||||
// Wait a little before deciding that the button is not shown, as
|
||||
// the button would be loaded after the page has loaded.
|
||||
PHPUnit_Framework_Assert::assertFalse(
|
||||
$this->actor->find(self::requestPasswordButton(), 5)->isVisible());
|
||||
} catch (NoSuchElementException $exception) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
Feature: public share auth
|
||||
|
||||
Scenario: try to access a link share with a password protected by Talk
|
||||
Given I act as John
|
||||
And I am logged in
|
||||
And I share the link for "welcome.txt" protected by the password "abcdef"
|
||||
And I set the password of the shared link as protected by Talk
|
||||
And I see that the password of the link share is protected by Talk
|
||||
And I write down the shared link
|
||||
When I act as Jane
|
||||
And I visit the shared link I wrote down
|
||||
Then I see that the current page is the Authenticate page for the shared link I wrote down
|
||||
And I see that the request password button is shown
|
||||
|
||||
Scenario: try to access a link share with a password no longer protected by Talk
|
||||
Given I act as John
|
||||
And I am logged in
|
||||
And I share the link for "welcome.txt" protected by the password "abcdef"
|
||||
And I set the password of the shared link as protected by Talk
|
||||
And I see that the password of the link share is protected by Talk
|
||||
And I set the password of the shared link as not protected by Talk
|
||||
And I see that the password of the link share is not protected by Talk
|
||||
And I write down the shared link
|
||||
When I act as Jane
|
||||
And I visit the shared link I wrote down
|
||||
Then I see that the current page is the Authenticate page for the shared link I wrote down
|
||||
And I see that the request password button is not shown
|
Загрузка…
Ссылка в новой задаче