Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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) <[email protected]>
  • Loading branch information
skjnldsv authored and MorrisJobke committed Jul 20, 2018
commit 562e2aa30bd1c0b1766be01b2cd5de7b8f753008
10 changes: 5 additions & 5 deletions tests/acceptance/features/app-files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tests/acceptance/features/bootstrap/CommentsAppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ 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");
}

/**
* @return Locator
*/
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");
}

/**
* @return Locator
*/
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");
}

/**
Expand All @@ -59,7 +59,7 @@ public static function commentList() {
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");
}

/**
Expand Down
138 changes: 61 additions & 77 deletions tests/acceptance/features/bootstrap/FilesAppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,73 +63,63 @@ public static function currentSectionMainView() {
/**
* @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");
}

/**
* @return Locator
*/
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");
}

/**
Expand Down Expand Up @@ -161,37 +151,37 @@ private static function select2Dropdown() {
/**
* @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");
}

/**
Expand All @@ -202,15 +192,15 @@ public static function shareLinkCheckbox() {
// 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");
}

/**
* @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");
}

Expand All @@ -222,7 +212,7 @@ public static function allowUploadAndEditingRadioButton() {
// 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");
}

Expand All @@ -234,23 +224,23 @@ public static function passwordProtectCheckbox() {
// 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");
}

/**
* @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");
}

/**
* @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");
}

Expand All @@ -265,14 +255,14 @@ public function iCloseTheDetailsView() {
* @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();
}

/**
Expand Down Expand Up @@ -347,35 +337,29 @@ public function iSeeThatTheCurrentPageIsTheFilesApp() {
}

/**
* @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");
}
}

Expand All @@ -384,23 +368,23 @@ private function assertDetailsViewForSectionsAreClosed($sections) {
*/
public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) {
PHPUnit_Framework_Assert::assertEquals(
$this->actor->find(self::fileNameInCurrentSectionDetailsView(), 10)->getText(), $fileName);
$this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName);
}

/**
* @Then I see that the input field for tags in the details view is shown
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::inputFieldForTagsInCurrentSectionDetailsView(), 10)->isVisible());
$this->actor->find(self::inputFieldForTagsInDetailsView(), 10)->isVisible());
}

/**
* @Then I see that the input field for tags in the details view contains the tag :tag
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag), 10)->isVisible());
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag), 10)->isVisible());
}

/**
Expand All @@ -411,7 +395,7 @@ public function iSeeThatTheInputFieldForTagsInTheDetailsViewDoesNotContainTheTag

try {
PHPUnit_Framework_Assert::assertFalse(
$this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag))->isVisible());
$this->actor->find(self::itemInInputFieldForTagsInDetailsViewForTag($tag))->isVisible());
} catch (NoSuchElementException $exception) {
}
}
Expand Down Expand Up @@ -441,7 +425,7 @@ public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($
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");
}
Expand Down