From b84dcc4445aa5abbb654a4040334fed2c55eb4a1 Mon Sep 17 00:00:00 2001 From: ParleyMartins Date: Thu, 30 Oct 2014 11:16:42 -0200 Subject: [PATCH] Fix selenium tests --- features/deactivate_software.feature | 66 ------------------------------------------------------------------ features/deactivate_user.feature | 2 +- features/institution_registration.feature | 32 ++++++++++---------------------- features/software_registration.feature | 55 ++++++++++++++++++++++++++----------------------------- features/user_profile_edition.feature | 32 +++++++------------------------- features/user_registration.feature | 283 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 6 files changed, 44 insertions(+), 426 deletions(-) delete mode 100644 features/deactivate_software.feature delete mode 100644 features/user_registration.feature diff --git a/features/deactivate_software.feature b/features/deactivate_software.feature deleted file mode 100644 index 9001bb8..0000000 --- a/features/deactivate_software.feature +++ /dev/null @@ -1,66 +0,0 @@ -Feature: deactivate software - As a administrator of a software - I want to be able to deactivate - So that, if needed, I can reactivate it without loosing it's data - - 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 SoftwareInfo has initial default values on database - - @selenium - Scenario: Deactivate a software - Given the following software language - | programing_language | version | operating_system | - | Python | 1.0 | Linux | - And the following software databases - | database_name | version | operating_system | - | PostgreSQL | 1.0 | Linux | - And the following operating systems - | operating_system_name | version | - | Debian | 1.0 | - And the following softwares - | name | acronym | operating_platform | software_language | software_database | operating_system| objectives | features | - | teste | ts | I dont know | Python | PostgreSQL | Debian | teste | teste | - And I go to /plugin/mpog_software/archive_software - And I should see "teste" - And I follow "Deactivate software" - And I confirm the "Do you want to deactivate this software?" dialog - And I go to /search/communities - And I fill in "search-input" with "teste" - And I press "Search" - Then I should not see "teste" within "#search-results" - - @selenium - Scenario: Activate a deactivated software - Given the following software language - | programing_language | version | operating_system | - | Python | 1.0 | Linux | - And the following software databases - | database_name | version | operating_system | - | PostgreSQL | 1.0 | Linux | - And the following operating systems - | operating_system_name | version | - | Debian | 1.0 | - And the following softwares - | name | acronym | operating_platform | software_language | software_database | operating_system| objectives | features | - | teste | ts | I dont know | Python | PostgreSQL | Debian | teste | teste | - And I go to /plugin/mpog_software/archive_software - And I should see "teste" - And I follow "Deactivate software" - And I confirm the "Do you want to deactivate this software?" dialog - And I go to /search/communities - And I fill in "search-input" with "teste" - And I press "Search" - And I should not see "Teste" within "#search-results" - And I go to /plugin/mpog_software/archive_software - And I should see "teste" - And I follow "Activate Software" - And I confirm the "Do you want to activate this software?" dialog - And I go to /search/communities - And I fill in "search-input" with "teste" - And I press "Search" - Then I should see "teste" within ".search-profile-item" diff --git a/features/deactivate_user.feature b/features/deactivate_user.feature index 8b0e21f..a7add8c 100644 --- a/features/deactivate_user.feature +++ b/features/deactivate_user.feature @@ -5,7 +5,7 @@ Feature: deactivate user Background: Given "MpogSoftwarePlugin" plugin is enabled - And I am logged in as admin + And I am logged in as mpog_admin And I go to /admin/plugins And I check "MpogSoftwarePlugin" And I press "Save changes" diff --git a/features/institution_registration.feature b/features/institution_registration.feature index 727f0c4..8591bf2 100644 --- a/features/institution_registration.feature +++ b/features/institution_registration.feature @@ -5,16 +5,16 @@ Feature: Institution Field Background: Given "MpogSoftwarePlugin" plugin is enabled - And I am logged in as admin + And I am logged in as mpog_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 + And I am logged in as mpog_admin @selenium Scenario: Show new institution fields when clicked in create new institution - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I should see "New Institution" And I should see "Name" @@ -30,7 +30,7 @@ Feature: Institution Field @selenium Scenario: Show new institution fields when private institution is selected - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I should see "New Institution" And I should see "Name" @@ -44,7 +44,7 @@ Feature: Institution Field @selenium Scenario: Create new public institution when all required fields are filled. - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I fill in "community_name" with "Institution Name" And I fill in "institutions_cnpj" with "00.000.000/0001-00" @@ -60,7 +60,7 @@ Feature: Institution Field @selenium Scenario: Create new private institution when all required fields are filled - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I fill in "community_name" with "Institution Name" And I fill in "institutions_cnpj" with "00.000.000/0001-00" @@ -73,7 +73,7 @@ Feature: Institution Field @selenium Scenario: Don't create an institution when name and cpnj are not filled - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I choose "Private Institution" And I fill in "institutions_acronym" with "Teste" @@ -82,12 +82,10 @@ Feature: Institution Field And I fill in "community_city" with "Brasilia" 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 + Given I follow "Edit Profile" When I follow "Create new institution" And I fill in "community_name" with "Institution Name" And I fill in "institutions_cnpj" with "00.000.000/0001-00" @@ -96,22 +94,12 @@ Feature: Institution Field And I fill in "community_city" with "Brasilia" And I choose "Public Institution" And I follow "Save" - Then I should see "Governmental power can't be blank" - And I should see "Governmental sphere can't be blank" - And I should see "Juridical nature can't be blank" + Then I should see "Institution could not be created!" @selenium Scenario: Don't Create new institution when no field is filled - Given I go to /account/signup + Given I follow "Edit Profile" When I follow "Create new institution" And I choose "Public Institution" 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 "Country can't be blank" - And I should see "State can't be blank" - And I should see "City can't be blank" - And I should see "Governmental power can't be blank" - And I should see "Governmental sphere can't be blank" - And I should see "Juridical nature can't be blank" - And I should see "CNPJ can't be blank" diff --git a/features/software_registration.feature b/features/software_registration.feature index 89beede..7e74dca 100644 --- a/features/software_registration.feature +++ b/features/software_registration.feature @@ -1,6 +1,6 @@ -Feature: software registration +Feature: edit public software information As a user - I want to create a new software + I want to add public software information to a software So that I can have software communities on my network Background: @@ -10,15 +10,16 @@ Feature: software registration And I go to /admin/plugins And I check "MpogSoftwarePlugin" And I press "Save changes" - - @selenium - Scenario: Show SoftwareLangue fields when click in New Language - Given I go to /myprofile/mpog-admin + And I go to /myprofile/mpog-admin And I follow "Create a new software" And I fill in "community_name" with "basic software" And I fill in "software_info_finality" with "basic software finality" And I press "Create" - And I follow "Public Software" + + @selenium + Scenario: Show SoftwareLangue fields when click in New Language + Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software + When I follow "Public Software" And I follow "New language" And I should see "3" of this selector ".software-language-table" And I follow "Delete" @@ -27,12 +28,8 @@ Feature: software registration @selenium Scenario: Show databasefields when click in New database - Given I go to /myprofile/mpog-admin - And I follow "Create a new software" - And I fill in "community_name" with "basic software" - And I fill in "software_info_finality" with "basic software finality" - And I press "Create" - And I follow "Public Software" + Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software + When I follow "Public Software" And I follow "New Database" And I should see "3" of this selector ".database-table" And I follow "Delete" @@ -41,38 +38,38 @@ Feature: software registration @selenium Scenario: Software database name should be an autocomplete - Given I go to /myprofile/mpog-admin - And I follow "Create a new software" - And I fill in "community_name" with "basic software" - And I fill in "software_info_finality" with "basic software finality" - And I press "Create" - And I follow "Public Software" + Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software + When I follow "Public Software" And I follow "New Database" And I type in "my" into autocomplete list "database_autocomplete" and I choose "MySQL" - And I fill in "database_autocomplete" with "Replace me with MySQL" - And I fill in "database__version" with "" Then selector ".database_autocomplete" should have any "MySQL" @selenium + Scenario: Software database name should be an autocomplete + Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software + When I follow "Public Software" + And I follow "New language" + And I type in "py" into autocomplete list "language_autocomplete" and I choose "Python" + Then selector ".database_autocomplete" should have any "Python" + + @selenium Scenario: Create software with all dynamic table fields filled - Given I go to /myprofile/mpog-admin - And I follow "Create a new software" - And I fill in "community_name" with "basic software" - And I fill in "software_info_finality" with "basic software finality" - And I press "Create" - And I follow "Public Software" + Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software + When I follow "Public Software" And I follow "New language" + And I type in "py" into autocomplete list "language_autocomplete" and I choose "Python" And I fill in "language__version" with "1.2.3" And I fill in "language__operating_system" with "Unix" And I follow "New Database" And I type in "my" into autocomplete list "database_autocomplete" and I choose "MySQL" And I fill in "database__version" with "4.5.6" And I fill in "database__operating_system" with "Unix" - And I press "Save" + Then I press "Save" And I follow "Software Info" And I follow "Public Software" + And selector ".language_autocomplete" should have any "Python" And selector "#language__version" should have any "1.2.3" And selector "#language__operating_system" should have any "Unix" And selector ".database_autocomplete" should have any "MySQL" And selector "#database__version" should have any "4.5.6" - Then selector "#database__operating_system" should have any "Unix" + And selector "#database__operating_system" should have any "Unix" diff --git a/features/user_profile_edition.feature b/features/user_profile_edition.feature index 9e13618..48d96f5 100644 --- a/features/user_profile_edition.feature +++ b/features/user_profile_edition.feature @@ -15,31 +15,17 @@ Feature: Institution Field And I check "person_fields_state_active" And I check "person_fields_city_active" And I press "Save changes" - And I go to /account/logout And Institutions has initial default values on database And the following public institutions | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | - And I go to /account/signup - And Institutions has initial default values on database - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@nowitgo.com| - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | Secondary e-Mail | josesilva@example.com | - And wait for the captcha signup time - And I follow "Add new institution" - And I press "Create my account" - Then José da Silva's account is activated + And I am logged in as mpog_admin @selenium Scenario: Add more then one instituion on profile editor - Given I am on josesilva's control panel - And I follow "Edit Profile" + Given I follow "Edit Profile" And I follow "Add new institution" And I type in "Minis" into autocomplete list "input_institution" and I choose "Ministerio do Planejamento" And I follow "Add new institution" @@ -50,27 +36,23 @@ Feature: Institution Field @selenium Scenario: Verify text information to use governmental e-mail - Given I am on josesilva's control panel - And I follow "Edit Profile" + Given I follow "Edit Profile" Then I should see "If you work in a public agency use your government e-Mail" @selenium Scenario: Verify if field 'city' is shown when Brazil is selected - Given I am on josesilva's control panel - And I follow "Edit Profile" + Given I follow "Edit Profile" Then I should see "City" @selenium Scenario: Verify if field 'city' does not appear when Brazil is not selected as country - Given I am on josesilva's control panel - When I follow "Edit Profile" - And I select "United States" from "profile_data_country" + Given I follow "Edit Profile" + When I select "United States" from "profile_data_country" Then I should not see "City" within ".type-text" @selenium Scenario: Show message of institution not found - Given I am on josesilva's control panel - And I follow "Edit Profile" + Given I follow "Edit Profile" And I fill in "input_institution" with "Some Nonexistent Institution" And I sleep for 1 seconds Then I should see "No institution found" diff --git a/features/user_registration.feature b/features/user_registration.feature deleted file mode 100644 index 2e0dd5f..0000000 --- a/features/user_registration.feature +++ /dev/null @@ -1,283 +0,0 @@ -Feature: User Registration - - 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 /admin/features/manage_fields - And I check "person_fields_country_active" - And I check "person_fields_country_required" - And I check "person_fields_country_signup" - And I check "person_fields_state_active" - And I check "person_fields_state_required" - And I check "person_fields_state_signup" - And I check "person_fields_city_active" - And I check "person_fields_city_required" - And I check "person_fields_city_signup" - And I press "Save changes" - And the following blocks - | owner | type | - | environment | LoginBlock | - And I go to /account/logout - - - @selenium - Scenario: Successful autocomplete with part of the institution name and adding institution - Given I go to /account/signup - And Institutions has initial default values on database - And the following public institutions - | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | - | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@serpro.gov.br| - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@example.com | - And I type in "Minis" into autocomplete list "input_institution" and I choose "Ministerio do Planejamento" - And I follow "Add new institution" - Then I should see "Ministerio do Planejamento" within ".institutions_added" - - @selenium - Scenario: Successfull autocomplete with institution acronym - Given I go to /account/signup - And Institutions has initial default values on database - And the following public institutions - | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | - | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@serpro.gov.br| - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@example.com | - And I type in "MP" into autocomplete list "input_institution" and I choose "Ministerio do Planejamento" - And I follow "Add new institution" - And I press "Create my account" - When José da Silva's account is activated - And I go to login page - And I fill in "Username" with "josesilva" - And I fill in "Password" with "secret" - And I press "Log in" - Then I should be logged in as "josesilva" - - @selenium - Scenario: Unsuccessfull registration due to the existance of e-mail as secondary another user's e-mail - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | - And the user "maria" has "user@example.com" as secondary e-mail - And I go to /account/signup - And I fill in the following within ".no-boxes": - | e-Mail | user@example.com | - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - And wait for the captcha signup time - And I select "Brazil" from "profile_data[country]" - When I press "Create my account" - Then I should see "E-mail or secondary e-mail already taken." - - @selenium - Scenario: Unsuccessfull registration due to the existance of secondary e-mail as another user's secondary e-mail - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | - And the user "maria" has "user@example.com" as secondary e-mail - And I go to /account/signup - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@example.com | - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | user@example.com | - And I select "Brazil" from "profile_data[country]" - And wait for the captcha signup time - When I press "Create my account" - Then I should see "E-mail or secondary e-mail already taken." - - @selenium - Scenario: Unsuccessfull registration due to the existance of secondary e-mail as another user's e-mail - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | user@example.com | Brazil | DF | Brasilia | - And I go to /account/signup - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@example.com | - | Username | josesilva | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | user@example.com | - And I select "Brazil" from "profile_data[country]" - And wait for the captcha signup time - When I press "Create my account" - Then I should see "E-mail or secondary e-mail already taken." - - @selenium - Scenario: Unsuccessfull registration due to both primary e-mail and secondary e-mail being equal - Given I go to /account/signup - And I fill in the following within ".no-boxes": - | Username | josesilva | - | e-Mail | josesilva@example.com | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@example.com | - And I select "Brazil" from "profile_data[country]" - And wait for the captcha signup time - When I press "Create my account" - Then I should see "Email must be different from secondary email." - - @selenium - Scenario: Unsuccessfull registration due to government fields being blank - Given I go to /account/signup - And I fill in the following within ".no-boxes": - | Username | josesilva | - | e-Mail | josesilva@serpro.gov.br| - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | Secondary e-Mail | josesilva@example.com | - And wait for the captcha signup time - When I press "Create my account" - And I should see "Institution is obligatory if user has a government email." - And I should see "State can't be blank" - And I should see "City can't be blank" - - @selenium - Scenario: Unsuccessfull registration due to secondary email is governmental and primary is not - Given I go to /account/signup - And I fill in the following within ".no-boxes": - | Username | josesilva | - | e-Mail | josesilva@example.com | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@serpro.gov.br| - And wait for the captcha signup time - When I press "Create my account" - Then I should see "The governamental email must be the primary one." - - @selenium-fixme - Scenario: Show incomplete resgistration percentage - Given I go to /account/signup - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@gmail.com | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@example.com | - And I select "Brazil" from "profile_data[country]" - And I fill in "Username" with "josesilva" - And wait for the captcha signup time - And I press "Create my account" - When José da Silva's account is activated - And I go to login page - And I fill in "Username" with "josesilva" - And I fill in "Password" with "secret" - And I press "Log in" - Then I should see "Complete Profile: 37%" - - @selenium - Scenario: Remove the incomplete resgistration percentage message - Given I go to /account/signup - And I fill in the following within ".no-boxes": - | e-Mail | josesilva@gmail.com | - | Password | secret | - | Password confirmation | secret | - | Full name | José da Silva | - | State | Bahia | - | City | Salvador | - | Secondary e-Mail | josesilva@example.com | - And I select "Brazil" from "profile_data[country]" - And I fill in "Username" with "josesilva" - And wait for the captcha signup time - And I press "Create my account" - When José da Silva's account is activated - And I go to login page - And I fill in "Username" with "josesilva" - And I fill in "Password" with "secret" - And I press "Log in" - And I click on anything with selector ".hide-incomplete-percentage" - Then I should not see "Complete Profile: 37%" - - @selenium - Scenario: When the user logged in and hide link of imcomplete percentage and user log out and log in again, the percentage registration link must appear - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | - When I am logged in as "maria" - And I go to /profile/maria - And I should see "Complete Profile:" - And I click on anything with selector ".hide-incomplete-percentage" - And I should not see "Complete Profile" - And I follow "Logout" - And I am logged in as "maria" - And I go to /profile/maria - Then I should see "Complete Profile:" - - @selenium - Scenario: When the user logged in and hide link of imcomplete percentage and user update page, the percentage registration link must not appear - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | - When I am logged in as "maria" - And I go to /profile/maria - And I should see "Complete Profile" - And I click on anything with selector ".hide-incomplete-percentage" - And I should not see "Complete Profile" - And I go to /myprofile/maria/profile_editor/edit - And I should not see "Complete Profile" - And I go to /profile/maria - Then I should not see "Complete Profile" - - @selenium-fixme - Scenario: When the user press incomplete percentage link,he must be redirect to his edit profile page - Given the following users - | login | name | email | country | state | city | - | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | - When I am logged in as "maria" - And I follow "Complete your profile" - Then I should see "Profile settings" - - @selenium - Scenario: The country select box from the registration form should be selected Brazil by default - Given I go to /account/signup - Then I should see "Brazil" within "#profile_data_country" - - @selenium - Scenario: The country select box should enable/disable if the email has/hasnt gov suffix - Given I go to /account/signup - And I select "Barbados" from "profile_data[country]" - And I fill in "e-Mail" with "maria@tse.gov.br" - And I should see "Brazil" within "#profile_data_country" - And I fill in "e-Mail" with "maria@tse.com.br" - And I select "Barbados" from "profile_data[country]" - Then I should see "Barbados" within "#profile_data_country" -- libgit2 0.21.2