-
Notifications
You must be signed in to change notification settings - Fork 47
[Behat] Add Behat test for issue EZP-25642 users 'Delete' button #553
base: master
Are you sure you want to change the base?
Changes from 1 commit
980df25
9eafc7f
d1591ab
b641dea
1fa996f
e79ba26
515e519
0538b73
98a533b
daaff8e
389f07a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,20 @@ private function goToContentWithPath($path) | |
$this->clickOnTreePath($path); | ||
} | ||
|
||
|
||
/** | ||
* @Then I should see a :button button in the action bar | ||
* | ||
* @param string $button Text of the element in the action bar | ||
*/ | ||
public function iShouldSeeActionBarButton($button) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Argument naming: |
||
{ | ||
$element = $this->getElementByText($button, '.ez-actionbar-container .ez-action', '.action-label'); | ||
if (!$element) { | ||
throw new \Exception("Action bar button '$button' not found"); | ||
} | ||
} | ||
|
||
/** | ||
* @Then I am on the :name location view | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,15 @@ public function iCreateUser(TableNode $users = null) | |
} | ||
} | ||
|
||
/** | ||
* @When I go to (the) User :username page | ||
*/ | ||
public function goToUserPage($username) | ||
{ | ||
$this->clickOnTreePath("$username $username"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, won't this work solely for users created in behat (same first/last name)? Correct/long approach would be to load the User's first/last name then use those values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a context problem, connected to what I have said above. We should/could store the created user's reference, so that we can easily navigate to it. It would avoid having to reference the same fake string, and we could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But besides that, @joaoinacio is right.
If we end up with the scenario I gave as an example:
The first sentence would both create the user, and navigate to its page. It could do the navigation part by calling |
||
$this->sleep(); //safegaurd for application delays | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: |
||
} | ||
|
||
/** | ||
* @When I edit user :username | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,10 @@ Feature: Use the eZ Users field | |
And I fill in "Password" with "12345" | ||
And I fill in "Confirm password" with "123456" | ||
Then I should see error messages | ||
|
||
@javascript @edge | ||
Scenario: Validate that users have the "Delete" button available | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The scenario describes something a bit different. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was really suggesting that the sentence was replaced. As I see it, the scenario covers the fact that "Send to trash" is replaced with "Delete". We can easily formulate that as one sentence. Or did you have something else in mind ? |
||
Given I am on the Users page | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How we get there does not really matter in this context. We could wrap the first three sentences into something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The objective of the scenario is not to view a users' data, but to be on a user's page, so 'view' might mislead the reader. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Well, "page" is not a term from the platform / platform ui domain. But it is at least a generic web term. Opinion, @dpobel ?
Note that the goal ain't really to shorten, but to limit the context to what matters in, well, the context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i tend to agree with @bdunogier. to testing this delete button existence there is no need to check where are you coming front. in fact, you could access this kind of |
||
And there is a User with name "One" | ||
When I go to User "One" page | ||
Then I should see a "Delete" button in the action bar | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to complete that: what we are testing here is indeed that we are getting a delete button on users, but also that we are not getting a "send to trash" button. What about
(what about changing the above with |
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.
Extra spaces ?