Skip to content

Commit

Permalink
feature #15457 [API] Add Customer resources (Wojdylak)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | N/A
| License         | MIT


Commits
-------

2df7d79 [ApiBundle] Add customer resource to APIP2, admin scope
b962bfb [ApiBundle] Add behat tests for customer resources
df266cc ApiBundle] Add customer modification feature to APIP2
1549c9d [ApiBundle] Add behat tests for customer resources
3801a7c [ApiBundle] Remove unused field
f2cae6f [ApiBundle][Swagger] Hide shop user get endpoint
b287891 [ApiBundle] Add filtering customers by groups
fa0ad8d [ApiBundle] Add contract tests for Customer Api resources
a84513b [ApiBundle] Add validation group to put action on customer
d53ed14 [ApiBundle] Add notified password step to ManagingCustomersContext
0ccbcf8 [ApiBundle] ManagingCustomersContext - refactor methods for simplicity
0cd1fa7 [ApiBundle] Unify behat tests for customer management
90f7a1b [ApiBundle] Remove endpoint subresource order for customer and use endpoint order with customer filter
2d50bd6 [ApiBundle] Fix seeing customer's basic information test
ba5c4e8 [ApiBundle] Fix seeing customer's basic information test
dddf3c5 [ApiBundle] Remove order property from customer
  • Loading branch information
GSadee committed Nov 2, 2023
2 parents 9518e82 + dddf3c5 commit 0e6ac90
Show file tree
Hide file tree
Showing 48 changed files with 1,741 additions and 63 deletions.
4 changes: 2 additions & 2 deletions features/user/managing_customers/adding_customer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Feature: Adding a new customer
Given the store has a customer group "Retail"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Adding a new customer
When I want to create a new customer
And I specify their email as "l.skywalker@gmail.com"
And I add them
Then I should be notified that it has been successfully created
And the customer "l.skywalker@gmail.com" should appear in the store

@ui
@api @ui
Scenario: Adding a new customer with full details
When I want to create a new customer
And I specify their first name as "Luke"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Adding a new customer account
Background:
Given I am logged in as an administrator

@ui @javascript
@api @ui @javascript
Scenario: Adding a new customer with an account
When I want to create a new customer account
And I specify their email as "l.skywalker@gmail.com"
Expand All @@ -18,7 +18,7 @@ Feature: Adding a new customer account
And the customer "l.skywalker@gmail.com" should appear in the store
And the customer "l.skywalker@gmail.com" should have an account created

@ui @javascript
@api @ui @javascript
Scenario: Creating an account for existing customer
Given the store has customer "Frodo Baggins" with email "f.baggins@example.com"
When I want to edit this customer
Expand All @@ -28,4 +28,4 @@ Feature: Adding a new customer account
Then I should be notified that it has been successfully edited
And I should not see create account option
And the customer "f.baggins@example.com" should appear in the store
And this customer should have an account created
And the customer "f.baggins@example.com" should have an account created
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Adding a new customer account after failed creation action
Background:
Given I am logged in as an administrator

@ui @javascript
@api @ui @javascript
Scenario: Trying to add new customer with an account without required information
When I want to create a new customer account
And I choose create account option
Expand All @@ -19,7 +19,7 @@ Feature: Adding a new customer account after failed creation action
And I should be notified that email is required
And I should be notified that password is required

@ui @javascript
@api @ui @javascript
Scenario: Trying to add new customer with an account without email
When I want to create a new customer account
And I choose create account option
Expand All @@ -31,7 +31,7 @@ Feature: Adding a new customer account after failed creation action
And I should not be able to select create account option
And I should be notified that email is required

@ui @javascript
@api @ui @javascript
Scenario: Trying to add new customer without an account without email
When I want to create a new customer account
And I do not choose create account option
Expand All @@ -42,7 +42,7 @@ Feature: Adding a new customer account after failed creation action
And I should be able to select create account option
And I should be notified that email is required

@ui @javascript
@api @ui @javascript
Scenario: Trying to add new customer with an account without required information
When I want to create a new customer account
And I choose create account option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Create account option availability
Background:
And I am logged in as an administrator

@ui
@api @ui
Scenario: Being able to create an account for created customer
When I want to create a new customer
And I do not choose create account option
Expand All @@ -17,7 +17,7 @@ Feature: Create account option availability
And I should not be able to specify their password
And I should be able to select create account option

@ui @javascript
@ui @javascript @no-api
Scenario: Not seeing create account option after adding customer with account
When I want to create a new customer account
And I choose create account option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Browsing customers
And the store has customer "l.skywalker@example.com"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Browsing customers in store
When I want to see all customers in store
Then I should see 3 customers in the list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Feature: Browsing orders of a customer
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Browsing orders of a specific customer in the list
When I browse orders of a customer "logan@wolverine.com"
Then I should see a single order in the list
And I should see the order with number "#00000007" in the list
And I should not see the order with number "#00000008" in the list

@ui
Scenario: Browsing orders of a specific customer in the list
@api @ui
Scenario: Sorting orders of customer by channel
When I browse orders of a customer "logan@wolverine.com"
And I sort them by channel
And I sort the orders ascending by channel
Then I should see a single order in the list
And I should see the order with number "#00000007" in the list
And I should not see the order with number "#00000008" in the list
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Changing an email of an existing customer
And there is a customer "Frodo Baggins" with an email "f.baggins@example.com" and a password "ring"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Changing an email of an existing customer
When I want to edit this customer
And I change their email to "strawberry@example.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Feature: Filtering customers by groups
And this customer belongs to group "Wholesale"
And I am logged in as an administrator

@ui @javascript
@api @ui @javascript
Scenario: Filtering customers by a group
When I want to see all customers in store
And I filter by group "Retail"
Then I should see a single customer on the list
And I should see the customer "g.bespoke@example.com" in the list

@ui @javascript
@api @ui @javascript
Scenario: Filtering customers by multiple groups
When I want to see all customers in store
And I filter by groups "Retail" and "Wholesale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Customer uniqueness of email validation
Background:
Given I am logged in as an administrator

@ui
@api @ui
Scenario: Trying to add a new customer with taken email
Given the store has customer "f.baggins@example.com"
When I want to create a new customer
Expand Down
12 changes: 6 additions & 6 deletions features/user/managing_customers/customer_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Feature: Customer validation
Background:
Given I am logged in as an administrator

@ui
@api @ui
Scenario: Trying to add a new customer without an email
When I want to create a new customer
And I specify their first name as "Luke"
And I specify their last name as "Skywalker"
And I try to add them
Then I should be notified that email is required

@ui
@api @ui
Scenario: Trying to specify too short first name for an existing customer
Given the store has customer "l.skywalker@gmail.com"
When I want to edit this customer
Expand All @@ -24,7 +24,7 @@ Feature: Customer validation
Then I should be notified that first name should be at least 2 characters long
And the customer "l.skywalker@gmail.com" should still have an empty first name

@ui
@api @ui
Scenario: Trying to specify too short last name for an existing customer
Given the store has customer "l.skywalker@gmail.com" with first name "Luke"
When I want to edit this customer
Expand All @@ -33,7 +33,7 @@ Feature: Customer validation
Then I should be notified that last name should be at least 2 characters long
And the customer "l.skywalker@gmail.com" should still have an empty last name

@ui
@api @ui
Scenario: Trying to remove email from an existing customer
Given the store has customer "l.skywalker@gmail.com"
When I want to edit this customer
Expand All @@ -42,15 +42,15 @@ Feature: Customer validation
Then I should be notified that email is required
And the customer "l.skywalker@gmail.com" should still have this email

@ui
@api @ui
Scenario: Trying to create customer with wrong email format
When I want to create a new customer
And I specify their email as "wrongemail"
And I try to add them
Then I should be notified that email is not valid
And the customer with email "wrongemail" should not appear in the store

@ui
@api @ui
Scenario: Trying to create customer with wrong email format in strict mode
When I want to create a new customer
And I specify their email as "wrongemail@example..com"
Expand Down
8 changes: 4 additions & 4 deletions features/user/managing_customers/editing_customer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Editing a customer
Background:
Given I am logged in as an administrator

@ui
@api @ui
Scenario: Changing first and last name of an existing customer
Given the store has customer "Frodo Baggins" with email "f.baggins@example.com"
When I want to edit this customer
Expand All @@ -17,7 +17,7 @@ Feature: Editing a customer
Then I should be notified that it has been successfully edited
And this customer with name "Jon Snow" should appear in the store

@ui
@api @ui
Scenario: Removing first and last name from an existing customer
Given the store has customer "Luke Skywalker" with email "l.skywalker@gmail.com"
When I want to edit this customer
Expand All @@ -28,7 +28,7 @@ Feature: Editing a customer
And this customer should have an empty first name
And this customer should have an empty last name

@ui
@api @ui
Scenario: Making an existing customer subscribed to the newsletter
Given the store has customer "Mike Ross" with email "ross@teammike.com"
When I want to edit this customer
Expand All @@ -37,7 +37,7 @@ Feature: Editing a customer
Then I should be notified that it has been successfully edited
And this customer should be subscribed to the newsletter

@ui
@api @ui
Scenario: Selecting a group for an existing customer
Given the store has a customer group "Retail"
And the store has customer "Mike Ross" with email "ross@teammike.com"
Expand Down
24 changes: 12 additions & 12 deletions features/user/managing_customers/seeing_customer_details.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,44 @@ Feature: Seeing customer's details
And the store has a customer group Retail
And the store has customer "f.baggins@shire.me" with name "Frodo Baggins" and phone number "666777888" since "2011-01-10 21:00"

@ui
@api @ui
Scenario: Seeing customer's basic information
When I view details of the customer "f.baggins@shire.me"
Then his name should be "Frodo Baggins"
And he should be registered since "2011-01-10 21:00"
And his email should be "f.baggins@shire.me"
And his phone number should be "666777888"
Then their name should be "Frodo Baggins"
And he should be registered since "2011-01-10 21:00:00"
And their email should be "f.baggins@shire.me"
And their phone number should be "666777888"

@ui
@api @ui
Scenario: Seeing customer's default address
Given the store operates in "New Zealand"
And their default address is "Hobbiton", "Bag End", "1", "New Zealand" for "Frodo Baggins"
When I view details of the customer "f.baggins@shire.me"
Then his default address should be "Frodo Baggins, Bag End, Hobbiton, NEW ZEALAND 1"
Then their default address should be "Frodo" "Baggins", "Bag End", "1" "Hobbiton", "New Zealand"

@ui
@api @ui
Scenario: Seeing information about no existing account for a given customer
When I view details of the customer "f.baggins@shire.me"
Then I should see information about no existing account for this customer

@ui
@api @ui
Scenario: Seeing information about subscription to the newsletter
Given the customer subscribed to the newsletter
When I view details of the customer "f.baggins@shire.me"
Then I should see that this customer is subscribed to the newsletter

@ui
@api @ui
Scenario: Seeing information about customer groups
Given the customer belongs to group "Retail"
When I view details of the customer "f.baggins@shire.me"
Then this customer should have "Retail" as their group

@ui
@api @ui
Scenario: Not Seeing information about email verification for not registered customer
When I view details of the customer "f.baggins@shire.me"
Then I should not see information about email verification

@ui
@api @ui
Scenario: Seeing information about verified email for registered customer
Given there is a customer "Legolas Sindar" identified by an email "legolas@woodland.rm" and a password "takingTheHobbitsToIsengard"
And this customer verified their email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Seeing a province on customer's details
As an Administrator
I want to be able to see specific customer's page with provinces in the addresses

@ui
@api @ui
Scenario: Seeing customer's addresses
Given the store operates in "United Kingdom"
And the store has customer "f.baggins@shire.me" with name "Frodo Baggins" since "2011-01-10 21:00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Toggling a customer account
Background:
Given I am logged in as an administrator

@ui
@api @ui
Scenario: Enabling a customer account
Given there is disabled customer account "f.baggins@example.com" with password "psw"
When I want to enable "f.baggins@example.com"
Expand All @@ -16,7 +16,7 @@ Feature: Toggling a customer account
Then I should be notified that it has been successfully edited
And this customer should be enabled

@ui
@api @ui
Scenario: Disabling a customer account
Given there is enabled customer account "f.baggins@example.com" with password "psw"
When I want to disable "f.baggins@example.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Toggling a customer account
Background:
Given I am logged in as an administrator

@ui
@api @ui
Scenario: Verifying customer account
Given there is enabled customer account "f.baggins@example.com" with password "psw"
When I want to verify "f.baggins@example.com"
Expand Down

0 comments on commit 0e6ac90

Please sign in to comment.