From 8da738cf196715f629c6765d2a9745e7e4acbe1f Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 25 Oct 2022 16:32:20 +0545 Subject: [PATCH] Refactored step implementation for adding public link to server --- .../features/bootstrap/WebUISharingContext.php | 7 +++---- .../features/lib/PublicLinkFilesPage.php | 18 ------------------ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php index b8a321adc113..a1ff64007c30 100644 --- a/tests/acceptance/features/bootstrap/WebUISharingContext.php +++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php @@ -1283,18 +1283,17 @@ public function thePublicAddsThePublicLinkToUsingTheWebUI( if (!$this->publicLinkFilesPage->isOpen()) { throw new Exception('Not on public link page!'); } - if ($server === '%remote_server%') { + $servers = ['%local_server%', '%remote_server%']; + if (\in_array($server, $servers)) { $server = $this->featureContext->substituteInLineCodes($server); $this->publicLinkFilesPage->addToServer($server); - } elseif ($server === '%local_server%') { - $this->publicLinkFilesPage->saveToSameServer(); } else { throw new Exception( "Invalid server provided '" . $server . "'. " . "Either should be '%remote_server%' or '%local_server%'" ); } - // addToServer and saveToSameServer takes us from the public link page to the login page + // addToServer takes us from the public link page to the login page // of the remote and local server respectively, waiting for us to login. $actualUsername = $this->featureContext->getActualUsername($username); $password = $this->featureContext->getUserPassword($actualUsername); diff --git a/tests/acceptance/features/lib/PublicLinkFilesPage.php b/tests/acceptance/features/lib/PublicLinkFilesPage.php index 31e5a392503b..e88be096b478 100644 --- a/tests/acceptance/features/lib/PublicLinkFilesPage.php +++ b/tests/acceptance/features/lib/PublicLinkFilesPage.php @@ -576,22 +576,4 @@ public function getCompletelyUploadedElements(): array { } return $uploadedElements; } - - /** - * adding public link share to same server instance - * - * @return void - * @throws ElementNotFoundException - */ - public function saveToSameServer(): void { - $saveToElement = $this->findById($this->saveToOcButtonId); - - $this->assertElementNotNull( - $saveToElement, - __METHOD__ . - " id $this->saveToOcButtonId could not find 'Add To' button" - ); - - $saveToElement->click(); - } }