From 252734c9ed146a92359d66e4e98d717d6b3d8682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 28 Jun 2018 17:07:24 +0200 Subject: [PATCH] Acceptance fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- tests/acceptance/features/app-files.feature | 10 +-- .../features/bootstrap/FilesAppContext.php | 64 ++++++------------- 2 files changed, 24 insertions(+), 50 deletions(-) diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 97f173441871b..956430c02ba0e 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -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 diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index 50997d98b0f59..a40370df0c0ae 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -63,18 +63,8 @@ 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())-> + public static function currentDetailsView() { + return Locator::forThe()->id("app-sidebar")-> describedAs("Current section details view in Files app"); } @@ -83,7 +73,7 @@ public static function currentSectionDetailsView() { */ public static function closeDetailsViewButton() { return Locator::forThe()->css(".icon-close")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("Close current section details view in Files app"); } @@ -92,7 +82,7 @@ public static function closeDetailsViewButton() { */ public static function fileNameInCurrentSectionDetailsView() { return Locator::forThe()->css(".fileName")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("File name in current section details view in Files app"); } @@ -110,7 +100,7 @@ public static function fileDetailsInCurrentSectionDetailsViewWithText($fileDetai */ private static function fileDetailsInCurrentSectionDetailsView() { return Locator::forThe()->css(".file-details")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("File details in current section details view in Files app"); } @@ -119,7 +109,7 @@ private static function fileDetailsInCurrentSectionDetailsView() { */ public static function inputFieldForTagsInCurrentSectionDetailsView() { return Locator::forThe()->css(".systemTagsInfoView")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("Input field for tags in current section details view in Files app"); } @@ -172,7 +162,7 @@ public static function tabHeaderInCurrentSectionDetailsViewNamed($tabHeaderName) */ private static function tabHeadersInCurrentSectionDetailsView() { return Locator::forThe()->css(".tabHeaders")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("Tab headers in current section details view in Files app"); } @@ -181,7 +171,7 @@ private static function tabHeadersInCurrentSectionDetailsView() { */ public static function tabInCurrentSectionDetailsViewNamed($tabName) { return Locator::forThe()->xpath("//div[@id=//*[contains(concat(' ', normalize-space(@class), ' '), ' tabHeader ') and normalize-space() = '$tabName']/@data-tabid]")-> - descendantOf(self::currentSectionDetailsView())-> + descendantOf(self::currentDetailsView())-> describedAs("Tab named $tabName in current section details view in Files app"); } @@ -202,7 +192,7 @@ 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::currentDetailsView())-> describedAs("Share link checkbox in the details view in Files app"); } @@ -210,7 +200,7 @@ public static function shareLinkCheckbox() { * @return Locator */ public static function shareLinkField() { - return Locator::forThe()->css(".linkText")->descendantOf(self::currentSectionDetailsView())-> + return Locator::forThe()->css(".linkText")->descendantOf(self::currentDetailsView())-> describedAs("Share link field in the details view in Files app"); } @@ -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::currentDetailsView())-> describedAs("Allow upload and editing radio button in the details view in Files app"); } @@ -234,7 +224,7 @@ 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::currentDetailsView())-> describedAs("Password protect checkbox in the details view in Files app"); } @@ -242,7 +232,7 @@ public static function passwordProtectCheckbox() { * @return Locator */ public static function passwordProtectField() { - return Locator::forThe()->css(".linkPassText")->descendantOf(self::currentSectionDetailsView())-> + return Locator::forThe()->css(".linkPassText")->descendantOf(self::currentDetailsView())-> describedAs("Password protect field in the details view in Files app"); } @@ -250,7 +240,7 @@ public static function passwordProtectField() { * @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::currentDetailsView())-> describedAs("Password protect working icon in the details view in Files app"); } @@ -347,36 +337,20 @@ 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) { + public function iSeeThatTheDetailsViewIsOpen() { PHPUnit_Framework_Assert::assertTrue( - $this->actor->find(self::detailsViewForSection($section), 10)->isVisible()); - - $otherSections = self::sections(); - unset($otherSections[$section]); - - $this->assertDetailsViewForSectionsAreClosed($otherSections); + $this->actor->find(self::currentDetailsView(), 10)->isVisible()); } /** * @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()); - } + PHPUnit_Framework_Assert::assertFalse( + $this->actor->find(self::currentDetailsView(), 10)->isVisible()); - 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) { - } - } } /**