Skip to content

Commit

Permalink
Assert through UI due to different containers in context and driver
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmarcinkowski committed Jan 26, 2016
1 parent e37f3b5 commit 667d327
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
16 changes: 16 additions & 0 deletions features/user/users.feature
Expand Up @@ -110,6 +110,22 @@ Feature: Customers management
And "Customer has been successfully updated" should appear on the page
And "umpirsky@gmail.com" should appear on the page

Scenario: Username should be the same as email after email change
Given I am editing customer with email "rick@foo.com"
When I fill in "Email" with "umpirsky@gmail.com"
And I press "Save changes"
Then "Customer has been successfully updated" should appear on the page
And the customer should have username "umpirsky@gmail.com"

Scenario: Updating user properties during email change
Given I am editing customer with email "rick@foo.com"
When I fill in "Email" with "umpirsky@gmail.com"
And I check "Enabled"
And I press "Save changes"
Then "Customer has been successfully updated" should appear on the page
And the customer should have username "umpirsky@gmail.com"
And the customer should be enabled

Scenario: Changing customer's password and logging in with new one
Given I am editing customer with email "dale@foo.com"
And I fill in "Password" with "Sylius!"
Expand Down
16 changes: 16 additions & 0 deletions src/Sylius/Bundle/WebBundle/Behat/WebContext.php
Expand Up @@ -753,6 +753,22 @@ public function theCodeFieldShouldBeDisabled()
$this->assertSession()->elementAttributeContains('css', '[id$="code"]', 'disabled', 'disabled');
}

/**
* @Then the customer should have username :username
*/
public function theCustomerWithEmailShouldHaveUsername($username)
{
$this->assertSession()->elementContains('css', '#username', $username);
}

/**
* @Then the customer should be enabled
*/
public function theCustomerShouldBeEnabled()
{
$this->assertSession()->elementContains('css', '#enabled', 'yes');
}

private function assertRoute($route)
{
$this->assertSession()->addressEquals($this->generatePageUrl($route));
Expand Down
Expand Up @@ -55,7 +55,7 @@
{% endif %}
<tr>
<td><strong>{{ 'sylius.user.username'|trans }}</strong></td>
<td>
<td id="username">
{% if customer.user is not null %}
{{ customer.user.username }}
{% endif %}
Expand All @@ -67,7 +67,7 @@
</tr>
<tr>
<td><strong>{{ 'sylius.user.enabled'|trans }}</strong></td>
<td>
<td id="enabled">
{% if customer.user is not null %}
{{ state_label(customer.user.enabled) }}
{% endif %}
Expand Down

0 comments on commit 667d327

Please sign in to comment.