Merge pull request #25983 from nextcloud/update-acceptance-tests-dependencies

This commit is contained in:
John Molakvoæ 2021-03-30 10:31:37 +02:00 committed by GitHub
commit 582ab4129d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 760 additions and 329 deletions

View File

@ -1,10 +1,10 @@
{ {
"require-dev": { "require-dev": {
"behat/behat": "3.7.0", "behat/behat": "3.8.1",
"behat/mink": "1.7.1", "behat/mink": "1.8.1",
"behat/mink-extension": "2.3.1", "behat/mink-extension": "2.3.1",
"behat/mink-selenium2-driver": "1.3.1", "behat/mink-selenium2-driver": "1.4.0",
"phpunit/phpunit": "4.8.36" "phpunit/phpunit": "6.5.14"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ default:
suites: suites:
default: default:
paths: paths:
- %paths.base%/../features - "%paths.base%/../features"
contexts: contexts:
- ActorContext - ActorContext
- NextcloudTestServerContext - NextcloudTestServerContext
@ -31,7 +31,7 @@ default:
tags: "~@apache" tags: "~@apache"
apache: apache:
paths: paths:
- %paths.base%/../features - "%paths.base%/../features"
contexts: contexts:
- ActorContext - ActorContext
- NextcloudTestServerContext: - NextcloudTestServerContext:

View File

@ -23,6 +23,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class AppNavigationContext implements Context, ActorAwareInterface { class AppNavigationContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -105,7 +106,7 @@ class AppNavigationContext implements Context, ActorAwareInterface {
* @Then I see that the current section is :section * @Then I see that the current section is :section
*/ */
public function iSeeThatTheCurrentSectionIs($section) { public function iSeeThatTheCurrentSectionIs($section) {
PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::appNavigationCurrentSectionItem(), 10)->getText(), $section); Assert::assertEquals($this->actor->find(self::appNavigationCurrentSectionItem(), 10)->getText(), $section);
} }
/** /**
@ -116,7 +117,7 @@ class AppNavigationContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::appNavigationSectionItemFor($section), self::appNavigationSectionItemFor($section),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The section $section in the app navigation is not shown yet after $timeout seconds"); Assert::fail("The section $section in the app navigation is not shown yet after $timeout seconds");
} }
} }
@ -128,7 +129,7 @@ class AppNavigationContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::appNavigationSectionItemFor($section), self::appNavigationSectionItemFor($section),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The section $section in the app navigation is still shown after $timeout seconds"); Assert::fail("The section $section in the app navigation is still shown after $timeout seconds");
} }
} }
@ -136,7 +137,7 @@ class AppNavigationContext implements Context, ActorAwareInterface {
* @Then I see that the section :section has a count of :count * @Then I see that the section :section has a count of :count
*/ */
public function iSeeThatTheSectionHasACountOf($section, $count) { public function iSeeThatTheSectionHasACountOf($section, $count) {
PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::counterForTheSection($section), 10)->getText(), $count); Assert::assertEquals($this->actor->find(self::counterForTheSection($section), 10)->getText(), $count);
} }
/** /**
@ -147,7 +148,7 @@ class AppNavigationContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::counterForTheSection($section), self::counterForTheSection($section),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The counter for section $section is still shown after $timeout seconds"); Assert::fail("The counter for section $section is still shown after $timeout seconds");
} }
} }
} }

View File

@ -23,6 +23,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class AppSettingsContext implements Context, ActorAwareInterface { class AppSettingsContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -92,7 +93,7 @@ class AppSettingsContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::appSettingsContent(), self::appSettingsContent(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The app settings are not open yet after $timeout seconds"); Assert::fail("The app settings are not open yet after $timeout seconds");
} }
} }
} }

View File

@ -24,6 +24,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class AppsManagementContext implements Context, ActorAwareInterface { class AppsManagementContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -170,7 +171,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatTheAppHasBeenEnabled($app) { public function iSeeThatTheAppHasBeenEnabled($app) {
// TODO: Find a way to check if the enable button is removed // TODO: Find a way to check if the enable button is removed
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::disableButtonForApp($app), 10)->isVisible() $this->actor->find(self::disableButtonForApp($app), 10)->isVisible()
); );
} }
@ -180,7 +181,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatTheAppHasBeenDisabled($app) { public function iSeeThatTheAppHasBeenDisabled($app) {
// TODO: Find a way to check if the disable button is removed // TODO: Find a way to check if the disable button is removed
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::enableButtonForApp($app), 10)->isVisible() $this->actor->find(self::enableButtonForApp($app), 10)->isVisible()
); );
} }
@ -189,7 +190,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
* @Then /^I see that there are no available updates$/ * @Then /^I see that there are no available updates$/
*/ */
public function iSeeThatThereAreNoAvailableUpdates() { public function iSeeThatThereAreNoAvailableUpdates() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::emptyAppList(), 10)->isVisible() $this->actor->find(self::emptyAppList(), 10)->isVisible()
); );
} }
@ -202,7 +203,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::appEntries(), self::appEntries(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The apps from the app store were not shown yet after $timeout seconds"); Assert::fail("The apps from the app store were not shown yet after $timeout seconds");
} }
} }
@ -220,7 +221,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
try { try {
$this->actor->find(self::disableButtonForAnyApp(), 2); $this->actor->find(self::disableButtonForAnyApp(), 2);
PHPUnit_Framework_Assert::fail("Found enabled apps"); Assert::fail("Found enabled apps");
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
} }
@ -232,7 +233,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
try { try {
$this->actor->find(self::enableButtonForAnyApp(), 2); $this->actor->find(self::enableButtonForAnyApp(), 2);
PHPUnit_Framework_Assert::fail("Found disabled apps"); Assert::fail("Found disabled apps");
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
} }
@ -241,10 +242,10 @@ class AppsManagementContext implements Context, ActorAwareInterface {
* @Given /^I see the app bundles$/ * @Given /^I see the app bundles$/
*/ */
public function iSeeTheAppBundles() { public function iSeeTheAppBundles() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::rowForApp('Auditing / Logging'), 2)->isVisible() $this->actor->find(self::rowForApp('Auditing / Logging'), 2)->isVisible()
); );
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::rowForApp('LDAP user and group backend'), 2)->isVisible() $this->actor->find(self::rowForApp('LDAP user and group backend'), 2)->isVisible()
); );
} }
@ -260,7 +261,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
* @Given /^I see that the "([^"]*)" is disabled$/ * @Given /^I see that the "([^"]*)" is disabled$/
*/ */
public function iSeeThatTheIsDisabled($bundle) { public function iSeeThatTheIsDisabled($bundle) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::enableAllBundleButton($bundle), 2)->isVisible() $this->actor->find(self::enableAllBundleButton($bundle), 2)->isVisible()
); );
} }
@ -276,7 +277,7 @@ class AppsManagementContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::sidebar(), self::sidebar(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The sidebar was not shown yet after $timeout seconds"); Assert::fail("The sidebar was not shown yet after $timeout seconds");
} }
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class CommentsAppContext implements Context, ActorAwareInterface { class CommentsAppContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -87,7 +88,7 @@ class CommentsAppContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::emptyContent(), self::emptyContent(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The no comments message is not visible yet after $timeout seconds"); Assert::fail("The no comments message is not visible yet after $timeout seconds");
} }
} }
@ -95,7 +96,7 @@ class CommentsAppContext implements Context, ActorAwareInterface {
* @Then /^I see a comment with "([^"]*)" as message$/ * @Then /^I see a comment with "([^"]*)" as message$/
*/ */
public function iSeeACommentWithAsMessage($commentText) { public function iSeeACommentWithAsMessage($commentText) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::commentWithText($commentText), 10)->isVisible()); $this->actor->find(self::commentWithText($commentText), 10)->isVisible());
} }
@ -104,7 +105,7 @@ class CommentsAppContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatThereIsNoCommentWithAsMessage($commentText) { public function iSeeThatThereIsNoCommentWithAsMessage($commentText) {
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::commentWithText($commentText))->isVisible()); $this->actor->find(self::commentWithText($commentText))->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class ContactsMenuContext implements Context, ActorAwareInterface { class ContactsMenuContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -88,7 +89,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the Contacts menu is shown * @Then I see that the Contacts menu is shown
*/ */
public function iSeeThatTheContactsMenuIsShown() { public function iSeeThatTheContactsMenuIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::contactsMenu(), 10)->isVisible()); $this->actor->find(self::contactsMenu(), 10)->isVisible());
} }
@ -96,7 +97,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the Contacts menu search input is shown * @Then I see that the Contacts menu search input is shown
*/ */
public function iSeeThatTheContactsMenuSearchInputIsShown() { public function iSeeThatTheContactsMenuSearchInputIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::contactsMenuSearchInput(), 10)->isVisible()); $this->actor->find(self::contactsMenuSearchInput(), 10)->isVisible());
} }
@ -104,7 +105,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the no results message in the Contacts menu is shown * @Then I see that the no results message in the Contacts menu is shown
*/ */
public function iSeeThatTheNoResultsMessageInTheContactsMenuIsShown() { public function iSeeThatTheNoResultsMessageInTheContactsMenuIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::noResultsMessage(), 10)->isVisible()); $this->actor->find(self::noResultsMessage(), 10)->isVisible());
} }
@ -112,7 +113,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the contact :contactName in the Contacts menu is shown * @Then I see that the contact :contactName in the Contacts menu is shown
*/ */
public function iSeeThatTheContactInTheContactsMenuIsShown($contactName) { public function iSeeThatTheContactInTheContactsMenuIsShown($contactName) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::menuItemFor($contactName), 10)->isVisible()); $this->actor->find(self::menuItemFor($contactName), 10)->isVisible());
} }
@ -123,7 +124,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
$this->iSeeThatThecontactsMenuIsShown(); $this->iSeeThatThecontactsMenuIsShown();
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::menuItemFor($contactName))->isVisible()); $this->actor->find(self::menuItemFor($contactName))->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
@ -139,7 +140,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::menuItemFor($contactName), self::menuItemFor($contactName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The $contactName contact in Contacts menu is still shown after $timeout seconds"); Assert::fail("The $contactName contact in Contacts menu is still shown after $timeout seconds");
} }
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class DialogContext implements Context, ActorAwareInterface { class DialogContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -58,7 +59,7 @@ class DialogContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::theDialog(), self::theDialog(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The confirmation dialog was not shown yet after $timeout seconds"); Assert::fail("The confirmation dialog was not shown yet after $timeout seconds");
} }
} }
@ -70,7 +71,7 @@ class DialogContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::theDialog(), self::theDialog(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The confirmation dialog is still shown after $timeout seconds"); Assert::fail("The confirmation dialog is still shown after $timeout seconds");
} }
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class FileListContext implements Context, ActorAwareInterface { class FileListContext implements Context, ActorAwareInterface {
@ -125,11 +126,20 @@ class FileListContext implements Context, ActorAwareInterface {
* @return Locator * @return Locator
*/ */
public static function createNewFolderMenuItemNameInput($fileListAncestor) { public static function createNewFolderMenuItemNameInput($fileListAncestor) {
return Locator::forThe()->css(".filenameform input")-> return Locator::forThe()->css(".filenameform input[type=text]")->
descendantOf(self::createNewFolderMenuItem($fileListAncestor))-> descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
describedAs("Name input in create new folder menu item in file list"); describedAs("Name input in create new folder menu item in file list");
} }
/**
* @return Locator
*/
public static function createNewFolderMenuItemConfirmButton($fileListAncestor) {
return Locator::forThe()->css(".filenameform input[type=submit]")->
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
describedAs("Confirm button in create new folder menu item in file list");
}
/** /**
* @return Locator * @return Locator
*/ */
@ -355,7 +365,8 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor->find(self::createMenuButton($this->fileListAncestor), 10)->click(); $this->actor->find(self::createMenuButton($this->fileListAncestor), 10)->click();
$this->actor->find(self::createNewFolderMenuItem($this->fileListAncestor), 2)->click(); $this->actor->find(self::createNewFolderMenuItem($this->fileListAncestor), 2)->click();
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName . "\r"); $this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName);
$this->actor->find(self::createNewFolderMenuItemConfirmButton($this->fileListAncestor), 2)->click();
} }
/** /**
@ -409,7 +420,7 @@ class FileListContext implements Context, ActorAwareInterface {
// This should not be a problem, though, as the default behaviour is to // This should not be a problem, though, as the default behaviour is to
// bring the browser window to the foreground when switching to a // bring the browser window to the foreground when switching to a
// different actor. // different actor.
$this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2 . "\r"); $this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2);
} }
/** /**
@ -476,7 +487,7 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::mainWorkingIcon($this->fileListAncestor), self::mainWorkingIcon($this->fileListAncestor),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The main working icon for the file list is still shown after $timeout seconds"); Assert::fail("The main working icon for the file list is still shown after $timeout seconds");
} }
} }
@ -486,7 +497,7 @@ class FileListContext implements Context, ActorAwareInterface {
public function iSeeThatTheFileListIsCurrentlyIn($path) { public function iSeeThatTheFileListIsCurrentlyIn($path) {
// The text of the breadcrumbs is the text of all the crumbs separated // The text of the breadcrumbs is the text of all the crumbs separated
// by white spaces. // by white spaces.
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
str_replace('/', ' ', $path), $this->actor->find(self::breadcrumbs($this->fileListAncestor), 10)->getText()); str_replace('/', ' ', $path), $this->actor->find(self::breadcrumbs($this->fileListAncestor), 10)->getText());
} }
@ -496,14 +507,14 @@ class FileListContext implements Context, ActorAwareInterface {
public function iSeeThatItIsNotPossibleToCreateNewFiles() { public function iSeeThatItIsNotPossibleToCreateNewFiles() {
// Once a file list is loaded the "Create" menu button is always in the // Once a file list is loaded the "Create" menu button is always in the
// DOM, so it is checked if it is visible or not. // DOM, so it is checked if it is visible or not.
PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::createMenuButton($this->fileListAncestor))->isVisible()); Assert::assertFalse($this->actor->find(self::createMenuButton($this->fileListAncestor))->isVisible());
} }
/** /**
* @Then I see that the file list contains a file named :fileName * @Then I see that the file list contains a file named :fileName
*/ */
public function iSeeThatTheFileListContainsAFileNamed($fileName) { public function iSeeThatTheFileListContainsAFileNamed($fileName) {
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForFile($this->fileListAncestor, $fileName), 10)); Assert::assertNotNull($this->actor->find(self::rowForFile($this->fileListAncestor, $fileName), 10));
} }
/** /**
@ -514,7 +525,7 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::rowForFile($this->fileListAncestor, $fileName), self::rowForFile($this->fileListAncestor, $fileName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The file list still contains a file named $fileName after $timeout seconds"); Assert::fail("The file list still contains a file named $fileName after $timeout seconds");
} }
} }
@ -522,35 +533,35 @@ class FileListContext implements Context, ActorAwareInterface {
* @Then I see that :fileName1 precedes :fileName2 in the file list * @Then I see that :fileName1 precedes :fileName2 in the file list
*/ */
public function iSeeThatPrecedesInTheFileList($fileName1, $fileName2) { public function iSeeThatPrecedesInTheFileList($fileName1, $fileName2) {
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForFilePreceding($this->fileListAncestor, $fileName1, $fileName2), 10)); Assert::assertNotNull($this->actor->find(self::rowForFilePreceding($this->fileListAncestor, $fileName1, $fileName2), 10));
} }
/** /**
* @Then I see that :fileName is not selected * @Then I see that :fileName is not selected
*/ */
public function iSeeThatIsNotSelected($fileName) { public function iSeeThatIsNotSelected($fileName) {
PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::selectionCheckboxInputForFile($this->fileListAncestor, $fileName), 10)->isChecked()); Assert::assertFalse($this->actor->find(self::selectionCheckboxInputForFile($this->fileListAncestor, $fileName), 10)->isChecked());
} }
/** /**
* @Then I see that :fileName is marked as favorite * @Then I see that :fileName is marked as favorite
*/ */
public function iSeeThatIsMarkedAsFavorite($fileName) { public function iSeeThatIsMarkedAsFavorite($fileName) {
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::favoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); Assert::assertNotNull($this->actor->find(self::favoritedStateIconForFile($this->fileListAncestor, $fileName), 10));
} }
/** /**
* @Then I see that :fileName is not marked as favorite * @Then I see that :fileName is not marked as favorite
*/ */
public function iSeeThatIsNotMarkedAsFavorite($fileName) { public function iSeeThatIsNotMarkedAsFavorite($fileName) {
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::notFavoritedStateIconForFile($this->fileListAncestor, $fileName), 10)); Assert::assertNotNull($this->actor->find(self::notFavoritedStateIconForFile($this->fileListAncestor, $fileName), 10));
} }
/** /**
* @Then I see that :fileName has unread comments * @Then I see that :fileName has unread comments
*/ */
public function iSeeThatHasUnreadComments($fileName) { public function iSeeThatHasUnreadComments($fileName) {
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::commentActionForFile($this->fileListAncestor, $fileName), 10)->isVisible()); Assert::assertTrue($this->actor->find(self::commentActionForFile($this->fileListAncestor, $fileName), 10)->isVisible());
} }
private function waitForRowForFileToBeFullyOpaque($fileName) { private function waitForRowForFileToBeFullyOpaque($fileName) {
@ -567,7 +578,7 @@ class FileListContext implements Context, ActorAwareInterface {
}; };
if (!Utils::waitFor($fileRowIsFullyOpaqueCallback, $timeout = 2 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { if (!Utils::waitFor($fileRowIsFullyOpaqueCallback, $timeout = 2 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) {
PHPUnit_Framework_Assert::fail("The row for file $fileName in file list is not fully opaque after $timeout seconds"); Assert::fail("The row for file $fileName in file list is not fully opaque after $timeout seconds");
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class FilesAppContext implements Context, ActorAwareInterface { class FilesAppContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -295,7 +296,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the Files app * @Then I see that the current page is the Files app
*/ */
public function iSeeThatTheCurrentPageIsTheFilesApp() { public function iSeeThatTheCurrentPageIsTheFilesApp() {
PHPUnit_Framework_Assert::assertStringStartsWith( Assert::assertStringStartsWith(
$this->actor->locatePath("/apps/files/"), $this->actor->locatePath("/apps/files/"),
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
@ -313,7 +314,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::detailsView(), self::detailsView(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The details view is not open yet after $timeout seconds"); Assert::fail("The details view is not open yet after $timeout seconds");
} }
} }
@ -325,7 +326,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::detailsView(), self::detailsView(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The details view is not closed yet after $timeout seconds"); Assert::fail("The details view is not closed yet after $timeout seconds");
} }
} }
@ -333,7 +334,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the file name shown in the details view is :fileName * @Then I see that the file name shown in the details view is :fileName
*/ */
public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) { public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName); $this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName);
} }
@ -341,7 +342,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the file is marked as favorite in the details view * @Then I see that the file is marked as favorite in the details view
*/ */
public function iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView() { public function iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView() {
PHPUnit_Framework_Assert::assertNotNull( Assert::assertNotNull(
$this->actor->find(self::favoritedStateIconInFileDetailsInDetailsView(), 10)); $this->actor->find(self::favoritedStateIconInFileDetailsInDetailsView(), 10));
} }
@ -349,7 +350,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the file is not marked as favorite in the details view * @Then I see that the file is not marked as favorite in the details view
*/ */
public function iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView() { public function iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView() {
PHPUnit_Framework_Assert::assertNotNull( Assert::assertNotNull(
$this->actor->find(self::notFavoritedStateIconInFileDetailsInDetailsView(), 10)); $this->actor->find(self::notFavoritedStateIconInFileDetailsInDetailsView(), 10));
} }
@ -357,7 +358,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the input field for tags in the details view is shown * @Then I see that the input field for tags in the details view is shown
*/ */
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() { public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::inputFieldForTagsInDetailsView(), 10)->isVisible()); $this->actor->find(self::inputFieldForTagsInDetailsView(), 10)->isVisible());
} }
@ -365,7 +366,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the input field for tags in the details view contains the tag :tag * @Then I see that the input field for tags in the details view contains the tag :tag
*/ */
public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) { public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag), 10)->isVisible()); $this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag), 10)->isVisible());
} }
@ -376,7 +377,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown(); $this->iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown();
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag))->isVisible()); $this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag))->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
@ -386,7 +387,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the tag :tag in the dropdown for tags in the details view is checked * @Then I see that the tag :tag in the dropdown for tags in the details view is checked
*/ */
public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsChecked($tag) { public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsChecked($tag) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::checkmarkInItemInDropdownForTag($tag), 10)->isVisible()); $this->actor->find(self::checkmarkInItemInDropdownForTag($tag), 10)->isVisible());
} }
@ -394,10 +395,10 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the tag :tag in the dropdown for tags in the details view is not checked * @Then I see that the tag :tag in the dropdown for tags in the details view is not checked
*/ */
public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($tag) { public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($tag) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::itemInDropdownForTag($tag), 10)->isVisible()); $this->actor->find(self::itemInDropdownForTag($tag), 10)->isVisible());
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::checkmarkInItemInDropdownForTag($tag))->isVisible()); $this->actor->find(self::checkmarkInItemInDropdownForTag($tag))->isVisible());
} }
@ -409,7 +410,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::loadingIconForTabInDetailsViewNamed($tabName), self::loadingIconForTabInDetailsViewNamed($tabName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds"); Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds");
} }
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class FilesAppSharingContext implements Context, ActorAwareInterface { class FilesAppSharingContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -371,8 +372,8 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
self::shareLinkMenu($shareLinkMenuTriggerElement), self::shareLinkMenu($shareLinkMenuTriggerElement),
$timeout = 2 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 2 * $this->actor->getFindTimeoutMultiplier())) {
// It may not be possible to click on the menu button (due to the // It may not be possible to click on the menu button (due to the
// menu itself covering it), so "Esc" key is pressed instead. // menu itself covering it), so "Enter" key is pressed instead.
$this->actor->find(self::shareLinkMenu($shareLinkMenuTriggerElement), 2)->getWrappedElement()->keyPress(27); $this->actor->find(self::shareLinkMenuButton(), 2)->getWrappedElement()->keyPress(13);
} }
$this->actor->find(self::copyLinkButton(), 10)->click(); $this->actor->find(self::copyLinkButton(), 10)->click();
@ -513,7 +514,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
* @Then I see that the file is shared with me by :sharedByName * @Then I see that the file is shared with me by :sharedByName
*/ */
public function iSeeThatTheFileIsSharedWithMeBy($sharedByName) { public function iSeeThatTheFileIsSharedWithMeBy($sharedByName) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::sharedByLabel(), 10)->getText(), "Shared with you by $sharedByName"); $this->actor->find(self::sharedByLabel(), 10)->getText(), "Shared with you by $sharedByName");
} }
@ -521,7 +522,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
* @Then I see that the file is shared with :sharedWithName * @Then I see that the file is shared with :sharedWithName
*/ */
public function iSeeThatTheFileIsSharedWith($sharedWithName) { public function iSeeThatTheFileIsSharedWith($sharedWithName) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible()); $this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible());
} }
@ -533,7 +534,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::sharedWithRow($sharedWithName), self::sharedWithRow($sharedWithName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The shared with $sharedWithName row is still shown after $timeout seconds"); Assert::fail("The shared with $sharedWithName row is still shown after $timeout seconds");
} }
} }
@ -541,9 +542,9 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
* @Then I see that resharing the file is not allowed * @Then I see that resharing the file is not allowed
*/ */
public function iSeeThatResharingTheFileIsNotAllowed() { public function iSeeThatResharingTheFileIsNotAllowed() {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); $this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("placeholder"), "Resharing is not allowed"); $this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("placeholder"), "Resharing is not allowed");
} }
@ -555,7 +556,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::shareLinkAddNewButton(), self::shareLinkAddNewButton(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The add new share link button is still shown after $timeout seconds"); Assert::fail("The add new share link button is still shown after $timeout seconds");
} }
} }
@ -566,7 +567,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
} }
@ -577,7 +578,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -588,7 +589,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canEditCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -599,7 +600,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
} }
@ -610,7 +611,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -621,7 +622,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canCreateCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -636,7 +637,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::canReshareCheckbox($sharedWithName, $shareWithMenuTriggerElement), self::canReshareCheckbox($sharedWithName, $shareWithMenuTriggerElement),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The resharing checkbox for $sharedWithName is still shown after $timeout seconds"); Assert::fail("The resharing checkbox for $sharedWithName is still shown after $timeout seconds");
} }
} }
@ -647,7 +648,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -658,7 +659,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareWithMenuIfNeeded($sharedWithName); $this->showShareWithMenuIfNeeded($sharedWithName);
$shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10); $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked()); $this->actor->find(self::canReshareCheckboxInput($sharedWithName, $shareWithMenuTriggerElement), 10)->isChecked());
} }
@ -669,7 +670,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareLinkMenuIfNeeded(); $this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); Assert::assertTrue($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked());
} }
/** /**
@ -679,7 +680,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareLinkMenuIfNeeded(); $this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); Assert::assertFalse($this->actor->find(self::hideDownloadCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked());
} }
/** /**
@ -708,7 +709,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::disabledPasswordProtectField($shareLinkMenuTriggerElement), self::disabledPasswordProtectField($shareLinkMenuTriggerElement),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The password protect field is still disabled after $timeout seconds"); Assert::fail("The password protect field is still disabled after $timeout seconds");
} }
} }
@ -719,8 +720,8 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareLinkMenuIfNeeded(); $this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked(), "Password protect checkbox is checked"); Assert::assertTrue($this->actor->find(self::passwordProtectCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked(), "Password protect checkbox is checked");
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 10)->isVisible(), "Password protect field is visible"); Assert::assertTrue($this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 10)->isVisible(), "Password protect field is visible");
} }
/** /**
@ -730,7 +731,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareLinkMenuIfNeeded(); $this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); Assert::assertTrue($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked());
} }
/** /**
@ -740,7 +741,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$this->showShareLinkMenuIfNeeded(); $this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked()); Assert::assertFalse($this->actor->find(self::passwordProtectByTalkCheckboxInput($shareLinkMenuTriggerElement), 10)->isChecked());
} }
/** /**
@ -751,7 +752,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10); $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 10);
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::passwordProtectByTalkCheckbox($shareLinkMenuTriggerElement))->isVisible()); $this->actor->find(self::passwordProtectByTalkCheckbox($shareLinkMenuTriggerElement))->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }

View File

@ -23,6 +23,7 @@
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use PHPUnit\Framework\Assert;
class LoginPageContext implements Context, ActorAwareInterface { class LoginPageContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -90,7 +91,7 @@ class LoginPageContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the Login page * @Then I see that the current page is the Login page
*/ */
public function iSeeThatTheCurrentPageIsTheLoginPage() { public function iSeeThatTheCurrentPageIsTheLoginPage() {
PHPUnit_Framework_Assert::assertStringStartsWith( Assert::assertStringStartsWith(
$this->actor->locatePath("/login"), $this->actor->locatePath("/login"),
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
} }
@ -99,7 +100,7 @@ class LoginPageContext implements Context, ActorAwareInterface {
* @Then I see that a wrong password message is shown * @Then I see that a wrong password message is shown
*/ */
public function iSeeThatAWrongPasswordMessageIsShown() { public function iSeeThatAWrongPasswordMessageIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::wrongPasswordMessage(), 10)->isVisible()); $this->actor->find(self::wrongPasswordMessage(), 10)->isVisible());
} }
@ -107,7 +108,7 @@ class LoginPageContext implements Context, ActorAwareInterface {
* @Then I see that the disabled user message is shown * @Then I see that the disabled user message is shown
*/ */
public function iSeeThatTheDisabledUserMessageIsShown() { public function iSeeThatTheDisabledUserMessageIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::userDisabledMessage(), 10)->isVisible()); $this->actor->find(self::userDisabledMessage(), 10)->isVisible());
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class PublicShareContext implements Context, ActorAwareInterface { class PublicShareContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -143,7 +144,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the Authenticate page for the shared link I wrote down * @Then I see that the current page is the Authenticate page for the shared link I wrote down
*/ */
public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheSharedLinkIWroteDown() { public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheSharedLinkIWroteDown() {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->getSharedNotebook()["shared link"] . "/authenticate/showShare", $this->actor->getSharedNotebook()["shared link"] . "/authenticate/showShare",
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
} }
@ -152,7 +153,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the Authenticate page for the direct download shared link I wrote down * @Then I see that the current page is the Authenticate page for the direct download shared link I wrote down
*/ */
public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheDirectDownloadSharedLinkIWroteDown() { public function iSeeThatTheCurrentPageIsTheAuthenticatePageForTheDirectDownloadSharedLinkIWroteDown() {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->getSharedNotebook()["shared link"] . "/authenticate/downloadShare", $this->actor->getSharedNotebook()["shared link"] . "/authenticate/downloadShare",
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
} }
@ -161,7 +162,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the shared link I wrote down * @Then I see that the current page is the shared link I wrote down
*/ */
public function iSeeThatTheCurrentPageIsTheSharedLinkIWroteDown() { public function iSeeThatTheCurrentPageIsTheSharedLinkIWroteDown() {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->getSharedNotebook()["shared link"], $this->actor->getSharedNotebook()["shared link"],
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
@ -172,7 +173,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that the current page is the direct download shared link I wrote down * @Then I see that the current page is the direct download shared link I wrote down
*/ */
public function iSeeThatTheCurrentPageIsTheDirectDownloadSharedLinkIWroteDown() { public function iSeeThatTheCurrentPageIsTheDirectDownloadSharedLinkIWroteDown() {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->getSharedNotebook()["shared link"] . "/download", $this->actor->getSharedNotebook()["shared link"] . "/download",
$this->actor->getSession()->getCurrentUrl()); $this->actor->getSession()->getCurrentUrl());
} }
@ -181,7 +182,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that a wrong password for the shared file message is shown * @Then I see that a wrong password for the shared file message is shown
*/ */
public function iSeeThatAWrongPasswordForTheSharedFileMessageIsShown() { public function iSeeThatAWrongPasswordForTheSharedFileMessageIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::wrongPasswordMessage(), 10)->isVisible()); $this->actor->find(self::wrongPasswordMessage(), 10)->isVisible());
} }
@ -194,19 +195,19 @@ class PublicShareContext implements Context, ActorAwareInterface {
// command not having been processed by the browser. // command not having been processed by the browser.
if (!WaitFor::elementToBeEventuallyShown( if (!WaitFor::elementToBeEventuallyShown(
$this->actor, self::shareMenu(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $this->actor, self::shareMenu(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The Share menu is not visible yet after $timeout seconds"); Assert::fail("The Share menu is not visible yet after $timeout seconds");
} }
// The acceptance tests are run in a window wider than the mobile breakpoint, so the // The acceptance tests are run in a window wider than the mobile breakpoint, so the
// download item should not be shown in the menu (although it will be in // download item should not be shown in the menu (although it will be in
// the DOM). // the DOM).
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::downloadItemInShareMenu())->isVisible(), $this->actor->find(self::downloadItemInShareMenu())->isVisible(),
"Download item in share menu is visible"); "Download item in share menu is visible");
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::directLinkItemInShareMenu())->isVisible(), $this->actor->find(self::directLinkItemInShareMenu())->isVisible(),
"Direct link item in share menu is not visible"); "Direct link item in share menu is not visible");
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::saveItemInShareMenu())->isVisible(), $this->actor->find(self::saveItemInShareMenu())->isVisible(),
"Save item in share menu is not visible"); "Save item in share menu is not visible");
} }
@ -216,7 +217,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatTheShareMenuButtonIsNotShown() { public function iSeeThatTheShareMenuButtonIsNotShown() {
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::shareMenuButton())->isVisible()); $this->actor->find(self::shareMenuButton())->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
@ -226,7 +227,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
* @Then I see that the shared file preview shows the text :text * @Then I see that the shared file preview shows the text :text
*/ */
public function iSeeThatTheSharedFilePreviewShowsTheText($text) { public function iSeeThatTheSharedFilePreviewShowsTheText($text) {
PHPUnit_Framework_Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText()); Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText());
} }
/** /**
@ -235,7 +236,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
public function iSeeThatTheDownloadButtonIsShown() { public function iSeeThatTheDownloadButtonIsShown() {
if (!WaitFor::elementToBeEventuallyShown( if (!WaitFor::elementToBeEventuallyShown(
$this->actor, self::downloadButton(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $this->actor, self::downloadButton(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The download button is not visible yet after $timeout seconds"); Assert::fail("The download button is not visible yet after $timeout seconds");
} }
} }
@ -244,7 +245,7 @@ class PublicShareContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatTheDownloadButtonIsNotShown() { public function iSeeThatTheDownloadButtonIsNotShown() {
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::downloadButton())->isVisible()); $this->actor->find(self::downloadButton())->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class SearchContext implements Context, ActorAwareInterface { class SearchContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -99,7 +100,7 @@ class SearchContext implements Context, ActorAwareInterface {
* @Then I see that the search result :number is :name * @Then I see that the search result :number is :name
*/ */
public function iSeeThatTheSearchResultIs($number, $name) { public function iSeeThatTheSearchResultIs($number, $name) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$name, $this->actor->find(self::searchResultName($number), 10)->getText()); $name, $this->actor->find(self::searchResultName($number), 10)->getText());
} }
@ -107,7 +108,7 @@ class SearchContext implements Context, ActorAwareInterface {
* @Then I see that the search result :number was found in :path * @Then I see that the search result :number was found in :path
*/ */
public function iSeeThatTheSearchResultWasFoundIn($number, $path) { public function iSeeThatTheSearchResultWasFoundIn($number, $path) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$path, $this->actor->find(self::searchResultPath($number), 10)->getText()); $path, $this->actor->find(self::searchResultPath($number), 10)->getText());
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class SettingsContext implements Context, ActorAwareInterface { class SettingsContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -180,7 +181,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that shares are accepted by default * @Then I see that shares are accepted by default
*/ */
public function iSeeThatSharesAreAcceptedByDefault() { public function iSeeThatSharesAreAcceptedByDefault() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked());
} }
@ -188,7 +189,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that resharing is enabled * @Then I see that resharing is enabled
*/ */
public function iSeeThatResharingIsEnabled() { public function iSeeThatResharingIsEnabled() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked()); $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
} }
@ -196,7 +197,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that resharing is disabled * @Then I see that resharing is disabled
*/ */
public function iSeeThatResharingIsDisabled() { public function iSeeThatResharingIsDisabled() {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked()); $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
} }
@ -204,7 +205,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that username autocompletion is restricted to groups * @Then I see that username autocompletion is restricted to groups
*/ */
public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() { public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked()); $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked());
} }
@ -212,7 +213,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that username autocompletion is not restricted to groups * @Then I see that username autocompletion is not restricted to groups
*/ */
public function iSeeThatUsernameAutocompletionIsNotRestrictedToGroups() { public function iSeeThatUsernameAutocompletionIsNotRestrictedToGroups() {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked()); $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked());
} }
@ -220,7 +221,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that shares are not accepted by default * @Then I see that shares are not accepted by default
*/ */
public function iSeeThatSharesAreNotAcceptedByDefault() { public function iSeeThatSharesAreNotAcceptedByDefault() {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked());
} }
@ -228,7 +229,7 @@ class SettingsContext implements Context, ActorAwareInterface {
* @Then I see that the button to select tags is shown * @Then I see that the button to select tags is shown
*/ */
public function iSeeThatTheButtonToSelectTagsIsShown() { public function iSeeThatTheButtonToSelectTagsIsShown() {
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible());
} }
/** /**
@ -243,7 +244,7 @@ class SettingsContext implements Context, ActorAwareInterface {
// necessary to repeatedly open the dropdown until the tag is shown in // necessary to repeatedly open the dropdown until the tag is shown in
// the dropdown (or the limit of tries is reached). // the dropdown (or the limit of tries is reached).
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible()); Assert::assertTrue($this->actor->find(self::systemTagsSelectTagButton(), 10)->isVisible());
$actor = $this->actor; $actor = $this->actor;
@ -277,6 +278,6 @@ class SettingsContext implements Context, ActorAwareInterface {
} }
} }
PHPUnit_Framework_Assert::fail("The dropdown in system tags section in Administration Settings does not contain the tag $tag after $numberOfTries tries"); Assert::fail("The dropdown in system tags section in Administration Settings does not contain the tag $tag after $numberOfTries tries");
} }
} }

View File

@ -23,6 +23,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class SettingsMenuContext implements Context, ActorAwareInterface { class SettingsMenuContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -155,7 +156,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the Settings menu is shown * @Then I see that the Settings menu is shown
*/ */
public function iSeeThatTheSettingsMenuIsShown() { public function iSeeThatTheSettingsMenuIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::settingsMenu(), 10)->isVisible()); $this->actor->find(self::settingsMenu(), 10)->isVisible());
} }
@ -163,14 +164,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the Settings menu has only :items items * @Then I see that the Settings menu has only :items items
*/ */
public function iSeeThatTheSettingsMenuHasOnlyXItems($items) { public function iSeeThatTheSettingsMenuHasOnlyXItems($items) {
PHPUnit_Framework_Assert::assertCount(intval($items), self::menuItems()); Assert::assertCount(intval($items), self::menuItems());
} }
/** /**
* @Then I see that the :itemText item in the Settings menu is shown * @Then I see that the :itemText item in the Settings menu is shown
*/ */
public function iSeeThatTheItemInTheSettingsMenuIsShown($itemText) { public function iSeeThatTheItemInTheSettingsMenuIsShown($itemText) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::menuItemFor($itemText), 10)->isVisible()); $this->actor->find(self::menuItemFor($itemText), 10)->isVisible());
} }
@ -181,7 +182,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
$this->iSeeThatTheSettingsMenuIsShown(); $this->iSeeThatTheSettingsMenuIsShown();
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::menuItemFor($itemText))->isVisible()); $this->actor->find(self::menuItemFor($itemText))->isVisible());
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {
} }
@ -191,7 +192,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the :itemText settings panel is shown * @Then I see that the :itemText settings panel is shown
*/ */
public function iSeeThatTheItemSettingsPanelIsShown($itemText) { public function iSeeThatTheItemSettingsPanelIsShown($itemText) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible()
); );
} }
@ -200,7 +201,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
* @Then I see that the :itemText entry in the settings panel is shown * @Then I see that the :itemText entry in the settings panel is shown
*/ */
public function iSeeThatTheItemEntryInTheSettingsPanelIsShown($itemText) { public function iSeeThatTheItemEntryInTheSettingsPanelIsShown($itemText) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::settingsPanelEntryFor($itemText), 10)->isVisible() $this->actor->find(self::settingsPanelEntryFor($itemText), 10)->isVisible()
); );
} }
@ -210,7 +211,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
*/ */
public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) { public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) {
try { try {
PHPUnit_Framework_Assert::assertFalse( Assert::assertFalse(
$this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible()
); );
} catch (NoSuchElementException $exception) { } catch (NoSuchElementException $exception) {

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class ThemingAppContext implements Context, ActorAwareInterface { class ThemingAppContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -88,7 +89,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
// background of the input element, it means the color element has been // background of the input element, it means the color element has been
// initialized. // initialized.
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::inputFieldFor("Color"), 10)->isVisible()); Assert::assertTrue($this->actor->find(self::inputFieldFor("Color"), 10)->isVisible());
$actor = $this->actor; $actor = $this->actor;
@ -103,7 +104,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
}; };
if (!Utils::waitFor($colorSelectorLoadedCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { if (!Utils::waitFor($colorSelectorLoadedCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) {
PHPUnit_Framework_Assert::fail("The color selector in Theming app has not been loaded after $timeout seconds"); Assert::fail("The color selector in Theming app has not been loaded after $timeout seconds");
} }
} }
@ -117,7 +118,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
// HEX Color, convert to RGB array. // HEX Color, convert to RGB array.
$tmpColor = sscanf($color, "%02X%02X%02X"); $tmpColor = sscanf($color, "%02X%02X%02X");
} else { } else {
PHPUnit_Framework_Assert::fail("The acceptance test does not know how to handle the color string : '$color'. " Assert::fail("The acceptance test does not know how to handle the color string : '$color'. "
. "Please provide # before HEX colors in your features."); . "Please provide # before HEX colors in your features.");
} }
return $tmpColor; return $tmpColor;
@ -136,7 +137,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
}; };
if (!Utils::waitFor($headerColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { if (!Utils::waitFor($headerColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) {
PHPUnit_Framework_Assert::fail("The header color is not $color yet after $timeout seconds"); Assert::fail("The header color is not $color yet after $timeout seconds");
} }
} }
@ -144,7 +145,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
* @Then I see that the parameters in the Theming app are eventually saved * @Then I see that the parameters in the Theming app are eventually saved
*/ */
public function iSeeThatTheParametersInTheThemingAppAreEventuallySaved() { public function iSeeThatTheParametersInTheThemingAppAreEventuallySaved() {
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::statusMessage(), 10)->isVisible()); Assert::assertTrue($this->actor->find(self::statusMessage(), 10)->isVisible());
$actor = $this->actor; $actor = $this->actor;
@ -157,7 +158,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
}; };
if (!Utils::waitFor($savedStatusMessageShownCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { if (!Utils::waitFor($savedStatusMessageShownCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) {
PHPUnit_Framework_Assert::fail("The 'Saved' status messages in Theming app has not been shown after $timeout seconds"); Assert::fail("The 'Saved' status messages in Theming app has not been shown after $timeout seconds");
} }
} }
} }

View File

@ -22,6 +22,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class ToastContext implements Context, ActorAwareInterface { class ToastContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -47,7 +48,7 @@ class ToastContext implements Context, ActorAwareInterface {
* @Then I see that the :message toast is shown * @Then I see that the :message toast is shown
*/ */
public function iSeeThatTheToastIsShown($message) { public function iSeeThatTheToastIsShown($message) {
PHPUnit_Framework_Assert::assertTrue($this->actor->find( Assert::assertTrue($this->actor->find(
self::toastMessage($message), 10)->isVisible()); self::toastMessage($message), 10)->isVisible());
} }
} }

View File

@ -24,6 +24,7 @@
*/ */
use Behat\Behat\Context\Context; use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
class UsersSettingsContext implements Context, ActorAwareInterface { class UsersSettingsContext implements Context, ActorAwareInterface {
use ActorAware; use ActorAware;
@ -271,7 +272,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::rowForUser($user), self::rowForUser($user),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The user $user in the list of users is not shown yet after $timeout seconds"); Assert::fail("The user $user in the list of users is not shown yet after $timeout seconds");
} }
} }
@ -283,7 +284,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::rowForUser($user), self::rowForUser($user),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The user $user in the list of users is still shown after $timeout seconds"); Assert::fail("The user $user in the list of users is still shown after $timeout seconds");
} }
} }
@ -291,7 +292,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the new user form is shown * @Then I see that the new user form is shown
*/ */
public function iSeeThatTheNewUserFormIsShown() { public function iSeeThatTheNewUserFormIsShown() {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::newUserForm(), 10)->isVisible()); $this->actor->find(self::newUserForm(), 10)->isVisible());
} }
@ -299,7 +300,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the :action action in the :user actions menu is shown * @Then I see that the :action action in the :user actions menu is shown
*/ */
public function iSeeTheAction($action, $user) { public function iSeeTheAction($action, $user) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::theAction($action, $user), 10)->isVisible()); $this->actor->find(self::theAction($action, $user), 10)->isVisible());
} }
@ -307,7 +308,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the :column column is shown * @Then I see that the :column column is shown
*/ */
public function iSeeThatTheColumnIsShown($column) { public function iSeeThatTheColumnIsShown($column) {
PHPUnit_Framework_Assert::assertTrue( Assert::assertTrue(
$this->actor->find(self::theColumn($column), 10)->isVisible()); $this->actor->find(self::theColumn($column), 10)->isVisible());
} }
@ -315,7 +316,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the :field of :user is :value * @Then I see that the :field of :user is :value
*/ */
public function iSeeThatTheFieldOfUserIs($field, $user, $value) { public function iSeeThatTheFieldOfUserIs($field, $user, $value) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::inputForUserInCell($field, $user), 10)->getValue(), $value); $this->actor->find(self::inputForUserInCell($field, $user), 10)->getValue(), $value);
} }
@ -323,7 +324,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the display name for the user :user is :displayName * @Then I see that the display name for the user :user is :displayName
*/ */
public function iSeeThatTheDisplayNameForTheUserIs($user, $displayName) { public function iSeeThatTheDisplayNameForTheUserIs($user, $displayName) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$displayName, $this->actor->find(self::displayNameCellForUser($user), 10)->getValue()); $displayName, $this->actor->find(self::displayNameCellForUser($user), 10)->getValue());
} }
@ -349,7 +350,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::classCellForUser($cell . ' icon-loading-small', $user), self::classCellForUser($cell . ' icon-loading-small', $user),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The loading icon for user $user is still shown after $timeout seconds"); Assert::fail("The loading icon for user $user is still shown after $timeout seconds");
} }
} }
@ -357,7 +358,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @Then I see that the user quota of :user is :quota * @Then I see that the user quota of :user is :quota
*/ */
public function iSeeThatTheuserQuotaIs($user, $quota) { public function iSeeThatTheuserQuotaIs($user, $quota) {
PHPUnit_Framework_Assert::assertEquals( Assert::assertEquals(
$this->actor->find(self::selectedSelectOption('quota', $user), 2)->getText(), $quota); $this->actor->find(self::selectedSelectOption('quota', $user), 2)->getText(), $quota);
} }
@ -369,7 +370,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
$this->actor, $this->actor,
self::editModeOn($user), self::editModeOn($user),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The edit mode for user $user in the list of users is not on yet after $timeout seconds"); Assert::fail("The edit mode for user $user in the list of users is not on yet after $timeout seconds");
} }
} }
} }

View File

@ -135,6 +135,8 @@ class ActorContext extends RawMinkContext {
$this->actors = []; $this->actors = [];
$this->sharedNotebook = []; $this->sharedNotebook = [];
$this->getSession()->start();
$this->actors["default"] = new Actor("default", $this->getSession(), $this->getMinkParameter("base_url"), $this->sharedNotebook); $this->actors["default"] = new Actor("default", $this->getSession(), $this->getMinkParameter("base_url"), $this->sharedNotebook);
$this->actors["default"]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier); $this->actors["default"]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier);
@ -159,6 +161,8 @@ class ActorContext extends RawMinkContext {
*/ */
public function iActAs($actorName) { public function iActAs($actorName) {
if (!array_key_exists($actorName, $this->actors)) { if (!array_key_exists($actorName, $this->actors)) {
$this->getSession($actorName)->start();
$this->actors[$actorName] = new Actor($actorName, $this->getSession($actorName), $this->getMinkParameter("base_url"), $this->sharedNotebook); $this->actors[$actorName] = new Actor($actorName, $this->getSession($actorName), $this->getMinkParameter("base_url"), $this->sharedNotebook);
$this->actors[$actorName]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier); $this->actors[$actorName]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier);
} }