forked from pierront/mylibrary-template
50 lines
2.8 KiB
Gherkin
50 lines
2.8 KiB
Gherkin
|
|
# language: en
|
||
|
|
|
||
|
|
Feature: Place an order
|
||
|
|
|
||
|
|
Background:
|
||
|
|
Given the system has the following customers for order:
|
||
|
|
| prenom | nom | numeroTelephone | pointsFidelite |
|
||
|
|
| Marie | Dupont | 0612345678 | 100 |
|
||
|
|
| Jean | Martin | 0687654321 | 50 |
|
||
|
|
And the catalog has the following books for order:
|
||
|
|
| isbn | titre | auteur | editeur | datePublication | prix | stockInitial | categories | description | langue |
|
||
|
|
| 9782016289308 | Le Petit Prince | Antoine de Saint-Exupery | Gallimard | 1943-04-06 | 12.90 | 10 | Roman | Un classique | FR |
|
||
|
|
| 9782070409189 | L Etranger | Albert Camus | Gallimard | 1942-05-19 | 9.50 | 5 | Roman | Philosophique| FR |
|
||
|
|
|
||
|
|
Scenario: Place an order with CB payment
|
||
|
|
When I place an order for customer "0612345678" with:
|
||
|
|
| livreIsbn | quantite | rue | ville | codePostal | pays | modePaiement |
|
||
|
|
| 9782016289308 | 2 | 1 rue de Paris | Paris | 75001 | France | CB |
|
||
|
|
Then a new order is created
|
||
|
|
And the order total is 25.80
|
||
|
|
And the customer "0612345678" now has 125 loyalty points
|
||
|
|
|
||
|
|
Scenario: Place an order with PAYPAL payment
|
||
|
|
When I place an order for customer "0687654321" with:
|
||
|
|
| livreIsbn | quantite | rue | ville | codePostal | pays | modePaiement |
|
||
|
|
| 9782070409189 | 1 | 5 rue de Lyon | Lyon | 69001 | France | PAYPAL |
|
||
|
|
Then a new order is created
|
||
|
|
And the order total is 9.50
|
||
|
|
And the customer "0687654321" now has 59 loyalty points
|
||
|
|
|
||
|
|
Scenario: Attempt to place an order with no items
|
||
|
|
When I try to place an order for customer "0612345678" with no items:
|
||
|
|
| rue | ville | codePostal | pays | modePaiement |
|
||
|
|
| 1 rue de Paris | Paris | 75001 | France | CB |
|
||
|
|
Then the order placement fails
|
||
|
|
And I receive a validation order error containing "Order must have at least one item"
|
||
|
|
|
||
|
|
Scenario: Attempt to place an order with invalid quantity
|
||
|
|
When I try to place an order for customer "0612345678" with invalid quantity:
|
||
|
|
| livreIsbn | quantite | rue | ville | codePostal | pays | modePaiement |
|
||
|
|
| 9782016289308 | 0 | 1 rue de Paris | Paris | 75001 | France | CB |
|
||
|
|
Then the order placement fails
|
||
|
|
And I receive a validation order error containing "Quantity must be positive"
|
||
|
|
|
||
|
|
Scenario: Attempt to place an order for unknown customer
|
||
|
|
When I try to place an order for an unknown customer with:
|
||
|
|
| livreIsbn | quantite | rue | ville | codePostal | pays | modePaiement |
|
||
|
|
| 9782016289308 | 1 | 1 rue de Paris | Paris | 75001 | France | CB |
|
||
|
|
Then the order placement fails with customer not found
|