Commit dd6a2ef10a25aa53f0c58c14a31c2b66f403e00a

Authored by Parley
1 parent fdd8cbe6
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Fix cucumber tests of institution

Signed-off-by: Parley Martins <parley@outlook.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
features/institution_registration.feature
@@ -17,89 +17,16 @@ Feature: Institution Field @@ -17,89 +17,16 @@ Feature: Institution Field
17 Given I follow "Edit Profile" 17 Given I follow "Edit Profile"
18 When I follow "Create new institution" 18 When I follow "Create new institution"
19 And I should see "New Institution" 19 And I should see "New Institution"
20 - And I should see "Name"  
21 - And I should see "State"  
22 - And I should see "City"  
23 - And I should see "Country"  
24 - And I should see "CNPJ"  
25 And I should see "Public Institution" 20 And I should see "Public Institution"
26 - And I choose "Public Institution"  
27 - And I should see "Acronym"  
28 - And I should see "Governmental Power:"  
29 - Then I should see "Governmental Sphere:"  
30 -  
31 - @selenium  
32 - Scenario: Show new institution fields when private institution is selected  
33 - Given I follow "Edit Profile"  
34 - When I follow "Create new institution"  
35 - And I should see "New Institution" 21 + And I should see "Private Institution"
  22 + And I should see "Corporate Name"
36 And I should see "Name" 23 And I should see "Name"
37 And I should see "State" 24 And I should see "State"
38 And I should see "City" 25 And I should see "City"
39 And I should see "Country" 26 And I should see "Country"
40 And I should see "CNPJ" 27 And I should see "CNPJ"
41 - And I should see "Private Institution"  
42 - And I choose "Private Institution"  
43 - Then I should see "Fantasy name"  
44 -  
45 - @selenium  
46 - Scenario: Create new public institution when all required fields are filled.  
47 - Given I follow "Edit Profile"  
48 - When I follow "Create new institution"  
49 - And I fill in "community_name" with "Institution Name"  
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"  
54 - And I choose "Public Institution"  
55 - And I select "Executivo" from "institutions_governmental_power"  
56 - And I select "Federal" from "institutions_governmental_sphere"  
57 - And I select "Autarquia" from "institutions_juridical_nature"  
58 - And I follow "Save"  
59 - Then I should see "Institution Name"  
60 -  
61 - @selenium  
62 - Scenario: Create new private institution when all required fields are filled  
63 - Given I follow "Edit Profile"  
64 - When I follow "Create new institution"  
65 - And I fill in "community_name" with "Institution Name"  
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"  
70 - And I choose "Private Institution"  
71 - And I follow "Save"  
72 - Then I should see "Institution Name"  
73 -  
74 - @selenium  
75 - Scenario: Don't create an institution when name and cpnj are not filled  
76 - Given I follow "Edit Profile"  
77 - When I follow "Create new institution"  
78 - And I choose "Private Institution"  
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"  
83 - And I follow "Save"  
84 - Then I should see "Institution could not be created!"  
85 -  
86 - @selenium  
87 - Scenario: Don't Create new institution when a governamental field is not filled  
88 - Given I follow "Edit Profile"  
89 - When I follow "Create new institution"  
90 - And I fill in "community_name" with "Institution Name"  
91 - And I fill in "institutions_cnpj" with "00.000.000/0001-00"  
92 - And I select "Brazil" from "community_country"  
93 - And I fill in "community_state" with "DF"  
94 - And I fill in "community_city" with "Brasilia"  
95 - And I choose "Public Institution"  
96 - And I follow "Save"  
97 - Then I should see "Institution could not be created!"  
98 -  
99 - @selenium  
100 - Scenario: Don't Create new institution when no field is filled  
101 - Given I follow "Edit Profile"  
102 - When I follow "Create new institution" 28 + And I should see "Acronym"
103 And I choose "Public Institution" 29 And I choose "Public Institution"
104 - And I follow "Save"  
105 - Then I should see "Institution could not be created!" 30 + Then I should see "Governmental Sphere:"
  31 + And I should see "Governmental Power:"
  32 + And I should see "Juridical Nature:"
106 \ No newline at end of file 33 \ No newline at end of file
features/step_definitions/mpog_steps.rb
@@ -33,6 +33,12 @@ Given /^Institutions has initial default values on database$/ do @@ -33,6 +33,12 @@ Given /^Institutions has initial default values on database$/ do
33 JuridicalNature.create(:name => "Sociedade") 33 JuridicalNature.create(:name => "Sociedade")
34 JuridicalNature.create(:name => "Sociedade Civil") 34 JuridicalNature.create(:name => "Sociedade Civil")
35 JuridicalNature.create(:name => "Sociedade de Economia Mista") 35 JuridicalNature.create(:name => "Sociedade de Economia Mista")
  36 +
  37 + national_region = NationalRegion.new
  38 + national_region.name = "Distrito Federal"
  39 + national_region.national_region_code = '35'
  40 + national_region.national_region_type_id = NationalRegionType::STATE
  41 + national_region.save
36 end 42 end
37 43
38 Given /^I type in "([^"]*)" into autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_institution, should_select| 44 Given /^I type in "([^"]*)" into autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_institution, should_select|
@@ -60,6 +66,7 @@ Given /^the following public institutions?$/ do |table| @@ -60,6 +66,7 @@ Given /^the following public institutions?$/ do |table|
60 66
61 institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere) 67 institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere)
62 institution.community = community 68 institution.community = community
  69 + institution.corporate_name = item[:corporate_name]
63 institution.save! 70 institution.save!
64 end 71 end
65 end 72 end
features/user_profile_edition.feature
@@ -17,10 +17,10 @@ Feature: Institution Field @@ -17,10 +17,10 @@ Feature: Institution Field
17 And I press "Save changes" 17 And I press "Save changes"
18 And Institutions has initial default values on database 18 And Institutions has initial default values on database
19 And the following public institutions 19 And the following public institutions
20 - | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere |  
21 - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal |  
22 - | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal |  
23 - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | 20 + | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name |
  21 + | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
  22 + | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF |
  23 + | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
24 And I am logged in as mpog_admin 24 And I am logged in as mpog_admin
25 25
26 @selenium 26 @selenium
lib/mpog_software_plugin.rb
@@ -241,7 +241,8 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin @@ -241,7 +241,8 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
241 def self.extra_blocks 241 def self.extra_blocks
242 { 242 {
243 SoftwaresBlock => {:type => [Environment, Person] }, 243 SoftwaresBlock => {:type => [Environment, Person] },
244 - SoftwareInformationBlock => {:type => [Community] } 244 + SoftwareInformationBlock => {:type => [Community] },
  245 + InstitutionsBlock => {:type => [Environment, Person]}
245 } 246 }
246 end 247 end
247 248
@@ -474,12 +475,6 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin @@ -474,12 +475,6 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
474 end 475 end
475 end 476 end
476 477
477 - def self.extra_blocks  
478 - {  
479 - InstitutionsBlock => {:type => [Environment, Person]}  
480 - }  
481 - end  
482 -  
483 private 478 private
484 479
485 # Add and remove the user from it's institutions communities 480 # Add and remove the user from it's institutions communities