diff --git a/src/noosfero-spb/gov_user/features/institution_registration.feature b/src/noosfero-spb/gov_user/features/institution_registration.feature index c1fbb4e..e3297a9 100644 --- a/src/noosfero-spb/gov_user/features/institution_registration.feature +++ b/src/noosfero-spb/gov_user/features/institution_registration.feature @@ -5,9 +5,12 @@ Feature: Institution Field Background: Given "GovUserPlugin" plugin is enabled + And "SoftwareCommunitiesPlugin" plugin is enabled And I am logged in as mpog_admin + And I go to /admin/environment_themes/set/noosfero-spb-theme And I go to /admin/plugins And I check "GovUserPlugin" + And I check "SoftwareCommunitiesPlugin" And I press "Save changes" And Institutions has initial default values on database And I am logged in as mpog_admin @@ -27,6 +30,6 @@ Feature: Institution Field And I should see "CNPJ" And I should see "Acronym" And I choose "Public Institution" - Then I should see "Governmental Sphere:" - And I should see "Governmental Power:" - And I should see "Juridical Nature:" + Then I should see "Governmental Sphere" + And I should see "Governmental Power" + And I should see "Juridical Nature" diff --git a/src/noosfero-spb/gov_user/features/rate_community.feature b/src/noosfero-spb/gov_user/features/rate_community.feature index d5d3d87..79b2894 100644 --- a/src/noosfero-spb/gov_user/features/rate_community.feature +++ b/src/noosfero-spb/gov_user/features/rate_community.feature @@ -38,7 +38,7 @@ Feature: rate_community And I go to mycommunity's control panel And I follow "Process requests" within ".pending-tasks" And I choose "Accept" within ".task_decisions" - Then I should see "This instiution already has an accepted rating" in the page + Then I should see "This institution already has an accepted rating." in the page Scenario: do not display message on task when a rating with the same institution does not exist on the same software Given the following organization ratings diff --git a/src/noosfero-spb/gov_user/features/rating_institution_registration.feature b/src/noosfero-spb/gov_user/features/rating_institution_registration.feature index 1979966..7467f43 100644 --- a/src/noosfero-spb/gov_user/features/rating_institution_registration.feature +++ b/src/noosfero-spb/gov_user/features/rating_institution_registration.feature @@ -8,6 +8,7 @@ Feature: Create institution on user report And "SoftwareCommunitiesPlugin" plugin is enabled And "OrganizationRatings" plugin is enabled And I am logged in as mpog_admin + And I go to /admin/environment_themes/set/noosfero-spb-theme And I go to /admin/plugins And I check "GovUserPlugin" And I check "SoftwareCommunitiesPlugin" @@ -23,20 +24,20 @@ Feature: Create institution on user report And I should not see "Number of Beneficiaries" And I should not see "Saved resources" And I should not see "Organization name or Enterprise name" - When I click on anything with selector "#comments-additional-information" - Then I should see "Number of Beneficiaries" - And I should see "Organization name or Enterprise name" - And I should see "Saved resources" + When I click on anything with selector "comments-additional-information" + Then I should see "Número de beneficiados" + And I should see "Nome do órgão ou empresa" + And I should see "Recursos economizados" @selenium Scenario: Show new institution fields when clicked in add new institution Given I go to /profile/noosfero/plugin/organization_ratings/new_rating - And I click on anything with selector "#comments-additional-information" + And I sleep for 1 seconds + And I click on anything with selector "comments-additional-information" And I fill in "input_institution" with "None institution" And I sleep for 2 seconds When I follow "Add" - Then I should see "New Institution" - And I should see "Public Institution" + Then I should see "Public Institution" And I should see "Private Institution" And I should see "Corporate Name" And I should see "Name" @@ -46,33 +47,30 @@ Feature: Create institution on user report And I should see "CNPJ" And I should see "Acronym" And I choose "Public Institution" - And I should see "Governmental Sphere:" - And I should see "Governmental Power:" - And I should see "Juridical Nature:" + And I should see "Governmental Sphere" + And I should see "Governmental Power" + And I should see "Juridical Nature" @selenium Scenario: Create new institution with name changed in the modal Given I go to /profile/noosfero/plugin/organization_ratings/new_rating - And I click on anything with selector "#comments-additional-information" + And I sleep for 1 seconds + And I click on anything with selector "comments-additional-information" And I fill in "input_institution" with "None institution" And I sleep for 2 seconds - When I click on anything with selector "#create_institution_link" + When I click on anything with selector "create_institution_link" And I fill in "community_name" with "Noosfero Institution" - And I select "United States" from "#community_country" - And I follow "#save_institution_button" + And I select "United States" from "Country" + And I sleep for 1 seconds + And I follow "Save" Then I should see "Noosfero Institution" @selenium Scenario: Check new institution name in the modal Given I go to /profile/noosfero/plugin/organization_ratings/new_rating - And I click on anything with selector "#comments-additional-information" + And I sleep for 1 seconds + And I click on anything with selector "comments-additional-information" And I fill in "input_institution" with "None institution" And I sleep for 2 seconds - When I click on anything with selector "#create_institution_link" - Then I should see "None Institution" within "community_name" - - - - - - + When I click on anything with selector "create_institution_link" + Then I should see "None institution" in "Corporate Name" field diff --git a/src/noosfero-spb/gov_user/features/user_profile_edition.feature b/src/noosfero-spb/gov_user/features/user_profile_edition.feature index be7ecfa..24a8b17 100644 --- a/src/noosfero-spb/gov_user/features/user_profile_edition.feature +++ b/src/noosfero-spb/gov_user/features/user_profile_edition.feature @@ -5,12 +5,15 @@ Feature: Institution Field Background: Given "GovUserPlugin" plugin is enabled + And "SoftwareCommunitiesPlugin" plugin is enabled And the following users | login | name | | joao | Joao Silva | And I am logged in as admin + And I go to /admin/environment_themes/set/noosfero-spb-theme And I go to /admin/plugins And I check "GovUserPlugin" + And I check "SoftwareCommunitiesPlugin" And I press "Save changes" And feature "skip_new_user_email_confirmation" is enabled on environment And I go to /admin/features/manage_fields @@ -44,13 +47,12 @@ Feature: Institution Field Given I am logged in as "joao" And I am on joao's control panel When I follow "Edit Profile" - And I follow "Add new institution" And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento" And I follow "Add new institution" And I type in "Gover" in autocomplete list "#input_institution" and I choose "Governo do DF" And I follow "Add new institution" - Then I should see "Ministerio do Planejamento" within ".institutions_added" - And I should see "Governo do DF" within ".institutions_added" + Then I should see "Ministerio do Planejamento" + And I should see "Governo do DF" @selenium Scenario: Verify if field 'city' is shown when Brazil is selected diff --git a/src/noosfero-spb/gov_user/lib/private_institution.rb b/src/noosfero-spb/gov_user/lib/private_institution.rb index 24028d8..9f6792d 100644 --- a/src/noosfero-spb/gov_user/lib/private_institution.rb +++ b/src/noosfero-spb/gov_user/lib/private_institution.rb @@ -1,11 +1,10 @@ class PrivateInstitution < Institution validates :cnpj, - :presence=>true, :format => {with: CNPJ_FORMAT}, :if => :is_a_brazilian_institution? validates :cnpj, - :uniqueness=>true, :unless => 'cnpj.blank?' + :uniqueness => true, :unless => 'cnpj.blank?' private def is_a_brazilian_institution? diff --git a/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb b/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb index 0829b08..56ee856 100644 --- a/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb +++ b/src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb @@ -105,9 +105,9 @@ class GovUserPluginControllerTest < ActionController::TestCase fields = InstitutionTestHelper.generate_form_fields( "Some Private Institution", - "BR", - "DF", - "Brasilia", + "EN", + "NY", + "New York", "", "PrivateInstitution" ) diff --git a/src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb b/src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb index bcab723..e0af039 100644 --- a/src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb +++ b/src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb @@ -27,7 +27,6 @@ class InstitutionsBlockTest < ActiveSupport::TestCase "jose_augusto@email.com", "aaaaaaa", "aaaaaaa", - 'jose@secondary.com', "DF", "Gama" ) diff --git a/src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb b/src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb index 748355f..50c8731 100644 --- a/src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb +++ b/src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb @@ -16,15 +16,14 @@ class OrganizationRatingTest < ActiveSupport::TestCase private_institution = build_private_institution "huehue", "hue", "11.222.333/4444-55" community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => private_institution) - assert_equal false, community_rating.valid? - assert_equal true, community_rating.errors[:institution].include?("not found") + assert_equal false, community_rating.valid? private_institution.save community_rating.institution = private_institution assert_equal true, community_rating.valid? - assert_equal false, community_rating.errors[:institution].include?("not found") + assert_equal false, community_rating.errors[:institution].include?("institution not found") end private diff --git a/src/noosfero-spb/gov_user/test/unit/person_test.rb b/src/noosfero-spb/gov_user/test/unit/person_test.rb index 76a0dee..fb29526 100644 --- a/src/noosfero-spb/gov_user/test/unit/person_test.rb +++ b/src/noosfero-spb/gov_user/test/unit/person_test.rb @@ -12,7 +12,6 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase "user@email.com", "123456", "123456", - "user@secondaryemail.com", "Any State", "Some City" ) @@ -22,7 +21,7 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase @person.cell_phone = "76888919" @person.contact_phone = "987654321" - assert_equal(67, @plugin.calc_percentage_registration(@person)) + assert_equal(64, @plugin.calc_percentage_registration(@person)) @person.comercial_phone = "11223344" @person.country = "I dont know" diff --git a/src/noosfero-spb/gov_user/views/person_editor_extras.html.erb b/src/noosfero-spb/gov_user/views/person_editor_extras.html.erb index 7c404e7..b3dd18e 100644 --- a/src/noosfero-spb/gov_user/views/person_editor_extras.html.erb +++ b/src/noosfero-spb/gov_user/views/person_editor_extras.html.erb @@ -12,6 +12,7 @@ <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> <%= InstitutionModalHelper.modal_button %> + <%= link_to(_("Add new institution"), "#", :class=>'button with-text icon-add', :id => 'add_new_institution') %> <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %> <%= hidden_field_tag("institution_selected", "") %> diff --git a/src/noosfero-spb/software_communities/features/public_software_validation.feature b/src/noosfero-spb/software_communities/features/public_software_validation.feature index 6f26b1d..e424e5b 100644 --- a/src/noosfero-spb/software_communities/features/public_software_validation.feature +++ b/src/noosfero-spb/software_communities/features/public_software_validation.feature @@ -22,13 +22,13 @@ Feature: edit adherent fields Given I am logged in as "joaosilva" And I go to /myprofile/basic-software/plugin/software_communities/edit_software And I follow "Specifications" - Then I should see "Public software" within ".public_software_disabled" + Then the "#software_public_software" button should be disabled Scenario: Enable public software checkbox to admin users Given I am logged in as mpog_admin And I go to /myprofile/basic-software/plugin/software_communities/edit_software And I follow "Specifications" - Then I should see "Public software" within ".public_software_enabled" + Then the "#software_public_software" button should be enabled @selenium Scenario: Show adherent fields when checkbox are checked diff --git a/src/noosfero-spb/software_communities/features/software_block.feature b/src/noosfero-spb/software_communities/features/software_block.feature index ac511ca..da10d97 100644 --- a/src/noosfero-spb/software_communities/features/software_block.feature +++ b/src/noosfero-spb/software_communities/features/software_block.feature @@ -15,8 +15,7 @@ Feature: edit adherent fields | Generic Software | false | some finality | Scenario: Add software block - Given I am logged in as mpog_admin - And I follow "Control panel" + Given I follow "Control panel" And I follow "Edit sideboxes" When I follow "Add a block" And I choose "Softwares" @@ -24,9 +23,7 @@ Feature: edit adherent fields Then I should see "softwares" Scenario: Change software block to generic software block - Given I am logged in as mpog_admin - And I go to /myprofile/mpog_admin - And I follow "Control panel" + Given I follow "Control panel" And I follow "Edit sideboxes" When I follow "Add a block" And I choose "Softwares" @@ -37,8 +34,7 @@ Feature: edit adherent fields Then I should see "generic software" Scenario: Change software block to generic software block - Given I am logged in as mpog_admin - And I follow "Control panel" + Given I follow "Control panel" And I follow "Edit sideboxes" When I follow "Add a block" And I choose "Softwares" diff --git a/src/noosfero-spb/software_communities/features/software_catalog.feature b/src/noosfero-spb/software_communities/features/software_catalog.feature index 8bb6207..2764b79 100644 --- a/src/noosfero-spb/software_communities/features/software_catalog.feature +++ b/src/noosfero-spb/software_communities/features/software_catalog.feature @@ -59,7 +59,7 @@ Feature: Search software @selenium Scenario: Show only "Software Two" when searching for "Education" category Given I go to /search/software_infos - And I click on anything with selector "#filter-option-catalog-software" + And I click on anything with selector "filter-option-catalog-software" And I check "Education" Then I should see "Software Two" And I should not see "Software One" @@ -67,7 +67,7 @@ Feature: Search software @selenium Scenario: Show both Software "One" and "Two" when searching for "Health" category Given I go to /search/software_infos - And I click on anything with selector "#filter-option-catalog-software" + And I click on anything with selector "filter-option-catalog-software" And I check "Health" Then I should see "Software One" And I should see "Software Two" @@ -75,8 +75,7 @@ Feature: Search software @selenium Scenario: Show not "public_software" when "Include in results" is checked Given I go to /search/software_infos - And I click on anything with selector "#filter-option-catalog-software" - And I check "include_non_public" + And I choose "all_radio_button" Then I should see "Software One" And I should see "Software Two" And I should see "Software Three" @@ -107,6 +106,5 @@ Feature: Search software When I select "Favorites" from "sort" And I sleep for 3 seconds Then I should see "Software Two" before "Software One" - And there should be 1 div with class "small-star-positive" - And there should be 4 divs with class "small-star-negative" - + And I should see "1" of this selector "div.medium-star-positive" + And I should see "4" of this selector "div.medium-star-negative" diff --git a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb index 4fbd4c2..8fe2397 100644 --- a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb +++ b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb @@ -18,29 +18,6 @@ Given /^SoftwareInfo has initial default values on database$/ do OperatingSystemName.create(:name=>"CentOS") end -Given /^Institutions has initial default values on database$/ do - GovernmentalPower.create(:name => "Executivo") - GovernmentalPower.create(:name => "Legislativo") - GovernmentalPower.create(:name => "Judiciario") - - GovernmentalSphere.create(:name => "Federal") - - JuridicalNature.create(:name => "Autarquia") - JuridicalNature.create(:name => "Administracao Direta") - JuridicalNature.create(:name => "Empresa Publica") - JuridicalNature.create(:name => "Fundacao") - JuridicalNature.create(:name => "Orgao Autonomo") - JuridicalNature.create(:name => "Sociedade") - JuridicalNature.create(:name => "Sociedade Civil") - JuridicalNature.create(:name => "Sociedade de Economia Mista") - - national_region = NationalRegion.new - national_region.name = "Distrito Federal" - national_region.national_region_code = '35' - national_region.national_region_type_id = NationalRegionType::STATE - national_region.save -end - Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| # Wait the page javascript load sleep 1 @@ -291,6 +268,10 @@ Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| should have_selector("div.#{klass}", :count => count) end +Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| + should have_field(field, :with => content) +end + Given /^I should see "([^"]*)" in the page/ do |message| assert_match message, page.body end diff --git a/src/noosfero-spb/software_communities/features/use_report.feature b/src/noosfero-spb/software_communities/features/use_report.feature index 853cfd8..bc67450 100644 --- a/src/noosfero-spb/software_communities/features/use_report.feature +++ b/src/noosfero-spb/software_communities/features/use_report.feature @@ -34,10 +34,10 @@ Feature: Use report Scenario: Test Additional Fields JavaScript Given I go to /profile/noosfero/plugin/organization_ratings/new_rating Then I should not see "Number of Beneficiaries" - And I should not see "Saved Resources" + And I should not see "Saved resources" When I click on anything with selector "comments-additional-information" Then I should see "Number of Beneficiaries" - And I should see "Saved Resources" + And I should see "Saved resources" @selenium Scenario: Validate Use Report fields format @@ -49,8 +49,8 @@ Feature: Use report And I am on Noosfero's homepage And I follow "Rate Community" When I click on anything with selector "comments-additional-information" - And I fill in "organization_rating_people_benefited" with "123123" - And I fill in "organization_rating_saved_value" with "7654321" + And I fill in "people_benefited_tmp" with "123123" + And I fill in "saved_value_tmp" with "7654321" And I press "Save" - Then I should see "Benefited People: 123.123" - And I should see "Saved Resources: $ 76,543.21" + Then I should see "Benefited People: 123,123" + And I should see "Saved Resources: $76,543.21" diff --git a/src/noosfero-spb/software_communities/views/search/_catalog_filter.html.erb b/src/noosfero-spb/software_communities/views/search/_catalog_filter.html.erb index e6a9dd7..b97d614 100644 --- a/src/noosfero-spb/software_communities/views/search/_catalog_filter.html.erb +++ b/src/noosfero-spb/software_communities/views/search/_catalog_filter.html.erb @@ -6,8 +6,10 @@