Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Retry upload test runs 02 #30522

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
60 changes: 60 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,66 @@ matrix:
TEST_SUITE: coverage
FILES_EXTERNAL_TYPE: webdav

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: upload
DB_TYPE: mariadb
USE_SERVER: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
BEHAT_SUITE: other
Expand Down
18 changes: 18 additions & 0 deletions tests/ui/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Behat\MinkExtension\Context\RawMinkContext;
use Page\LoginPage;
use Page\OwncloudPage;
use SensioLabs\Behat\PageObjectExtension\PageObject\Exception\ElementNotFoundException;
use TestHelpers\AppConfigHelper;
use TestHelpers\SetupHelper;
use TestHelpers\UploadHelper;
Expand Down Expand Up @@ -174,6 +175,23 @@ public function getCurrentPageObject() {
return $this->currentPageObject;
}

/**
* @Then no notification should be displayed
* @return void
*/
public function noNotificationShouldBeDisplayed() {
try {
$notificationText = $this->owncloudPage->getNotificationText();
PHPUnit_Framework_Assert::assertEquals(
'',
$notificationText,
"Expecting no notifications but got $notificationText"
);
} catch (ElementNotFoundException $e) {
// if there is no notification element, then good
}
}

/**
* @Then a notification should be displayed with the text :notificationText
* @param string $notificationText expected notification text
Expand Down
39 changes: 39 additions & 0 deletions tests/ui/features/bootstrap/FilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,45 @@ public function iUploadOverwritingTheFile($name) {
$this->iClickTheButton("Continue");
}

/**
* @When I upload overwriting the file :name and retry if the file is locked
* @param string $name
* @return void
*/
public function iUploadOverwritingTheFileRetry($name) {
$previousNotificationsCount = 0;

for ($retryCounter = 0; $retryCounter < STANDARDRETRYCOUNT; $retryCounter++) {
$this->iUploadTheFile($name);
$this->choiceInUploadConflict("new");
$this->iClickTheButton("Continue");

try {
$notifications = $this->filesPage->getNotifications();
} catch (ElementNotFoundException $e) {
$notifications = [];
}

$currentNotificationsCount = count($notifications);

if ($currentNotificationsCount > $previousNotificationsCount) {
$message = "Upload overwriting $name and got $currentNotificationsCount notifications including " . end($notifications) . "\n";
echo $message;
error_log($message);
$previousNotificationsCount = $currentNotificationsCount;
usleep(STANDARDSLEEPTIMEMICROSEC);
} else {
break;
}
}

if ($retryCounter > 0) {
$message = "INFORMATION: retried to upload overwriting file $name $retryCounter times";
echo $message;
error_log($message);
}
}

/**
* @When I upload the file :name keeping both new and existing files
* @param string $name
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/features/bootstrap/SharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private function addToListOfCreatedPublicLinks($name, $url) {
* @return void
*/
public function theFileFolderIsSharedWithTheUser(
$folder, $remote, $user, $maxRetries = 5, $quiet = false
$folder, $remote, $user, $maxRetries = STANDARDRETRYCOUNT, $quiet = false
) {
$this->filesPage->waitTillPageIsloaded($this->getSession());
try {
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/features/bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@
const STANDARDUIWAITTIMEOUTMILLISEC = 10000;
// Minimum timeout for use in code that needs to wait for the UI
const MINIMUMUIWAITTIMEOUTMILLISEC = 500;
// Default number of times to retry where retries are useful
const STANDARDRETRYCOUNT = 5;
4 changes: 2 additions & 2 deletions tests/ui/features/lib/FilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function renameFile(
$fromFileName,
$toFileName,
Session $session,
$maxRetries = 5
$maxRetries = STANDARDRETRYCOUNT
) {
if (is_array($toFileName)) {
$toFileName = implode($toFileName);
Expand Down Expand Up @@ -281,7 +281,7 @@ public function renameFile(
* @return void
*/
public function moveFileTo(
$name, $destination, Session $session, $maxRetries = 5
$name, $destination, Session $session, $maxRetries = STANDARDRETRYCOUNT
) {
$toMoveFileRow = $this->findFileRowByName($name, $session);
$destinationFileRow = $this->findFileRowByName($destination, $session);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/features/lib/FilesPageBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function openFile($name, Session $session) {
* @param int $maxRetries
* @return void
*/
public function deleteFile($name, Session $session, $maxRetries = 5) {
public function deleteFile($name, Session $session, $maxRetries = STANDARDRETRYCOUNT) {
$this->initAjaxCounters($session);
$this->resetSumStartedAjaxRequests($session);

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/features/lib/PublicLinkFilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function renameFile(
$fromFileName,
$toFileName,
Session $session,
$maxRetries = 5
$maxRetries = STANDARDRETRYCOUNT
) {
throw new \Exception("not implemented");
}
Expand All @@ -143,7 +143,7 @@ public function renameFile(
* @return void
*/
public function moveFileTo(
$name, $destination, Session $session, $maxRetries = 5
$name, $destination, Session $session, $maxRetries = STANDARDRETRYCOUNT
) {
throw new \Exception("not implemented");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ So that other users have access to these files
And I relogin with username "user1" and password "1234" to "http://%remote_server%"
And the offered remote shares are accepted
And I open the folder "simple-folder (2)"
And I upload overwriting the file "lorem.txt"
And I upload overwriting the file "lorem.txt" and retry if the file is locked
And I relogin with username "user2" and password "1234" to "%base_url%"
And I open the folder "simple-folder"
Then the file "lorem.txt" should be listed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ So that public sharing is limited according to organization policy
When I open the folder "simple-folder (2)"
Then the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the original "simple-folder/lorem.txt"
When I upload overwriting the file "lorem.txt"
When I upload overwriting the file "lorem.txt" and retry if the file is locked
Then the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the local "lorem.txt"
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ So that those groups can access the files and folders
And I relogin with username "user1" and password "1234"
Then the content of "new-lorem.txt" should not be the same as the local "new-lorem.txt"
# overwrite the received shared file
When I upload overwriting the file "new-lorem.txt"
When I upload overwriting the file "new-lorem.txt" and retry if the file is locked
Then the file "new-lorem.txt" should be listed
And the content of "new-lorem.txt" should be the same as the local "new-lorem.txt"
# unshare the received shared file
Expand All @@ -61,7 +61,7 @@ So that those groups can access the files and folders
And I open the folder "new-simple-folder"
Then the content of "lorem.txt" should not be the same as the local "lorem.txt"
# overwrite an existing file in the received share
When I upload overwriting the file "lorem.txt"
When I upload overwriting the file "lorem.txt" and retry if the file is locked
Then the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the local "lorem.txt"
# upload a new file into the received share
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ So that those users can access the files and folders
And I relogin with username "user1" and password "1234"
Then the content of "new-lorem.txt" should not be the same as the local "new-lorem.txt"
# overwrite the received shared file
When I upload overwriting the file "new-lorem.txt"
When I upload overwriting the file "new-lorem.txt" and retry if the file is locked
Then the file "new-lorem.txt" should be listed
And the content of "new-lorem.txt" should be the same as the local "new-lorem.txt"
# unshare the received shared file
Expand All @@ -50,7 +50,7 @@ So that those users can access the files and folders
And I open the folder "new-simple-folder"
Then the content of "lorem.txt" should not be the same as the local "lorem.txt"
# overwrite an existing file in the received share
When I upload overwriting the file "lorem.txt"
When I upload overwriting the file "lorem.txt" and retry if the file is locked
Then the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the local "lorem.txt"
# upload a new file into the received share
Expand Down
24 changes: 12 additions & 12 deletions tests/ui/features/upload/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,33 @@ So that I can store files in ownCloud

Scenario: simple upload of a file that does not exist before
When I upload the file "new-lorem.txt"
Then the file "new-lorem.txt" should be listed
Then no notification should be displayed
And the file "new-lorem.txt" should be listed
And the content of "new-lorem.txt" should be the same as the local "new-lorem.txt"

Scenario: chunking upload
And a file with the size of "30000000" bytes and the name "big-video.mp4" exists
When I upload the file "big-video.mp4"
Then the file "big-video.mp4" should be listed
Then no notification should be displayed
And the file "big-video.mp4" should be listed
And the content of "big-video.mp4" should be the same as the local "big-video.mp4"

Scenario: conflict with a chunked file
And a file with the size of "30000000" bytes and the name "big-video.mp4" exists
When I rename the file "lorem.txt" to "big-video.mp4"
And I upload the file "big-video.mp4"
And I choose to keep the new files
And I click the "Continue" button
And I upload overwriting the file "big-video.mp4" and retry if the file is locked
Then the file "big-video.mp4" should be listed
And the content of "big-video.mp4" should be the same as the local "big-video.mp4"

Scenario: upload a new file into a sub folder
When I open the folder "simple-folder"
And I upload the file "new-lorem.txt"
Then the file "new-lorem.txt" should be listed
Then no notification should be displayed
And the file "new-lorem.txt" should be listed
And the content of "new-lorem.txt" should be the same as the local "new-lorem.txt"

Scenario: overwrite an existing file
When I upload the file "lorem.txt"
And I choose to keep the new files
And I click the "Continue" button
When I upload overwriting the file "lorem.txt" and retry if the file is locked
Then no dialog should be displayed
And the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the local "lorem.txt"
Expand All @@ -53,6 +52,7 @@ So that I can store files in ownCloud
And I choose to keep the existing files
And I click the "Continue" button
Then no dialog should be displayed
And no notification should be displayed
And the file "lorem.txt" should be listed
And the content of "lorem.txt" should not have changed
And the file "lorem (2).txt" should be listed
Expand All @@ -62,15 +62,14 @@ So that I can store files in ownCloud
When I upload the file "lorem.txt"
And I click the "Cancel" button
Then no dialog should be displayed
And no notification should be displayed
And the file "lorem.txt" should be listed
And the content of "lorem.txt" should not have changed
And the file "lorem (2).txt" should not be listed

Scenario: overwrite an existing file in a sub-folder
When I open the folder "simple-folder"
When I upload the file "lorem.txt"
And I choose to keep the new files
And I click the "Continue" button
And I upload overwriting the file "lorem.txt" and retry if the file is locked
Then the file "lorem.txt" should be listed
And the content of "lorem.txt" should be the same as the local "lorem.txt"

Expand All @@ -81,6 +80,7 @@ So that I can store files in ownCloud
And I choose to keep the existing files
And I click the "Continue" button
Then no dialog should be displayed
And no notification should be displayed
And the file "lorem.txt" should be listed
And the content of "lorem.txt" should not have changed
And the file "lorem (2).txt" should be listed
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/features/upload/uploadEdgecases.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ that is not academically correct but saves a lot of time
| "strängé नेपाली folder" |

Scenario: overwrite an existing file
When I upload overwriting the file "'single'quotes.txt"
When I upload overwriting the file "'single'quotes.txt" and retry if the file is locked
Then the file "'single'quotes.txt" should be listed
And the content of "'single'quotes.txt" should be the same as the local "'single'quotes.txt"

When I upload overwriting the file "strängé filename (duplicate #2 &).txt"
When I upload overwriting the file "strängé filename (duplicate #2 &).txt" and retry if the file is locked
Then the file "strängé filename (duplicate #2 &).txt" should be listed
And the content of "strängé filename (duplicate #2 &).txt" should be the same as the local "strängé filename (duplicate #2 &).txt"

When I upload overwriting the file "zzzz-must-be-last-file-in-folder.txt"
When I upload overwriting the file "zzzz-must-be-last-file-in-folder.txt" and retry if the file is locked
Then the file "zzzz-must-be-last-file-in-folder.txt" should be listed
And the content of "zzzz-must-be-last-file-in-folder.txt" should be the same as the local "zzzz-must-be-last-file-in-folder.txt"

Expand Down