cirandas.net

ref: master

plugins/shopping_cart/features/purchases.feature


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Feature: purchases
  As an enterprise's client
  I want to view my purchases
  In order to manage the products I bought

  Background:
    Given "ShoppingCart" plugin is enabled
    And "Orders" plugin is enabled
    And "Delivery" plugin is enabled
    And the following users
      | login | name  | email                 |
      | moe   | Moe   | moe@springfield.com   |
      | homer | Homer | homer@springfield.com |
    And the following enterprise
      | identifier  | name        | owner |
      | moes-tavern | Moes Tavern | moe |
    And the shopping basket is enabled on "Moes Tavern"
    And the following product_categories
      | name        |
      | Beer        |
      | Snacks      |
    And the following products
      | owner       | category    | name                        | price |
      | moes-tavern | beer        | Duff                        | 3.00  |
      | moes-tavern | snacks      | French fries                | 7.00  |
    And feature "products_for_enterprises" is enabled on environment
    And I am logged in as "homer"
    And I am on homer's control panel

  @selenium
  Scenario: view orders
    Given the following purchase from "homer" on "moes-tavern" that is "ordered"
      | product      | quantity | price |
      | Duff         | 3        | 3.50  |
      | French fries | 1        | 7.00  |
    When I follow "Purchases made"
    Then I should see "Moes Tavern" within any ".actor-name"
    And I should see "17.50" within any ".total"
    And I should see "Ordered" within any ".situation"

  @selenium
  Scenario: view orders with different status
    Given the following purchase from "homer" on "moes-tavern" that is "accepted"
      | product      | quantity | price |
      | Duff         | 2        | 3.50  |
    And the following purchase from "homer" on "moes-tavern" that is "delivered"
      | product              | quantity | price |
      | French fries         | 1        | 7.00  |
    When I follow "Purchases made"
    Then I should see "Accepted" within any ".situation"
    And I should see "Delivered" within any ".situation"

  @selenium
  Scenario: filter orders by situation
    Given the following purchase from "homer" on "moes-tavern" that is "accepted"
      | product      | quantity | price |
      | Duff         | 2        | 3.50  |
    And the following purchase from "homer" on "moes-tavern" that is "delivered"
      | product              | quantity | price |
      | French fries         | 1        | 7.00  |
    And I follow "Purchases made"
    And I should see "Accepted" within any ".situation"
    And I should see "Delivered" within any ".situation"
    And I select "Delivered" from "status"
    When I press "Filter"
    Then I should not see "Accepted" within any ".situation"
    And I should see "Delivered" within any ".situation"


  @selenium
  Scenario: filter orders by code
    Given the following purchase from "homer" on "moes-tavern" that is "ordered"
      | product      | quantity | price |
      | Duff         | 2        | 3.50  |
    And the following purchase from "homer" on "moes-tavern" that is "ordered"
      | product              | quantity | price |
      | French fries         | 1        | 7.00  |
    And I follow "Purchases made"
    And I should see "1" within any ".code"
    And I should see "2" within any ".code"
    And I fill in "code" with "2"
    When I press "Filter"
    Then I should not see "1" within any ".code"
    Then I should see "2" within any ".code"


  @selenium
  Scenario: filter orders by supplier
    Given the following users
      | login     | name               | email                 |
      | lovejoy   | Reverend Lovejoy   | lovejoy@springfield.com   |
    And the following enterprise
      | identifier                  | name                        | owner     |
      | first-church-of-springfield | First Church of Springfield | lovejoy   |
    And the shopping basket is enabled on "First Church of Springfield"
    And the following product_categories
      | name        |
      | Holy        |
    And the following products
      | owner                       | category    | name | price |
      | first-church-of-springfield | holy        | Wine | 5.00  |
    And the following purchase from "homer" on "moes-tavern" that is "ordered"
      | product              | quantity | price |
      | French fries         | 1        | 7.00  |
    And the following purchase from "homer" on "first-church-of-springfield" that is "ordered"
      | product      | quantity | price  |
      | Wine         | 5        | 10.50  |
    And I follow "Purchases made"
    And I should see "Moes Tavern" within any ".actor-name"
    And I should see "First Church of Springfield" within any ".actor-name"
    And I select "Moes Tavern" from "supplier_id"
    When I press "Filter"
    Then I should see "Moes Tavern" within any ".actor-name"
    And I should not see "First Church of Springfield" within any ".actor-name"

  @selenium
  Scenario: products checkout
    Given "moes-tavern" has the following delivery methods
      | delivery_type    | name | description                  | fixed_cost   | free_over_price |
      | deliver | Bike | My good old bike.                     | 8.00         | 10.00           |
      | pickup  | Bar  | Come to my bar and drink it!          | 0.00         | 0.00            |
    And I am on moes-tavern's products page
    And I follow "Add to basket"
    And I wait 0.2 seconds to finish the request
    And I follow "Add to basket"
    And I wait 0.2 seconds to finish the request
    And I follow "Add to basket"
    And I follow "Show basket"
    And I wait 1 second for animations
    And I follow "Shopping checkout"
    And I fill in "Contact phone" with "123456789"
    And I select "Bike ($8.00)" from "Option"
    And I press "Send buy request"
    And I go to homer's control panel
    When I follow "Purchases made"
    Then I should see "Moes Tavern" within any ".actor-name"

  # FIXME: repeat only appear on the new catalog
  @selenium-fixme
  Scenario: repeat order
    Given "moes-tavern" has the following delivery methods
      | delivery_type    | name | description                  | fixed_cost   | free_over_price |
      | deliver | Bike | My good old bike.                     | 8.00         | 10.00           |
      | pickup  | Bar  | Come to my bar and drink it!          | 0.00         | 0.00            |
    And the following purchase from "homer" on "moes-tavern" that is "ordered"
      | product      | quantity | price |
      | Duff         | 3        | 3.50  |
      | French fries | 1        | 7.00  |
    And I am on moes-tavern's products page
    And I follow "Add to basket"
    And I follow "Add to basket"
    And I follow "Show basket"
    And I follow "Hide basket"
    When I follow "checkout"
    Then I should see "Shopping checkout"
    And I should see "Duff"
    And I should see "French fries"