-
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?
[Behat] Add Behat test for issue EZP-25642 users 'Delete' button #553
Conversation
/** | ||
* @Then I should see a :button button in the action bar | ||
* | ||
* @param string $button Text of the element in the action bar |
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 ?
{ | ||
$element = $this->getElementByText($buttonText, '.ez-actionbar-container .ez-action', '.action-label'); | ||
if (!$element) { | ||
throw new \Exception("Action bar button '$buttonText' not found"); |
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.
File seems to be using EzAssertion
already, should it keep doing so, for consistency?
EzAssertion::assertSingleElement($buttonText, $element, null, 'Action bar button');
as suggested by @joaoinacio, depends now on EzAssertion |
It already did ;) +1 |
572f6ae
to
515e519
Compare
{ | ||
$this->iAmOnPage('Users'); | ||
$this->waitWhileLoading(); | ||
$this->clickOnTreePath("$username $username"); |
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.
actually, won't this work solely for users created in behat (same first/last name)?
what about admin, etc?
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 comment
The 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 uniqid()
in generated names to ensure uniqueness.
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.
But besides that, @joaoinacio is right.
- Either the function accepts a username as an argument, in which case it must use the userService to load the user, and get the content's name.
- or the function accepts a user content name, and doesn't have to load the user, but it needs to be specified in the sentence.
If we end up with the scenario I gave as an example:
When I go to a valid user's page
Then I do not see a "Send to trash" action bar button
...
The first sentence would both create the user, and navigate to its page. It could do the navigation part by calling goToUserPage()
, using the created content name as the argument.
+1 (however should pass on travis, trying to restart) |
@joaoinacio now the User first and last name are loaded and used instead of assuming they are always the same. |
… User to select from the conten tree
3465f04
to
0538b73
Compare
There is a point that I had raised, and that got hidden by a commit, but that still stands: #553 (diff). I don't think we should have a username at all here, as it doesn't matter to the situation (happens on any user, without any particular characteristic). |
Scenario: Validate that users have the "Delete" button available | ||
Given there is a User with name "One" | ||
When I go to User "One" page | ||
Then I should not see a "Send to thrash" action bar button |
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.
Typo: thrash should be trash.
@bdunogier regarding the not having the username on the sentence,... What would you suggest, having a new sentence that uses the admin user or creates a new user just for the test? |
Well, in that scenario, we could use the admin. The problem is that if somebody uses the same sentence to test removal somehow, we will end up in trouble :-) I'd rather make the sentence create a user. It is what we mostly do for now, is it not ? |
|
||
@javascript @edge | ||
Scenario: Validate "Send to trash" button is replaced with "Delete" when browsing users | ||
Scenario: Validate that users have the "Delete" button available |
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 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 ?
7edf484
to
98a533b
Compare
… User to select from the conten tree
2aea1be
to
d61cd85
Compare
d61cd85
to
389f07a
Compare
Scenario: Validate "Send to trash" button is replaced with "Delete" when browsing users | ||
When I go to a valid User page | ||
Then I should not see a "Send to trash" action bar button | ||
And I should see a "Delete" action bar button |
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.
We could replace "and" with "but", I think it works too. And it sounds a bit better :-)
Behat BDD tests for issue https://jira.ez.no/browse/EZP-25642
This test adds the verification that the in the PlatformUI Action bar menu there is a 'Delete' button and not a 'Send to trash'. Since the users should be deleted and not sent to trash.