-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[stable10] UI tests for delete feature #28811
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Feature: delete | ||
|
||
Background: | ||
Given a regular user exists | ||
And I am logged in as a regular user | ||
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 | ||
|
||
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 | | ||
And the files page is reloaded | ||
Then the following file should be listed | ||
|name-parts | | ||
|'single' | | ||
|"double" quotes| | ||
|question? | | ||
|&and#hash | | ||
And I delete the following file | ||
|name-parts | | ||
|'single' | | ||
|"double" quotes| | ||
|question? | | ||
|&and#hash | | ||
Then the following file should not be listed | ||
|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 | | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be only one when per scenario. many "Given" one "When" and many "Then"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true in theory. There should be some "Given" steps to set things up (they might all be in the Background: like here), then a set of "When" (with maybe a few steps) to carry out the actions, then a set of "Then" that check the result.
So we could easily make separate scenarios here.
The practical side for UI tests, is that the "test setup" phase - creating user, logging in, navigating to the desired page... - takes so long. So to speed it up, it is practical to make multiple when-then in a scenario.
Also, sometimes there are genuinely mixed sequences of when-then needed. e.g. even if only 1 file delete is tested here, we want to:
because if the Javascript/AJAX is not working properly, (2) and/or (4) might fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a sample discussion of this issue, where there is a "workflow" to be acceptance tested:
https://stackoverflow.com/questions/12060011/is-it-acceptable-to-write-a-given-when-then-when-then-test-in-gherkin
and of course there are different opinions on how best to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach, it is like a test script. You could use given-and as preconditions, or even hiding those thens after the whens by checking it directly in the code.
There should be only one thing marked as when, rest are preconditions or postconditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step sequence could be re-ordered so the "when" all come first:
the last "When the files page is reloaded" could be renamed to "And the files page is reloaded" - that just "hides" the fact that it is an action, and makes no real difference.
Maybe it could be cut down to:
and the code can remember which files have been deleted, and code for
Then the deleted items should not be listed
can check for the files on the current page, then reload the page and check again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, this is a back-port of a commit in master. Whatever we change needs to be changed in master and also back-ported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be a table
If the difference between folder and element is required, using another column detailing folder/file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SergioBertolinSG Let me merge this as its only a backport and I will do a new PR against master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍