cirandas.net

ref: master

features/register_enterprise.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
Feature: register enterprise
  As a noosfero user
  I want to register an enterprise
  In order to interact in the web with my enterprise

  Background:
    Given the following users
      | login     | name       | email                  |
      | joaosilva | Joao Silva | joaosilva@example.com  |

    And I am logged in as "joaosilva"
    And I am on joaosilva's control panel
    And feature "enterprise_registration" is enabled on environment

  Scenario: enterprise registration is disabled by admin
    Given feature "enterprise_registration" is disabled on environment
    When I follow "Manage my groups"
    Then I should not see "Register a new enterprise"

  Scenario: approval method is admin
    Given organization_approval_method is "admin" on environment
    And I follow "Manage my groups"
    When I follow "Register a new enterprise"
    Then I should not see "Region"

  Scenario: approval method is region
    Given organization_approval_method is "region" on environment
    And the following enterprise
      | name      | identifier | owner     |
      | Validator | validator  | joaosilva |
    And the following validation info
      | validation_methodology | organization_name |
      | "Sample methodology"   | Validator         |
    And the following states
      | name          | validator_name |
      | Sample State  | Validator      |
    And I follow "Manage my groups"
    When I follow "Register a new enterprise"
    Then I should see "Region"

  Scenario: approval method is by region validator but there are no validators
    Given organization_approval_method is "region" on environment
    And I follow "Manage my groups"
    When I follow "Register a new enterprise"
    Then I should see "There are no validators to validate the registration of this new enterprise. Contact your administrator for instructions."

  Scenario: some signup fields
    Given the following enterprise fields are signup fields
      | foundation_year |
      | contact_person  |
      | contact_email   |
    And I follow "Manage my groups"
    When I follow "Register a new enterprise"
    Then I should see "Foundation year"
    Then I should see "Contact person"
    Then I should see "Contact email"

  Scenario: some required fields
    Given organization_approval_method is "admin" on environment
    And I follow "Manage my groups"
    And the following states
      | name          |
      | Sample State  |
    And the following enterprise fields are required fields
      | foundation_year |
      | contact_person  |
      | contact_email   |
    And I follow "Register a new enterprise"
    And I fill in the following:
      | Address        | my-enterprise   |
      | Name              | My Enterprise   |
      | Foundation year   |                 |
      | Contact person    |                 |
      | Contact email     |                 |
    When I press "Next"
    Then I should see "Foundation year can't be blank"
    Then I should see "Contact person can't be blank"
    Then I should see "Contact email can't be blank"

  @selenium
  Scenario: a user register an enterprise successfully through the admin
            validator method and the admin accepts
    Given organization_approval_method is "admin" on environment
    And the mailbox is empty
    And I follow "Manage my groups"
    And the following states
      | name          |
      | Sample State  |
    And I follow "Register a new enterprise"
    And I fill in the following:
      | Address | my-enterprise  |
      | Name    | My Enterprise  |
    And I press "Next"
    Then I should see "Enterprise registration completed"
    And I am logged in as admin
    And I go to admin_user's control panel
    When I follow "Tasks" within ".control-panel"
    Then I should see "Joao Silva wants to create enterprise My Enterprise."
    And the first mail is to admin_user@example.com
    And I choose "Accept"
    And I press "Apply!"
    Then the last mail is to joaosilva@example.com
    And I am logged in as "joaosilva"
    And I am on joaosilva's control panel
    When I follow "Manage my groups"
    Then I should see "My Enterprise"

  @selenium
  Scenario: a user register an enterprise successfully through the admin
            validator method and the admin rejects
    Given organization_approval_method is "admin" on environment
    And the mailbox is empty
    And I follow "Manage my groups"
    And the following states
      | name          |
      | Sample State  |
    And I follow "Register a new enterprise"
    And I fill in the following:
      | Address | my-enterprise |
      | Name    | My Enterprise |
    And I press "Next"
    Then I should see "Enterprise registration completed"
    And I am logged in as admin
    And I go to admin_user's control panel
    When I follow "Tasks" within ".control-panel"
    Then I should see "Joao Silva wants to create enterprise My Enterprise."
    And the first mail is to admin_user@example.com
    And I choose "Reject"
    And I fill in "Rejection explanation" with "This enterprise has some irregularities."
    And I press "Apply!"
    Then the last mail is to joaosilva@example.com
    And I am logged in as "joaosilva"
    And I am on joaosilva's control panel
    When I follow "Manage my groups"
    Then I should not see "My Enterprise"

  @selenium
  Scenario: a user register an enterprise successfully through the region
            validator method and the validator accepts
    Given organization_approval_method is "region" on environment
    And I follow "Manage my groups"
    And the following enterprise
      | name      | identifier | owner     |
      | Validator | validator  | joaosilva |
    And the following validation info
      | validation_methodology | organization_name |
      | "Sample methodology"   | Validator         |
    And the following states
      | name          | validator_name |
      | Sample State  | Validator      |
    And I follow "Register a new enterprise"
    And I fill in the following:
      | Address        | my-enterprise   |
      | Name              | My Enterprise   |
    And I select "Sample State" from "Region"
    And I press "Next"
    Then I should see "Validator"
    Then I should see "Sample methodology"
    When I choose "Validator"
    And I press "Confirm"
    Then I should see "Enterprise registration completed"
    And I am on validator's control panel
    When I follow "Tasks"
    Then I should see "Joao Silva wants to create enterprise My Enterprise."
    And I choose "Accept"
    And I press "Apply!"
    And I am on joaosilva's control panel
    When I follow "Manage my groups"
    Then I should see "My Enterprise"

  @selenium
  Scenario: a user register an enterprise successfully through the region
            validator method and the validator rejects
    Given organization_approval_method is "region" on environment
    And I follow "Manage my groups"
    And the following enterprise
      | name      | identifier | owner     |
      | Validator | validator  | joaosilva |
    And the following validation info
      | validation_methodology | organization_name |
      | "Sample methodology"   | Validator         |
    And the following states
      | name          | validator_name |
      | Sample State  | Validator      |
    And I follow "Register a new enterprise"
    And I fill in the following:
      | Address        | my-enterprise   |
      | Name              | My Enterprise   |
    And I select "Sample State" from "Region"
    And I press "Next"
    Then I should see "Validator"
    Then I should see "Sample methodology"
    When I choose "Validator"
    And I press "Confirm"
    Then I should see "Enterprise registration completed"
    And I am on validator's control panel
    When I follow "Tasks"
    Then I should see "Joao Silva wants to create enterprise My Enterprise."
    And I choose "Reject"
    And I fill in "Rejection explanation" with "This enterprise has some irregularities."
    And I press "Apply"
    And I am on joaosilva's control panel
    When I follow "Manage my groups"
    Then I should not see "My Enterprise"

  Scenario: a user cant see button to register new enterprise if enterprise_registration disabled
    Given feature "enterprise_registration" is disabled on environment
    When I am on /search/enterprises
    Then I should not see "New enterprise" link