cirandas.net

ref: master

features/activate_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
Feature: activate enterprise
  As an enterprise owner
  I want to activate my enterprise
  In order to publish content

  Background:
    Given the following users
      | login | name |
      | joaosilva | Joao Silva |
    And I am logged in as "joaosilva"

  Scenario: added an unexistent code
    Given feature "enterprise_activation" is enabled on environment
    And I am on joaosilva's control panel
    And I fill in "Enterprise activation code" with "abcde"
    When I press "Activate"
    Then I should see "Invalid enterprise code"

  Scenario: added a code from an activated enterprise
    Given feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier | name | enabled |
      | products-factory | Products Factory | false |
    And I am on joaosilva's control panel
    And enterprise "Products Factory" is enabled
    And I fill in "Enterprise activation code" with code of "Products Factory"
    When I press "Activate"
    Then I should see "This enterprise is already active"

  Scenario: added a code from an enterprise with no foundation year or cnpj
    Given feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier | name | enabled |
      | products-factory | Products Factory | false |
    And I am on joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Products Factory"
    When I press "Activate"
    Then I should see "We don't have enough information about your enterprise to identify you."
    And enterprise "Products Factory" should not be blocked

  Scenario: filled activation question with wrong foundation year
    Given feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier | name | enabled | foundation_year |
      | services-provider | Services Provider | false | 2000 |
    And I am on joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Services Provider"
    And I press "Activate"
    And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "1999"
    When I press "Continue"
    Then I should see "There was a failed atempt of activation and the automated activation was disabled for your security."
    And enterprise "Services Provider" should be blocked

  Scenario: filled activation question with wrong cnpj
    Given feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier | name | enabled | cnpj |
      | services-provider | Services Provider | false | 94.132.024/0001-48 |
    And I am on joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Services Provider"
    And I press "Activate"
    And I fill in "What is the CNPJ of your enterprise?" with "12345678912345"
    When I press "Continue"
    Then I should see "There was a failed atempt of activation and the automated activation was disabled for your security."
    And enterprise "Services Provider" should be blocked

  @selenium
  Scenario: activate succesffuly an enterprise with foundation_year
    Given feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier | name | enabled | foundation_year |
      | services-provider | Services Provider | false | 2000 |
    And I go to joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Services Provider"
    And I press "Activate"
    And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
    And I press "Continue"
    And I check "I read the terms of use and accepted them"
    When I press "Continue"
    Then I should see "Services Provider was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
    And enterprise "Services Provider" should be enabled
    And "Joao Silva" is admin of "Services Provider"

  @selenium
  Scenario: replace template after enable an enterprise
    Given enterprise template must be replaced after enable
    And feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier          | name                | enabled | foundation_year | is_template |
      | services-provider-2 | Services Provider 2 | false   | 2000            | false       |
      | active-template     | Active Template     | false   | 2000            | true        |
    And "Active Template" is the active enterprise template
    And "Services Provider 2" doesnt have "Active Template" as template
    And I go to joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Services Provider 2"
    And I press "Activate"
    And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
    And I press "Continue"
    And I check "I read the terms of use and accepted them"
    When I press "Continue"
    Then I should see "Services Provider 2 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
    And enterprise "Services Provider 2" should be enabled
    And "Joao Silva" is admin of "Services Provider 2"
    And "Services Provider 2" has "Active Template" as template

  @selenium
  Scenario: not replace template after enable an enterprise
    Given enterprise template must not be replaced after enable
    And feature "enterprise_activation" is enabled on environment
    And the following enterprises
      | identifier          | name                | enabled | foundation_year | is_template |
      | services-provider-3 | Services Provider 3 | false   | 2000            | false       |
      | active-template     | Active Template     | false   | 2000            | true        |
    And "Active Template" is the active enterprise template
    And "Services Provider 3" doesnt have "Active Template" as template
    When I go to joaosilva's control panel
    And I fill in "Enterprise activation code" with code of "Services Provider 3"
    And I press "Activate"
    And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000"
    And I press "Continue"
    And I check "I read the terms of use and accepted them"
    When I press "Continue"
    Then I should see "Services Provider 3 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise"
    And enterprise "Services Provider 3" should be enabled
    And "Joao Silva" is admin of "Services Provider 3"
    And "Services Provider 3" doesnt have "Active Template" as template