Skip to content

Commit ae02dc5

Browse files
committedSep 12, 2017
[Behat] Add scenario for changing an email of a customer
1 parent ecb0572 commit ae02dc5

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@managing_customers
2+
Feature: Changing an email of an existing customer
3+
In order to be able to help a customer when he wants to change his email
4+
As an Administrator
5+
I want to be able to edit the customer's email
6+
7+
Background:
8+
Given the store operates on a single channel in "United States"
9+
And there is a customer "Frodo Baggins" with an email "f.baggins@example.com" and a password "ring"
10+
And I am logged in as an administrator
11+
12+
@ui
13+
Scenario: Changing an email of an existing customer
14+
When I want to edit this customer
15+
And I change their email to "strawberry@example.com"
16+
And I save my changes
17+
Then I should be notified that it has been successfully edited
18+
And the customer should be able to log in as "strawberry@example.com" with "ring" password

‎src/Sylius/Behat/Context/Setup/CustomerContext.php

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public function theStoreHasEnabledCustomerAccountWithPassword($email, $password
145145

146146
/**
147147
* @Given there is a customer :name identified by an email :email and a password :password
148+
* @Given there is a customer :name with an email :email and a password :password
148149
*/
149150
public function theStoreHasCustomerAccountWithEmailAndPassword($name, $email, $password)
150151
{

‎src/Sylius/Behat/Context/Ui/Admin/ManagingCustomersContext.php

+10-9
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ public function iSpecifyItsEmailAs($email = null)
115115
$this->createPage->specifyEmail($email);
116116
}
117117

118+
/**
119+
* @When I change their email to :email
120+
* @When I remove its email
121+
*/
122+
public function iChangeTheirEmailTo(?string $email = null): void
123+
{
124+
$this->updatePage->changeEmail($email);
125+
}
126+
118127
/**
119128
* @When I add them
120129
* @When I try to add them
@@ -160,7 +169,7 @@ public function iSpecifyItsBirthdayAs($birthday)
160169
}
161170

162171
/**
163-
* @Given /^I want to edit (this customer)$/
172+
* @When /^I want to edit (this customer)$/
164173
*/
165174
public function iWantToEditThisCustomer(CustomerInterface $customer)
166175
{
@@ -280,14 +289,6 @@ public function theCustomerShouldStillHaveAnEmptyLastName(CustomerInterface $cus
280289
Assert::eq($this->updatePage->getLastName(), '');
281290
}
282291

283-
/**
284-
* @When I remove its email
285-
*/
286-
public function iRemoveItsEmail()
287-
{
288-
$this->updatePage->changeEmail('');
289-
}
290-
291292
/**
292293
* @Then I should be notified that email is not valid
293294
*/

‎src/Sylius/Behat/Context/Ui/Shop/LoginContext.php

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public function iShouldBeNotifiedThatElementIsRequired($elementName)
209209

210210
/**
211211
* @Then I should be able to log in as :email with :password password
212+
* @Then the customer should be able to log in as :email with :password password
212213
*/
213214
public function iShouldBeAbleToLogInAsWithPassword($email, $password)
214215
{

‎src/Sylius/Behat/Resources/config/suites/ui/user/managing_customers.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ default:
3030
- sylius.behat.context.ui.admin.dashboard
3131
- sylius.behat.context.ui.admin.managing_customers
3232
- sylius.behat.context.ui.admin.notification
33+
- sylius.behat.context.ui.shop.login
3334
filters:
3435
tags: "@managing_customers && @ui"

0 commit comments

Comments
 (0)