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

[stable10] UI tests for delete feature #28811

Merged
merged 1 commit into from
Aug 28, 2017

Conversation

phil-davis
Copy link
Contributor

Backport #28809

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"
Copy link
Contributor

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"

Copy link
Contributor Author

@phil-davis phil-davis Aug 28, 2017

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:

  1. when "delete the file"
  2. then "see if it is gone from the local page"
  3. when "reload the page"
  4. then "see if it really is gone"
    because if the Javascript/AJAX is not working properly, (2) and/or (4) might fail.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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:

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

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:

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

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

            When I delete the elements
              | simple-folder |
              | lorem.txt |
                 (...)
	Then the deleted items should not be listed

If the difference between folder and element is required, using another column detailing folder/file.

Copy link
Member

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@individual-it individual-it merged commit 3bd93f9 into stable10 Aug 28, 2017
@individual-it individual-it deleted the stable10-ui-tests-delete-files branch August 28, 2017 10:27
@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants