Browse Source

Adjust acceptance tests to sidebar changes in Files app

Before, each section of the Files app ("All files", "Favorites"...) had
its own sidebar element. Now there is a single sidebar element for all
the sections in the Files app.

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v14.0.0beta1
John Molakvoæ (skjnldsv) 6 years ago
parent
commit
562e2aa30b
No account linked to committer's email address

+ 5
- 5
tests/acceptance/features/app-files.feature View File

@@ -6,7 +6,7 @@ Feature: app-files
And I see that "welcome.txt" is marked as favorite
And I open the "Favorites" section
And I open the details view for "welcome.txt"
And I see that the details view for "Favorites" section is open
And I see that the details view is open
When I view "welcome.txt" in folder
Then I see that the current section is "All files"
And I see that the details view is closed
@@ -17,11 +17,11 @@ Feature: app-files
And I see that "welcome.txt" is marked as favorite
And I open the "Favorites" section
And I open the details view for "welcome.txt"
And I see that the details view for "Favorites" section is open
And I see that the details view is open
And I view "welcome.txt" in folder
And I see that the current section is "All files"
When I open the details view for "welcome.txt"
Then I see that the details view for "All files" section is open
Then I see that the details view is open

Scenario: rename a file with the details view open
Given I am logged in
@@ -151,14 +151,14 @@ Feature: app-files
Scenario: show the input field for tags in the details view
Given I am logged in
And I open the details view for "welcome.txt"
And I see that the details view for "All files" section is open
And I see that the details view is open
When I open the input field for tags in the details view
Then I see that the input field for tags in the details view is shown

Scenario: show the input field for tags in the details view after the sharing tab has loaded
Given I am logged in
And I open the details view for "welcome.txt"
And I see that the details view for "All files" section is open
And I see that the details view is open
And I open the "Sharing" tab in the details view
And I see that the "Sharing" tab in the details view is eventually loaded
When I open the input field for tags in the details view

+ 7
- 7
tests/acceptance/features/bootstrap/CommentsAppContext.php View File

@@ -31,8 +31,8 @@ class CommentsAppContext implements Context, ActorAwareInterface {
*/
public static function newCommentField() {
return Locator::forThe()->css("div.newCommentRow .message")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("New comment field in current section details view in Files app");
descendantOf(FilesAppContext::detailsView())->
describedAs("New comment field in details view in Files app");
}

/**
@@ -40,8 +40,8 @@ class CommentsAppContext implements Context, ActorAwareInterface {
*/
public static function submitNewCommentButton() {
return Locator::forThe()->css("div.newCommentRow .submit")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Submit new comment button in current section details view in Files app");
descendantOf(FilesAppContext::detailsView())->
describedAs("Submit new comment button in details view in Files app");
}

/**
@@ -49,8 +49,8 @@ class CommentsAppContext implements Context, ActorAwareInterface {
*/
public static function commentList() {
return Locator::forThe()->css("ul.comments")->
descendantOf(FilesAppContext::currentSectionDetailsView())->
describedAs("Comment list in current section details view in Files app");
descendantOf(FilesAppContext::detailsView())->
describedAs("Comment list in details view in Files app");
}

/**
@@ -59,7 +59,7 @@ class CommentsAppContext implements Context, ActorAwareInterface {
public static function commentWithText($text) {
return Locator::forThe()->xpath("//div[normalize-space() = '$text']/ancestor::li")->
descendantOf(self::commentList())->
describedAs("Comment with text \"$text\" in current section details view in Files app");
describedAs("Comment with text \"$text\" in details view in Files app");
}

/**

+ 61
- 77
tests/acceptance/features/bootstrap/FilesAppContext.php View File

@@ -63,19 +63,9 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
public static function detailsViewForSection($section) {
return Locator::forThe()->xpath("/preceding-sibling::*[position() = 1 and @id = 'app-sidebar']")->
descendantOf(self::mainViewForSection($section))->
describedAs("Details view for section $section in Files app");
}

/**
* @return Locator
*/
public static function currentSectionDetailsView() {
return Locator::forThe()->xpath("/preceding-sibling::*[position() = 1 and @id = 'app-sidebar']")->
descendantOf(self::currentSectionMainView())->
describedAs("Current section details view in Files app");
public static function detailsView() {
return Locator::forThe()->id("app-sidebar")->
describedAs("Details view in Files app");
}

/**
@@ -83,53 +73,53 @@ class FilesAppContext implements Context, ActorAwareInterface {
*/
public static function closeDetailsViewButton() {
return Locator::forThe()->css(".icon-close")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Close current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("Close details view in Files app");
}

/**
* @return Locator
*/
public static function fileNameInCurrentSectionDetailsView() {
public static function fileNameInDetailsView() {
return Locator::forThe()->css(".fileName")->
descendantOf(self::currentSectionDetailsView())->
describedAs("File name in current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("File name in details view in Files app");
}

/**
* @return Locator
*/
public static function fileDetailsInCurrentSectionDetailsViewWithText($fileDetailsText) {
public static function fileDetailsInDetailsViewWithText($fileDetailsText) {
return Locator::forThe()->xpath("//span[normalize-space() = '$fileDetailsText']")->
descendantOf(self::fileDetailsInCurrentSectionDetailsView())->
describedAs("File details with text \"$fileDetailsText\" in current section details view in Files app");
descendantOf(self::fileDetailsInDetailsView())->
describedAs("File details with text \"$fileDetailsText\" in details view in Files app");
}

/**
* @return Locator
*/
private static function fileDetailsInCurrentSectionDetailsView() {
private static function fileDetailsInDetailsView() {
return Locator::forThe()->css(".file-details")->
descendantOf(self::currentSectionDetailsView())->
describedAs("File details in current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("File details in details view in Files app");
}

/**
* @return Locator
*/
public static function inputFieldForTagsInCurrentSectionDetailsView() {
public static function inputFieldForTagsInDetailsView() {
return Locator::forThe()->css(".systemTagsInfoView")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Input field for tags in current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("Input field for tags in details view in Files app");
}

/**
* @return Locator
*/
public static function itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag) {
public static function itemInInputFieldForTagsInDetailsViewForTag($tag) {
return Locator::forThe()->xpath("//span[normalize-space() = '$tag']")->
descendantOf(self::inputFieldForTagsInCurrentSectionDetailsView())->
describedAs("Item in input field for tags in current section details view for tag $tag in Files app");
descendantOf(self::inputFieldForTagsInDetailsView())->
describedAs("Item in input field for tags in details view for tag $tag in Files app");
}

/**
@@ -161,37 +151,37 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
public static function tabHeaderInCurrentSectionDetailsViewNamed($tabHeaderName) {
public static function tabHeaderInDetailsViewNamed($tabHeaderName) {
return Locator::forThe()->xpath("//li[normalize-space() = '$tabHeaderName']")->
descendantOf(self::tabHeadersInCurrentSectionDetailsView())->
describedAs("Tab header named $tabHeaderName in current section details view in Files app");
descendantOf(self::tabHeadersInDetailsView())->
describedAs("Tab header named $tabHeaderName in details view in Files app");
}

/**
* @return Locator
*/
private static function tabHeadersInCurrentSectionDetailsView() {
private static function tabHeadersInDetailsView() {
return Locator::forThe()->css(".tabHeaders")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Tab headers in current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("Tab headers in details view in Files app");
}

/**
* @return Locator
*/
public static function tabInCurrentSectionDetailsViewNamed($tabName) {
public static function tabInDetailsViewNamed($tabName) {
return Locator::forThe()->xpath("//div[@id=//*[contains(concat(' ', normalize-space(@class), ' '), ' tabHeader ') and normalize-space() = '$tabName']/@data-tabid]")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Tab named $tabName in current section details view in Files app");
descendantOf(self::detailsView())->
describedAs("Tab named $tabName in details view in Files app");
}

/**
* @return Locator
*/
public static function loadingIconForTabInCurrentSectionDetailsViewNamed($tabName) {
public static function loadingIconForTabInDetailsViewNamed($tabName) {
return Locator::forThe()->css(".loading")->
descendantOf(self::tabInCurrentSectionDetailsViewNamed($tabName))->
describedAs("Loading icon for tab named $tabName in current section details view in Files app");
descendantOf(self::tabInDetailsViewNamed($tabName))->
describedAs("Loading icon for tab named $tabName in details view in Files app");
}

/**
@@ -202,7 +192,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
// return the checkbox itself, but the element that the user interacts
// with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Share link']")->
descendantOf(self::currentSectionDetailsView())->
descendantOf(self::detailsView())->
describedAs("Share link checkbox in the details view in Files app");
}

@@ -210,7 +200,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @return Locator
*/
public static function shareLinkField() {
return Locator::forThe()->css(".linkText")->descendantOf(self::currentSectionDetailsView())->
return Locator::forThe()->css(".linkText")->descendantOf(self::detailsView())->
describedAs("Share link field in the details view in Files app");
}

@@ -222,7 +212,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
// that would return the radio button itself, but the element that the
// user interacts with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Allow upload and editing']")->
descendantOf(self::currentSectionDetailsView())->
descendantOf(self::detailsView())->
describedAs("Allow upload and editing radio button in the details view in Files app");
}

@@ -234,7 +224,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
// would return the checkbox itself, but the element that the user
// interacts with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Password protect']")->
descendantOf(self::currentSectionDetailsView())->
descendantOf(self::detailsView())->
describedAs("Password protect checkbox in the details view in Files app");
}

@@ -242,7 +232,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @return Locator
*/
public static function passwordProtectField() {
return Locator::forThe()->css(".linkPassText")->descendantOf(self::currentSectionDetailsView())->
return Locator::forThe()->css(".linkPassText")->descendantOf(self::detailsView())->
describedAs("Password protect field in the details view in Files app");
}

@@ -250,7 +240,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @return Locator
*/
public static function passwordProtectWorkingIcon() {
return Locator::forThe()->css(".linkPass .icon-loading-small")->descendantOf(self::currentSectionDetailsView())->
return Locator::forThe()->css(".linkPass .icon-loading-small")->descendantOf(self::detailsView())->
describedAs("Password protect working icon in the details view in Files app");
}

@@ -265,14 +255,14 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Given I open the input field for tags in the details view
*/
public function iOpenTheInputFieldForTagsInTheDetailsView() {
$this->actor->find(self::fileDetailsInCurrentSectionDetailsViewWithText("Tags"), 10)->click();
$this->actor->find(self::fileDetailsInDetailsViewWithText("Tags"), 10)->click();
}

/**
* @Given I open the :tabName tab in the details view
*/
public function iOpenTheTabInTheDetailsView($tabName) {
$this->actor->find(self::tabHeaderInCurrentSectionDetailsViewNamed($tabName), 10)->click();
$this->actor->find(self::tabHeaderInDetailsViewNamed($tabName), 10)->click();
}

/**
@@ -347,35 +337,29 @@ class FilesAppContext implements Context, ActorAwareInterface {
}

/**
* @Then I see that the details view for :section section is open
* @Then I see that the details view is open
*/
public function iSeeThatTheDetailsViewForSectionIsOpen($section) {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::detailsViewForSection($section), 10)->isVisible());

$otherSections = self::sections();
unset($otherSections[$section]);

$this->assertDetailsViewForSectionsAreClosed($otherSections);
public function iSeeThatTheDetailsViewIsOpen() {
// The sidebar always exists in the DOM, so it has to be explicitly
// waited for it to be visible instead of relying on the implicit wait
// made to find the element.
if (!WaitFor::elementToBeEventuallyShown(
$this->actor,
self::detailsView(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The details view is not open yet after $timeout seconds");
}
}

/**
* @Then I see that the details view is closed
*/
public function iSeeThatTheDetailsViewIsClosed() {
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::currentSectionMainView(), 10));

$this->assertDetailsViewForSectionsAreClosed(self::sections());
}

private function assertDetailsViewForSectionsAreClosed($sections) {
foreach ($sections as $section => $id) {
try {
PHPUnit_Framework_Assert::assertFalse(
$this->actor->find(self::detailsViewForSection($section))->isVisible(),
"Details view for section $section is open but it should be closed");
} catch (NoSuchElementException $exception) {
}
if (!WaitFor::elementToBeEventuallyNotShown(
$this->actor,
self::detailsView(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The details view is not closed yet after $timeout seconds");
}
}

@@ -384,7 +368,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
*/
public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) {
PHPUnit_Framework_Assert::assertEquals(
$this->actor->find(self::fileNameInCurrentSectionDetailsView(), 10)->getText(), $fileName);
$this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName);
}

/**
@@ -392,7 +376,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::inputFieldForTagsInCurrentSectionDetailsView(), 10)->isVisible());
$this->actor->find(self::inputFieldForTagsInDetailsView(), 10)->isVisible());
}

/**
@@ -400,7 +384,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag), 10)->isVisible());
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag), 10)->isVisible());
}

/**
@@ -411,7 +395,7 @@ class FilesAppContext implements Context, ActorAwareInterface {

try {
PHPUnit_Framework_Assert::assertFalse(
$this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag))->isVisible());
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag))->isVisible());
} catch (NoSuchElementException $exception) {
}
}
@@ -441,7 +425,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
public function iSeeThatTheTabInTheDetailsViewIsEventuallyLoaded($tabName) {
if (!WaitFor::elementToBeEventuallyNotShown(
$this->actor,
self::loadingIconForTabInCurrentSectionDetailsViewNamed($tabName),
self::loadingIconForTabInDetailsViewNamed($tabName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds");
}

Loading…
Cancel
Save