Commit 51e6c3e795fb41a9f26be2d1ebcaa349c907b044

Authored by Joenio Costa
1 parent dc715304

Moving bsc cucumber test from Noosfero core to plugin

features/bsc.feature
@@ -1,164 +0,0 @@ @@ -1,164 +0,0 @@
1 -Feature: bsc  
2 -  
3 - Background:  
4 - Given "Bsc" plugin is enabled  
5 -  
6 - Scenario: display link to bsc creation on admin panel when bsc plugin active  
7 - Given I am logged in as admin  
8 - When I am on the environment control panel  
9 - Then I should see "Create Bsc"  
10 - When "Bsc" plugin is disabled  
11 - And I am on the environment control panel  
12 - Then I should not see "Create Bsc"  
13 -  
14 - Scenario: be able to create a bsc  
15 - Given I am logged in as admin  
16 - And I am on the environment control panel  
17 - And I follow "Create Bsc"  
18 - And I fill in the following:  
19 - | Business name | Sample Bsc |  
20 - | Company name | Sample Bsc |  
21 - | profile_data_identifier | sample-identifier |  
22 - | Cnpj | 07.970.746/0001-77 |  
23 - When I press "Save"  
24 - Then there should be a profile named "Sample Bsc"  
25 -  
26 - Scenario: display a button on bsc control panel to manage associated enterprises  
27 - Given the folllowing "bsc" from "bsc_plugin"  
28 - | business_name | identifier | company_name | cnpj |  
29 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |  
30 - And I am logged in as admin  
31 - When I am on Bsc Test's control panel  
32 - Then I should see "Manage associated enterprises"  
33 -  
34 - Scenario: display a button on bsc control panel to transfer ownership  
35 - Given the folllowing "bsc" from "bsc_plugin"  
36 - | business_name | identifier | company_name | cnpj |  
37 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |  
38 - And I am logged in as admin  
39 - When I am on Bsc Test's control panel  
40 - Then I should see "Transfer ownership"  
41 -  
42 - Scenario: create a new enterprise already associated with a bsc  
43 - Given the following user  
44 - | login | name |  
45 - | pedro-silva | Pedro Silva |  
46 - And the folllowing "bsc" from "bsc_plugin"  
47 - | business_name | identifier | company_name | cnpj | owner |  
48 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |  
49 - And organization_approval_method is "none" on environment  
50 - And I am logged in as "pedro-silva"  
51 - And I am on Bsc Test's control panel  
52 - And I follow "Manage associated enterprises"  
53 - And I follow "Add new enterprise"  
54 - And I fill in the following:  
55 - | Name | Associated Enterprise |  
56 - | Address | associated-enterprise |  
57 - When I press "Save"  
58 - Then "Associated Enterprise" should be associated with "Bsc Test"  
59 -  
60 - Scenario: do not display "add new product" button  
61 - Given the following user  
62 - | login | name |  
63 - | pedro-silva | Pedro Silva |  
64 - And the folllowing "bsc" from "bsc_plugin"  
65 - | business_name | identifier | company_name | cnpj | owner |  
66 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |  
67 - And feature "disable_products_for_enterprises" is disabled on environment  
68 - And I am logged in as "pedro-silva"  
69 - And I am on Bsc Test's control panel  
70 - When I follow "Manage Products and Services"  
71 - Then I should not see "New product or service"  
72 -  
73 - Scenario: display bsc's enterprises' products name on the bsc catalog  
74 - Given the following user  
75 - | login | name |  
76 - | pedro-silva | Pedro Silva |  
77 - And the folllowing "bsc" from "bsc_plugin"  
78 - | business_name | identifier | company_name | cnpj | owner |  
79 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |  
80 - And the following enterprise  
81 - | identifier | name |  
82 - | sample-enterprise | Sample Enterprise |  
83 - And the following product_category  
84 - | name |  
85 - | bike |  
86 - And the following products  
87 - | owner | category | name |  
88 - | sample-enterprise | bike | Master Bike |  
89 - And "Sample Enterprise" is associated with "Bsc Test"  
90 - And I am logged in as "pedro-silva"  
91 - When I go to Bsc Test's products page  
92 - Then I should see "Master Bike"  
93 - And I should see "Sample Enterprise"  
94 -  
95 - Scenario: display enterprise name linked only if person is member of any Bsc  
96 - Given the folllowing "bsc" from "bsc_plugin"  
97 - | business_name | identifier | company_name | cnpj |  
98 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |  
99 - | Another Bsc | another-bsc | Another Bsc Test Ltda | 07.970.746/0001-77 |  
100 - And the following enterprise  
101 - | identifier | name |  
102 - | sample-enterprise | Sample Enterprise |  
103 - And the following product_category  
104 - | name |  
105 - | bike |  
106 - And the following products  
107 - | owner | category | name |  
108 - | sample-enterprise | bike | Master Bike |  
109 - And "Sample Enterprise" is associated with "Bsc Test"  
110 - And the folllowing "bsc" from "bsc_plugin"  
111 - | business_name | identifier | company_name | cnpj |  
112 - And the following user  
113 - | login | name |  
114 - | pedro | Pedro Souto |  
115 - | maria | Maria Souto |  
116 - And pedro is member of another-bsc  
117 - And I am logged in as "pedro"  
118 - When I go to Bsc Test's products page  
119 - Then I should see "Sample Enterprise"  
120 - And I should see "Sample Enterprise" within "a.bsc-catalog-enterprise-link"  
121 - But I am logged in as "maria"  
122 - When I go to Bsc Test's products page  
123 - Then I should see "Sample Enterprise"  
124 - #TODO -> test that it's not a link  
125 -  
126 - Scenario: allow only environment administrators to delete bsc profile  
127 - Given the folllowing "bsc" from "bsc_plugin"  
128 - | business_name | identifier | company_name | cnpj |  
129 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |  
130 - And the following user  
131 - | login | name |  
132 - | pedro | Pedro Souto |  
133 - And "Pedro Souto" is admin of "Bsc Test"  
134 - And I am logged in as "pedro"  
135 - And I am on Bsc Test's control panel  
136 - And I follow "Bsc info and settings"  
137 - When I follow "Delete profile"  
138 - Then I should see "Access denied"  
139 - And "Bsc Test" profile should exist  
140 - But I am logged in as admin  
141 - And I am on Bsc Test's control panel  
142 - And I follow "Bsc info and settings"  
143 - When I follow "Delete profile"  
144 - Then I should see "Deleting profile Bsc Test"  
145 - And I follow "Yes, I am sure"  
146 - Then "Bsc Test" profile should not exist  
147 -  
148 - # Like we can believe that selenium is going to work...  
149 - @selenium  
150 - Scenario: list already associated enterprises on manage associated enterprises  
151 - Given the folllowing "bsc" from "bsc_plugin"  
152 - | business_name | identifier | company_name | cnpj |  
153 - | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |  
154 - And the following enterprises  
155 - | identifier | name |  
156 - | enterprise-1 | Enterprise 1 |  
157 - | enterprise-2 | Enterprise 2 |  
158 - And "Enterprise 1" is associated with "Bsc Test"  
159 - And "Enterprise 2" is associated with "Bsc Test"  
160 - And I am logged in as admin  
161 - And I am on Bsc Test's control panel  
162 - When I follow "Manage associated enterprises"  
163 - Then I should see "Enterprise 1"  
164 - And I should see "Enterprise 2"  
plugins/bsc/test/features/bsc.feature 0 → 100644
@@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
  1 +Feature: bsc
  2 +
  3 + Background:
  4 + Given "Bsc" plugin is enabled
  5 +
  6 + Scenario: display link to bsc creation on admin panel when bsc plugin active
  7 + Given I am logged in as admin
  8 + When I am on the environment control panel
  9 + Then I should see "Create Bsc"
  10 + When "Bsc" plugin is disabled
  11 + And I am on the environment control panel
  12 + Then I should not see "Create Bsc"
  13 +
  14 + Scenario: be able to create a bsc
  15 + Given I am logged in as admin
  16 + And I am on the environment control panel
  17 + And I follow "Create Bsc"
  18 + And I fill in the following:
  19 + | Business name | Sample Bsc |
  20 + | Company name | Sample Bsc |
  21 + | profile_data_identifier | sample-identifier |
  22 + | Cnpj | 07.970.746/0001-77 |
  23 + When I press "Save"
  24 + Then there should be a profile named "Sample Bsc"
  25 +
  26 + Scenario: display a button on bsc control panel to manage associated enterprises
  27 + Given the folllowing "bsc" from "bsc_plugin"
  28 + | business_name | identifier | company_name | cnpj |
  29 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |
  30 + And I am logged in as admin
  31 + When I am on Bsc Test's control panel
  32 + Then I should see "Manage associated enterprises"
  33 +
  34 + Scenario: display a button on bsc control panel to transfer ownership
  35 + Given the folllowing "bsc" from "bsc_plugin"
  36 + | business_name | identifier | company_name | cnpj |
  37 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |
  38 + And I am logged in as admin
  39 + When I am on Bsc Test's control panel
  40 + Then I should see "Transfer ownership"
  41 +
  42 + Scenario: create a new enterprise already associated with a bsc
  43 + Given the following user
  44 + | login | name |
  45 + | pedro-silva | Pedro Silva |
  46 + And the folllowing "bsc" from "bsc_plugin"
  47 + | business_name | identifier | company_name | cnpj | owner |
  48 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |
  49 + And organization_approval_method is "none" on environment
  50 + And I am logged in as "pedro-silva"
  51 + And I am on Bsc Test's control panel
  52 + And I follow "Manage associated enterprises"
  53 + And I follow "Add new enterprise"
  54 + And I fill in the following:
  55 + | Name | Associated Enterprise |
  56 + | Address | associated-enterprise |
  57 + When I press "Save"
  58 + Then "Associated Enterprise" should be associated with "Bsc Test"
  59 +
  60 + Scenario: do not display "add new product" button
  61 + Given the following user
  62 + | login | name |
  63 + | pedro-silva | Pedro Silva |
  64 + And the folllowing "bsc" from "bsc_plugin"
  65 + | business_name | identifier | company_name | cnpj | owner |
  66 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |
  67 + And feature "disable_products_for_enterprises" is disabled on environment
  68 + And I am logged in as "pedro-silva"
  69 + And I am on Bsc Test's control panel
  70 + When I follow "Manage Products and Services"
  71 + Then I should not see "New product or service"
  72 +
  73 + Scenario: display bsc's enterprises' products name on the bsc catalog
  74 + Given the following user
  75 + | login | name |
  76 + | pedro-silva | Pedro Silva |
  77 + And the folllowing "bsc" from "bsc_plugin"
  78 + | business_name | identifier | company_name | cnpj | owner |
  79 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 | pedro-silva |
  80 + And the following enterprise
  81 + | identifier | name |
  82 + | sample-enterprise | Sample Enterprise |
  83 + And the following product_category
  84 + | name |
  85 + | bike |
  86 + And the following products
  87 + | owner | category | name |
  88 + | sample-enterprise | bike | Master Bike |
  89 + And "Sample Enterprise" is associated with "Bsc Test"
  90 + And I am logged in as "pedro-silva"
  91 + When I go to Bsc Test's products page
  92 + Then I should see "Master Bike"
  93 + And I should see "Sample Enterprise"
  94 +
  95 + Scenario: display enterprise name linked only if person is member of any Bsc
  96 + Given the folllowing "bsc" from "bsc_plugin"
  97 + | business_name | identifier | company_name | cnpj |
  98 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |
  99 + | Another Bsc | another-bsc | Another Bsc Test Ltda | 07.970.746/0001-77 |
  100 + And the following enterprise
  101 + | identifier | name |
  102 + | sample-enterprise | Sample Enterprise |
  103 + And the following product_category
  104 + | name |
  105 + | bike |
  106 + And the following products
  107 + | owner | category | name |
  108 + | sample-enterprise | bike | Master Bike |
  109 + And "Sample Enterprise" is associated with "Bsc Test"
  110 + And the folllowing "bsc" from "bsc_plugin"
  111 + | business_name | identifier | company_name | cnpj |
  112 + And the following user
  113 + | login | name |
  114 + | pedro | Pedro Souto |
  115 + | maria | Maria Souto |
  116 + And pedro is member of another-bsc
  117 + And I am logged in as "pedro"
  118 + When I go to Bsc Test's products page
  119 + Then I should see "Sample Enterprise"
  120 + And I should see "Sample Enterprise" within "a.bsc-catalog-enterprise-link"
  121 + But I am logged in as "maria"
  122 + When I go to Bsc Test's products page
  123 + Then I should see "Sample Enterprise"
  124 + #TODO -> test that it's not a link
  125 +
  126 + Scenario: allow only environment administrators to delete bsc profile
  127 + Given the folllowing "bsc" from "bsc_plugin"
  128 + | business_name | identifier | company_name | cnpj |
  129 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |
  130 + And the following user
  131 + | login | name |
  132 + | pedro | Pedro Souto |
  133 + And "Pedro Souto" is admin of "Bsc Test"
  134 + And I am logged in as "pedro"
  135 + And I am on Bsc Test's control panel
  136 + And I follow "Bsc info and settings"
  137 + When I follow "Delete profile"
  138 + Then I should see "Access denied"
  139 + And "Bsc Test" profile should exist
  140 + But I am logged in as admin
  141 + And I am on Bsc Test's control panel
  142 + And I follow "Bsc info and settings"
  143 + When I follow "Delete profile"
  144 + Then I should see "Deleting profile Bsc Test"
  145 + And I follow "Yes, I am sure"
  146 + Then "Bsc Test" profile should not exist
  147 +
  148 + # Like we can believe that selenium is going to work...
  149 + @selenium
  150 + Scenario: list already associated enterprises on manage associated enterprises
  151 + Given the folllowing "bsc" from "bsc_plugin"
  152 + | business_name | identifier | company_name | cnpj |
  153 + | Bsc Test | bsc-test | Bsc Test Ltda | 94.132.024/0001-48 |
  154 + And the following enterprises
  155 + | identifier | name |
  156 + | enterprise-1 | Enterprise 1 |
  157 + | enterprise-2 | Enterprise 2 |
  158 + And "Enterprise 1" is associated with "Bsc Test"
  159 + And "Enterprise 2" is associated with "Bsc Test"
  160 + And I am logged in as admin
  161 + And I am on Bsc Test's control panel
  162 + When I follow "Manage associated enterprises"
  163 + Then I should see "Enterprise 1"
  164 + And I should see "Enterprise 2"