diff --git a/features/institution_registration.feature b/features/institution_registration.feature new file mode 100644 index 0000000..3916739 --- /dev/null +++ b/features/institution_registration.feature @@ -0,0 +1,93 @@ +Feature: Institution Field + As a user + I want to sign up resgistring my institution + So others users can use it + + Background: + Given "MpogSoftwarePlugin" plugin is enabled + And I am logged in as admin + And I go to /admin/plugins + And I check "MpogSoftwarePlugin" + And I press "Save changes" + And I go to /account/logout + And Institutions has initial default values on database + + @selenium + Scenario: Show new institution field when follow add new institution + Given I go to /account/signup + When I follow "Add new institution" + And I should see "New Institution" + And I should see "Name" + And I should see "CNPJ" + And I should see "Public Institution" + And I choose "Public Institution" + And I should see "Acronym" + And I should see "Governmental Power:" + Then I should see "Governmental Sphere:" + + @selenium + Scenario: Show new institution fields when private institution is selected + Given I go to /account/signup + When I follow "Add new institution" + And I should see "New Institution" + And I should see "Name" + And I should see "CNPJ" + And I should see "Private Institution" + And I choose "Private Institution" + Then I should see "Fantasy name" + + @selenium + Scenario: Create new public institution when all required fields are filled. + Given I go to /account/signup + When I follow "Add new institution" + And I fill in "community_name" with "Institution Name" + And I fill in "institutions_cnpj" with "00.000.000/0001-00" + And I choose "Public Institution" + And I fill in "institutions_acronym" with "Teste" + And I select "Executivo" from "institutions_governmental_power" + And I select "Federal" from "institutions_governmental_sphere" + And I follow "Save" + Then I should see "Institution Name" + + @selenium + Scenario: Create new private institution when all required fields are filled + Given I go to /account/signup + When I follow "Add new institution" + And I fill in "community_name" with "Institution Name" + And I fill in "institutions_cnpj" with "00.000.000/0001-00" + And I choose "Private Institution" + And I fill in "institutions_acronym" with "Teste" + And I follow "Save" + Then I should see "Institution Name" + + @selenium + Scenario: Don't create an institution when name and cpnj are not filled + Given I go to /account/signup + When I follow "Add new institution" + And I choose "Private Institution" + And I fill in "institutions_acronym" with "Teste" + And I follow "Save" + Then I should see "Institution could not be created!" + And I should see "Name can't be blank" + And I should see "CNPJ can't be blank" + + @selenium + Scenario: Don't Create new institution when a governamental field is not filled + Given I go to /account/signup + When I follow "Add new institution" + And I fill in "community_name" with "Institution Name" + And I fill in "institutions_cnpj" with "00.000.000/0001-00" + And I choose "Public Institution" + And I follow "Save" + Then I should see "Governmental fields Could not find Governmental Power or Governmental Sphere" + + @selenium + Scenario: Don't Create new institution when a governamental field is not filled + Given I go to /account/signup + When I follow "Add new institution" + And I choose "Public Institution" + And I follow "Save" + Then I should see "Institution could not be created!" + And I should see "Governmental fields Could not find Governmental Power or Governmental Sphere" + And I should see "Name can't be blank" + And I should see "CNPJ can't be blank" diff --git a/features/instution_field.feature b/features/instution_field.feature deleted file mode 100644 index ef1b22f..0000000 --- a/features/instution_field.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Institution Field - As a user - I want to sign up resgistring my institution - So others users can use it - - Background: - Given "MpogSoftwarePlugin" plugin is enabled - And I am logged in as admin - And I go to /admin/plugins - And I check "MpogSoftwarePlugin" - And I press "Save changes" - And I go to /account/logout - - @selenium - Scenario: Show new institution field when another institution is selected - Given I go to /account/signup - When I select "Other" from "Institution" - And I should see "New Institution" - And I fill in "institution_name" with "Test Institution" - And I fill in "profile_data_name" with " " - Then I should see "Test Institution" within "#user_institution_id" -- libgit2 0.21.2