Skip to content

Commit

Permalink
Merge pull request #28838 from owncloud/stable10-ui-tests-delete-more…
Browse files Browse the repository at this point in the history
…-readable

[stable10] make UI tests delete feature more readable
  • Loading branch information
Vincent Petry authored Aug 29, 2017
2 parents 50d2f4a + 0e14e0a commit 17eef30
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 52 deletions.
53 changes: 53 additions & 0 deletions tests/ui/features/bootstrap/FilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
class FilesContext extends RawMinkContext implements Context
{
private $filesPage;

/**
* Table of all files and folders that should have been deleted stored so
* that other steps can use the list to check if the deletion happened correctly
* table headings: must be: |name|
*
* @var TableNode
*/
private $deletedElementsTable;

public function __construct(FilesPage $filesPage)
{
Expand Down Expand Up @@ -163,6 +172,50 @@ public function iDeleteTheFollowingFile(TableNode $namePartsTable) {
$this->filesPage->deleteFile($fileNameParts, $this->getSession());
}

/**
* @When I delete the elements
* @param TableNode $table table of file names
* table headings: must be: |name|
* @return void
*/
public function iDeleteTheElements(TableNode $table) {
$this->deletedElementsTable = $table;
foreach ($this->deletedElementsTable as $file) {
$this->iDeleteTheFile($file['name']);
}
}

/**
* @Then the deleted elements should not be listed
* @return void
*/
public function theDeletedElementsShouldNotBeListed() {
foreach ($this->deletedElementsTable as $file) {
$this->theFileFolderShouldNotBeListed($file['name']);
}
}

/**
* @Then the deleted elements should not be listed after a page reload
* @return void
*/
public function theDeletedElementsShouldNotBeListedAfterPageReload() {
$this->theFilesPageIsReloaded();
$this->theDeletedElementsShouldNotBeListed();
}

/**
* @When I batch delete these files
* @param TableNode $files table of file names
* table headings: must be: |name|
* @return void
*/
public function iBatchDeleteTheseFiles(TableNode $files) {
$this->deletedElementsTable = $files;
$this->iMarkTheseFilesForBatchAction($files);
$this->iBatchDeleteTheMarkedFiles();
}

/**
* @When I batch delete the marked files
* @return void
Expand Down
92 changes: 40 additions & 52 deletions tests/ui/features/files/delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,54 @@ Feature: delete
And I am on the files page

Scenario: Delete files & folders one by one and check its existence after page reload
When I delete the folder "simple-folder"
Then the folder "simple-folder" should not be listed
When I delete the file "lorem.txt"
Then the file "lorem.txt" should not be listed
When I delete the folder "strängé नेपाली folder"
Then the folder "strängé नेपाली folder" should not be listed
When I delete the file "strängé filename (duplicate #2).txt"
Then the file "strängé filename (duplicate #2).txt" should not be listed
When the files page is reloaded
Then the folder "simple-folder" should not be listed
And the folder "strängé नेपाली folder" should not be listed
And the file "lorem.txt" should not be listed
And the file "strängé filename (duplicate #2).txt" should not be listed
When I delete the elements
| name |
| simple-folder |
| lorem.txt |
| strängé नेपाली folder |
| strängé filename (duplicate #2).txt |
Then the deleted elements should not be listed
And the deleted elements should not be listed after a page reload

Scenario: Delete a file with problematic characters
When I rename the following file to
|from-name-parts |to-name-parts |
|lorem.txt |'single' |
| |"double" quotes|
| |question? |
| |&and#hash |
| from-name-parts | to-name-parts |
| lorem.txt | 'single' |
| | "double" quotes |
| | question? |
| | &and#hash |
And the files page is reloaded
Then the following file should be listed
|name-parts |
|'single' |
|"double" quotes|
|question? |
|&and#hash |
| name-parts |
| 'single' |
| "double" quotes |
| question? |
| &and#hash |
And I delete the following file
|name-parts |
|'single' |
|"double" quotes|
|question? |
|&and#hash |
| name-parts |
| 'single' |
| "double" quotes |
| question? |
| &and#hash |
Then the following file should not be listed
|name-parts |
|'single' |
|"double" quotes|
|question? |
|&and#hash |
| name-parts |
| 'single' |
| "double" quotes |
| question? |
| &and#hash |
And the files page is reloaded
Then the following file should not be listed
|name-parts |
|'single' |
|"double" quotes|
|question? |
|&and#hash |
| name-parts |
| 'single' |
| "double" quotes |
| question? |
| &and#hash |

Scenario: Delete multiple files at once
When I mark these files for batch action
|name |
|data.zip|
|lorem.txt|
|simple-folder|
And I batch delete the marked files
Then the folder "simple-folder" should not be listed
And the file "data.zip" should not be listed
And the file "lorem.txt" should not be listed
When the files page is reloaded
Then the folder "simple-folder" should not be listed
And the file "data.zip" should not be listed
And the file "lorem.txt" should not be listed

When I batch delete these files
| name |
| data.zip |
| lorem.txt |
| simple-folder |
Then the deleted elements should not be listed
And the deleted elements should not be listed after a page reload

0 comments on commit 17eef30

Please sign in to comment.