Skip to content

Commit

Permalink
Merge pull request owncloud#40451 from owncloud/add-step-implementation
Browse files Browse the repository at this point in the history
[tests-only] Refactored step implementation for adding public link to server
  • Loading branch information
individual-it authored Nov 9, 2022
2 parents e890777 + 8da738c commit 353925d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
7 changes: 3 additions & 4 deletions tests/acceptance/features/bootstrap/WebUISharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 0 additions & 18 deletions tests/acceptance/features/lib/PublicLinkFilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 353925d

Please sign in to comment.