Commit 0b1b40e0ffeb95b734d9ffc87e7c45311edb61b7

Authored by Fabio Teixeira
Committed by Gabriela Navarro
1 parent 86a63650
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

Add cucumber/selenium tests for software catalog search

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
features/software_catalog.feature 0 → 100644
... ... @@ -0,0 +1,57 @@
  1 +Feature: Search software
  2 + As a user
  3 + I want to be able to search catalogued software
  4 + So that I find a software that fit my needs
  5 + Background:
  6 + Given "MpogSoftwarePlugin" plugin is enabled
  7 + And I am logged in as mpog_admin
  8 + And I go to /admin/plugins
  9 + And I check "MpogSoftwarePlugin"
  10 + And I press "Save changes"
  11 + And I go to /account/logout
  12 + And the following categories
  13 + | name | display_in_menu |
  14 + | Software | true |
  15 + And the following categories
  16 + | parent | name | display_in_menu |
  17 + | Software | Health | true |
  18 + | Software | Education | true |
  19 + And the following softwares
  20 + | name | public_software | categories |
  21 + | Software One | true | Health |
  22 + | Software Two | false | Health, Education |
  23 +
  24 +
  25 + Scenario: Show all softwares when open search page
  26 + Given I go to /search/software_infos
  27 + Then I should see "Software One"
  28 + Then I should see "Software Two"
  29 +
  30 + Scenario: Show all softwares when search software
  31 + Given I go to /search/software_infos
  32 + And I fill in "search-input" with "Software"
  33 + Then I should see "Software One"
  34 + Then I should see "Software Two"
  35 +
  36 + Scenario: Show softwares one when search software one
  37 + Given I go to /search/software_infos
  38 + And I fill in "search-input" with "Software One"
  39 + And I press "Search"
  40 + Then I should see "Software One"
  41 + Then I should not see "Software Two"
  42 +
  43 + @selenium
  44 + Scenario: Show only "Software Two" when searching for "Education" category
  45 + Given I go to /search/software_infos
  46 + And I click on anything with selector "#filter-option-catalog-software"
  47 + And I check "Education"
  48 + Then I should see "Software Two"
  49 + Then I should not see "Software One"
  50 +
  51 + @selenium
  52 + Scenario: Show both Software "One" and "Two" when searching for "Health" category
  53 + Given I go to /search/software_infos
  54 + And I click on anything with selector "#filter-option-catalog-software"
  55 + And I check "Health"
  56 + Then I should see "Software One"
  57 + Then I should see "Software Two"
... ...
features/step_definitions/mpog_steps.rb
... ... @@ -155,6 +155,16 @@ Given /^the following softwares$/ do |table|
155 155 software_info.operating_systems << operating_system
156 156 end
157 157  
  158 + if item[:categories]
  159 + categories = item[:categories].split(",")
  160 + categories.map! {|category| category.strip}
  161 +
  162 + categories.each do |category_name|
  163 + category = Category.find_by_name category_name
  164 + software_info.community.categories << category
  165 + end
  166 + end
  167 +
158 168 software_info.save!
159 169 end
160 170 end
... ...