Commit f9c80895e97465d9b8f6976d97d8863ce864907f

Authored by Parley
Committed by Gust
1 parent 7bc653a4

verify_tests: Add command to mpog_step and fix create institution tests.

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
features/institution_registration.feature
... ... @@ -13,11 +13,14 @@ Feature: Institution Field
13 13 And Institutions has initial default values on database
14 14  
15 15 @selenium
16   - Scenario: Show new institution field when follow add new institution
  16 + Scenario: Show new institution fields when clicked in create new institution
17 17 Given I go to /account/signup
18   - When I follow "Add new institution"
  18 + When I follow "Create new institution"
19 19 And I should see "New Institution"
20 20 And I should see "Name"
  21 + And I should see "State"
  22 + And I should see "City"
  23 + And I should see "Country"
21 24 And I should see "CNPJ"
22 25 And I should see "Public Institution"
23 26 And I choose "Public Institution"
... ... @@ -28,9 +31,12 @@ Feature: Institution Field
28 31 @selenium
29 32 Scenario: Show new institution fields when private institution is selected
30 33 Given I go to /account/signup
31   - When I follow "Add new institution"
  34 + When I follow "Create new institution"
32 35 And I should see "New Institution"
33 36 And I should see "Name"
  37 + And I should see "State"
  38 + And I should see "City"
  39 + And I should see "Country"
34 40 And I should see "CNPJ"
35 41 And I should see "Private Institution"
36 42 And I choose "Private Institution"
... ... @@ -39,33 +45,41 @@ Feature: Institution Field
39 45 @selenium
40 46 Scenario: Create new public institution when all required fields are filled.
41 47 Given I go to /account/signup
42   - When I follow "Add new institution"
  48 + When I follow "Create new institution"
43 49 And I fill in "community_name" with "Institution Name"
44 50 And I fill in "institutions_cnpj" with "00.000.000/0001-00"
  51 + And I select "Brazil" from "community_country"
  52 + And I fill in "community_state" with "DF"
  53 + And I fill in "community_city" with "Brasilia"
45 54 And I choose "Public Institution"
46   - And I fill in "institutions_acronym" with "Teste"
47 55 And I select "Executivo" from "institutions_governmental_power"
48 56 And I select "Federal" from "institutions_governmental_sphere"
  57 + And I select "Autarquia" from "institutions_juridical_nature"
49 58 And I follow "Save"
50 59 Then I should see "Institution Name"
51 60  
52 61 @selenium
53 62 Scenario: Create new private institution when all required fields are filled
54 63 Given I go to /account/signup
55   - When I follow "Add new institution"
  64 + When I follow "Create new institution"
56 65 And I fill in "community_name" with "Institution Name"
57 66 And I fill in "institutions_cnpj" with "00.000.000/0001-00"
  67 + And I select "Brazil" from "community_country"
  68 + And I fill in "community_state" with "DF"
  69 + And I fill in "community_city" with "Brasilia"
58 70 And I choose "Private Institution"
59   - And I fill in "institutions_acronym" with "Teste"
60 71 And I follow "Save"
61 72 Then I should see "Institution Name"
62 73  
63 74 @selenium
64 75 Scenario: Don't create an institution when name and cpnj are not filled
65 76 Given I go to /account/signup
66   - When I follow "Add new institution"
  77 + When I follow "Create new institution"
67 78 And I choose "Private Institution"
68 79 And I fill in "institutions_acronym" with "Teste"
  80 + And I select "Brazil" from "community_country"
  81 + And I fill in "community_state" with "DF"
  82 + And I fill in "community_city" with "Brasilia"
69 83 And I follow "Save"
70 84 Then I should see "Institution could not be created!"
71 85 And I should see "Name can't be blank"
... ... @@ -74,20 +88,30 @@ Feature: Institution Field
74 88 @selenium
75 89 Scenario: Don't Create new institution when a governamental field is not filled
76 90 Given I go to /account/signup
77   - When I follow "Add new institution"
  91 + When I follow "Create new institution"
78 92 And I fill in "community_name" with "Institution Name"
79 93 And I fill in "institutions_cnpj" with "00.000.000/0001-00"
  94 + And I select "Brazil" from "community_country"
  95 + And I fill in "community_state" with "DF"
  96 + And I fill in "community_city" with "Brasilia"
80 97 And I choose "Public Institution"
81 98 And I follow "Save"
82   - Then I should see "Governmental fields Could not find Governmental Power or Governmental Sphere"
  99 + Then I should see "Governmental power can't be blank"
  100 + And I should see "Governmental sphere can't be blank"
  101 + And I should see "Juridical nature can't be blank"
83 102  
84 103 @selenium
85   - Scenario: Don't Create new institution when a governamental field is not filled
  104 + Scenario: Don't Create new institution when no field is filled
86 105 Given I go to /account/signup
87   - When I follow "Add new institution"
  106 + When I follow "Create new institution"
88 107 And I choose "Public Institution"
89 108 And I follow "Save"
90 109 Then I should see "Institution could not be created!"
91   - And I should see "Governmental fields Could not find Governmental Power or Governmental Sphere"
92 110 And I should see "Name can't be blank"
  111 + And I should see "Country can't be blank"
  112 + And I should see "State can't be blank"
  113 + And I should see "City can't be blank"
  114 + And I should see "Governmental power can't be blank"
  115 + And I should see "Governmental sphere can't be blank"
  116 + And I should see "Juridical nature can't be blank"
93 117 And I should see "CNPJ can't be blank"
... ...
features/step_definitions/mpog_steps.rb
... ... @@ -24,6 +24,7 @@ Given /^Institutions has initial default values on database$/ do
24 24 GovernmentalPower.create(:name => "Judiciario")
25 25  
26 26 GovernmentalSphere.create(:name => "Federal")
  27 + JuridicalNature.create(:name=> "Autarquia")
27 28 end
28 29  
29 30 Given /^I type in "([^"]*)" into autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_institution, should_select|
... ...