diff --git a/src/app/app/assets/stylesheets/spotted.scss b/src/app/app/assets/stylesheets/spotted.scss index ca7478c6..0bad8d7d 100644 --- a/src/app/app/assets/stylesheets/spotted.scss +++ b/src/app/app/assets/stylesheets/spotted.scss @@ -191,10 +191,11 @@ h2.title { #show .container-right .scroll { width: 100%; - height: calc(100% - 60px); - height: -moz-calc(100% - 60px); - height: -webkit-calc(100% - 60px); + height: calc(100% - 66px); + height: -moz-calc(100% - 66px); + height: -webkit-calc(100% - 66px); height: -o-calc(100% - 60px); + padding-top: 10px; overflow: auto; } diff --git a/src/app/features/001_sign_up.feature b/src/app/features/001_sign_up.feature index f5703770..9a56fb8f 100644 --- a/src/app/features/001_sign_up.feature +++ b/src/app/features/001_sign_up.feature @@ -4,15 +4,60 @@ As a user I want to create an account So that I can use the application -Scenario: User creates a new account filling all fields filled with valid data +Scenario: User creates a new account filling all fields with valid data Given I am on the create account page When I fill the user registration form + And I attach a profile picture And I click the Cadastrar button Then I should see the welcome page -Scenario: User creates a new account successfully checking the checkbox to see near colleges +Scenario: User creates a new account successfully and check the option to see near colleges Given I am on the create account page When I fill the user registration form + And I attach a profile picture And I check the checkbox to see the page's wizard And I click the Cadastrar button - Then I should see the page's wizard \ No newline at end of file + Then I should see the page's wizard + +Scenario Outline: User try to create a new account with invalid data + Given I am on the create account page + When I fill the user registration form + And I fill in "
" with "" + And I attach a profile picture + And I click the Cadastrar button + Then I should see the red failed toast + + Examples: + | form field | value | + | user first name | | + | user last name | | + | user nickname | | + | user birth date | | + | user email | | + | user email | emailinvalido.com | + | user email | emailinvalido@empresa | + | user password | | + | user password confirmation | | + | user password confirmation | confirmacao errada | + | user country | | + | user state | | + | user state | São Paulo | + | user city | | + +Scenario: User try to create a new account with invalid password format + Given I am on the create account page + When I fill the user registration form + When I fill in "user password" with "cinco" + And I fill in "user password confirmation" with "cinco" + And I attach a profile picture + And I click the Cadastrar button + Then I should see the red failed toast + +Scenario: User try to create a new account with existing user nickname + Given There is an unregistered user + And I am on the create account page + When I fill the user registration form + And I fill in "user nickname" with "teste002.user" + And I attach a profile picture + And I click the Cadastrar button + Then I should see the red failed toast \ No newline at end of file diff --git a/src/app/features/002_login_click.feature b/src/app/features/002_login_click.feature index ab3f80d9..42fa5a5e 100644 --- a/src/app/features/002_login_click.feature +++ b/src/app/features/002_login_click.feature @@ -11,4 +11,10 @@ Scenario: student clicks the login button Given I am on the login page When I fill the login form with login information And I click the Entrar button - Then I should see the initial user page \ No newline at end of file + Then I should see the initial user page + +Scenario: student fill user login with invalid data + Given I am on the login page + When I fill the login form with invalid login information + And I click the Entrar button + Then I should see the failed toast \ No newline at end of file diff --git a/src/app/features/003_create_page_click.feature b/src/app/features/003_create_page_click.feature index dfdcf833..ed72e7f6 100644 --- a/src/app/features/003_create_page_click.feature +++ b/src/app/features/003_create_page_click.feature @@ -1,14 +1,36 @@ Feature: Create a new page -As a spotted page manager +As a user I want to create a page to my educational institution -So that I can manage the page of my educational institution +So that there is a page to my educational institution on the app Background: I am logged in Given I logged in successfully -Scenario: spotted page manager clicks the create new page button with valid data and all fields filled except "background_image" +Scenario: User clicks the create new page button with valid data Given I am on the create new page page When I fill the create new page form + And I select manual approve + And I select to not request to participate And I click the Cadastrar button - Then I should see the initial user page \ No newline at end of file + Then I should see the initial user page + +Scenario Outline: User clicks the create new page button with invalid data + Given I am on the create new page page + When I fill the create new page form + And I fill in "" with "" + And I select manual approve + And I select to not request to participate + And I click the Cadastrar button + Then I should see the red failed toast + + Examples: + | form field | value | + | college name | | + | college initials | nove letras | + | college city | | + | college state | | + | college state | São Paulo | + | college country | | + | college font color | | + | college background color | | \ No newline at end of file diff --git a/src/app/features/access_college_page.feature b/src/app/features/access_college_page.feature index 594efdd3..4e5aa01f 100644 --- a/src/app/features/access_college_page.feature +++ b/src/app/features/access_college_page.feature @@ -4,11 +4,15 @@ As a student I want to access a college page So that I can check spotteds and content of that page -Background: I am logged in and there is a college page already created +Background: I am logged in Given I logged in successfully - And I created a college page - + Scenario: student clicks on a college link at the colleges menu and access the college page - Given I am on the colleges menu + Given I created a college page + And I am on the colleges menu When I click on my college page link Then I should see my college page + +Scenario: student is on college page but there is no college + Given I am on the colleges menu + Then I should see empty college page menu diff --git a/src/app/features/delete_college.feature b/src/app/features/delete_college.feature index 01c0f4b1..e2e70894 100644 --- a/src/app/features/delete_college.feature +++ b/src/app/features/delete_college.feature @@ -12,4 +12,9 @@ Scenario: Delete a college page when I go to edit page settings and click the "A Given I am on the edit page settings page When I click the Apagar a página button And I am on the colleges menu page - Then The college page shouldn't be exist anymore \ No newline at end of file + Then The college page shouldn't be exist anymore + +Scenario: User tries to delete a college that he is not admin + Given There is a college page created + And I am on the colleges menu + Then I cant find that college Editar button \ No newline at end of file diff --git a/src/app/features/delete_pages_administrator.feature b/src/app/features/delete_pages_administrator.feature index b6e771df..0adc2108 100644 --- a/src/app/features/delete_pages_administrator.feature +++ b/src/app/features/delete_pages_administrator.feature @@ -5,13 +5,13 @@ I want to delete a administrator of the page So that i can manage the page administration resposibility Background: -Given I logged in successfully -And I created a college page -And I already defined the user as administrator + Given I logged in successfully + And I created a college page + And I already defined the user as administrator Scenario: Administrator choose othe administrator to be exclude clicking on the trash buttom -Given I am on the page's list of administrators -When I click on the trash button associated with a administrator -Then I should see the list without the administrator that I choose -And I should see a success message + Given I am on the page's list of administrators + When I click on the trash button associated with a administrator + Then I should see the list without the administrator that I choose + And I should see a success message diff --git a/src/app/features/post_comment.feature b/src/app/features/post_comment.feature index f4c8972d..82a8aec4 100644 --- a/src/app/features/post_comment.feature +++ b/src/app/features/post_comment.feature @@ -5,14 +5,20 @@ I want to post a comment So that I can tell what I think about any spotted Background: - Given There is a college page created + Given There is a spotted created And I logged in successfully - And I accessed a college page successfully - And I posted a spotted successfully on the college page Scenario: student write a comment on the content field and clicks the button "Mandar Comentário" - Given I click the Ver spotted button - When I fill the content comment field with some information + Given I am on the college page + When I click the Ver spotted button + And I fill the content comment field with some information And I click the Mandar comentário button icon Then I should see the view spotted page - And I should see my new comment on the timeline \ No newline at end of file + And I should see my new comment on the timeline + +Scenario: student tries to post a comment with empty content + Given I am on the college page + When I click the Ver spotted button + And I dont fill the content comment field + And I click the Mandar comentário button icon + Then I should see the red failed toast \ No newline at end of file diff --git a/src/app/features/post_spotted.feature b/src/app/features/post_spotted.feature index c4d4354b..1f4008df 100644 --- a/src/app/features/post_spotted.feature +++ b/src/app/features/post_spotted.feature @@ -14,4 +14,10 @@ Scenario: student write a spotted on the content field and clicks the button "Ma When I fill the content spotted field with some information And I click the Mandar spotted button Then I should see the college page - And I should see my new spotted on the timeline \ No newline at end of file + And I should see my new spotted on the timeline + +Scenario: student tries to post a spotted with empty content + Given I click the Novo spotted button + When I dont fill the content spotted field + And I click the Mandar spotted button + Then I should see the red failed toast \ No newline at end of file diff --git a/src/app/features/receive_notification.feature b/src/app/features/receive_notification.feature index d3514a7f..158f4f01 100644 --- a/src/app/features/receive_notification.feature +++ b/src/app/features/receive_notification.feature @@ -4,12 +4,18 @@ As a student I want to receive notifications from spotted So that I can follow spotted updates -Background: There is a spotted and a comment created - Given There is a comment - And I logged in successfully - Scenario: Student clicks on bell button + Given There is a comment created + And I logged in successfully Given I accessed a college page successfully Given I click on Ativar Notificações And I click on bell button Then I should see my notifications + +Scenario: Student clicks on bell button but has no notification + Given There is a spotted created + And I logged in successfully + And I am on the college page + And I click on Ativar Notificações + And I click on bell button + Then I shouldnt see my notifications diff --git a/src/app/features/step_definitions/access_college_page_steps.rb b/src/app/features/step_definitions/access_college_page_steps.rb index a8a7f862..6b9f4dc0 100644 --- a/src/app/features/step_definitions/access_college_page_steps.rb +++ b/src/app/features/step_definitions/access_college_page_steps.rb @@ -15,6 +15,10 @@ expect(page).to have_xpath('.//h2', text: "Universidade Teste 003") end +Then("I should see empty college page menu") do + page.should have_no_content('#star-white') +end + # - - - Given (/^I accessed a college page successfully$/) do @@ -40,4 +44,8 @@ When I click on my college page link Then I should see my college page } +end + +Given /^I am on the college page$/ do + visit college_spotteds_path(@college.id) end \ No newline at end of file diff --git a/src/app/features/step_definitions/create_page_click_steps.rb b/src/app/features/step_definitions/create_page_click_steps.rb index cf952970..7c8777c8 100644 --- a/src/app/features/step_definitions/create_page_click_steps.rb +++ b/src/app/features/step_definitions/create_page_click_steps.rb @@ -1,34 +1,53 @@ -Given (/^I am on the create new page page$/) do +Given /^I am on the create new page page$/ do visit new_college_path end -When (/^I fill the create new page form$/) do - fill_in "college[name]", with: "Universidade Teste 001" - fill_in "college[initials]", with: "UT001" - fill_in "college[city]", with: "São Paulo" - fill_in "college[state]", with: "SP" - fill_in "college[country]", with: "Brasil" - fill_in "college[unit]", with: "Faculdade Teste 001" - fill_in "college[background_color]", with: "#fafafa" - fill_in "college[font_family]", with: "Arial" - fill_in "college[font_color]", with: "#000000" +When /^I fill the create new page form$/ do + steps %Q{ + When I fill in "college_name" with "Universidade Teste 001" + When I fill in "college_initials" with "UT001" + When I fill in "college_city" with "São Paulo" + When I fill in "college_state" with "SP" + When I fill in "college_country" with "Brasil" + When I fill in "college_unit" with "Faculdade Teste 001" + When I fill in "college_background_color" with "#fafafa" + When I fill in "college_font_family" with "Arial" + When I fill in "college_font_color" with "#000000" + } +end + +When /^I select manual approve$/ do select 'Manual', from: "college[admin_approves_spotted]" +end + +When /^I select to not request to participate$/ do select 'Não', from: "college[request_to_participate]" end # - - - -Given(/^There is a college page created$/) do +Given /^There is a college page created$/ do steps %Q{ Given There is an unregistered user } - u = College.new(:name => "Universidade Teste 002", :initials => "UT002", :city => "São Paulo", :state => "SP", :country => "Brasil", :unit => "Faculdade Teste 002", :user_id => @user.id, :background_color => "fafafa", :font_family => "Arial", :background_image => "", :font_color => "#000000", :request_to_participate => 0) + u = College.new(:name => "Universidade Teste 002", + :initials => "UT002", + :city => "São Paulo", + :state => "SP", + :country => "Brasil", + :unit => "Faculdade Teste 002", + :user_id => @user.id, + :background_color => "fafafa", + :font_family => "Arial", + :background_image => "", + :font_color => "#000000", + :request_to_participate => 0) u.save @college = College.find_by(initials: "UT002") end -Given(/^I created a college page$/) do +Given /^I created a college page$/ do steps %Q{ Given I am on the create new page page When I fill the create new page form @@ -39,7 +58,7 @@ end -Given(/^There is a college page with request needed created$/) do +Given /^There is a college page with request needed created$/ do steps %Q{ Given There is another unregistered user } diff --git a/src/app/features/step_definitions/delete_college_steps.rb b/src/app/features/step_definitions/delete_college_steps.rb index bca530cd..0288c16c 100644 --- a/src/app/features/step_definitions/delete_college_steps.rb +++ b/src/app/features/step_definitions/delete_college_steps.rb @@ -1,3 +1,8 @@ Then(/^The college page shouldn't be exist anymore$/) do expect(page).not_to have_link('Editar', href: '/colleges/#{@college.id}/edit') +end + +Then(/^I cant find that college Editar button$/) do + element = find('.summary', text: 'UT002 - Faculdade Teste 002') + expect(element).not_to have_link('Editar') end \ No newline at end of file diff --git a/src/app/features/step_definitions/login_steps.rb b/src/app/features/step_definitions/login_steps.rb index a2a4ac60..4979af4b 100644 --- a/src/app/features/step_definitions/login_steps.rb +++ b/src/app/features/step_definitions/login_steps.rb @@ -11,6 +11,16 @@ expect(page).to have_xpath('.//input[@id="pages-menu-access"]') end +When(/^I fill the login form with invalid login information$/) do + fill_in "Email ou usuário", :with => "email errado" + fill_in "Senha", :with => "senha errada" +end + +Then("I should see the failed toast") do + expect(page).to have_xpath('.//div[@class="alert alert-danger alert-dismissible"]') +end + + # - - - Given (/^I logged in successfully$/) do diff --git a/src/app/features/step_definitions/post_comment_steps.rb b/src/app/features/step_definitions/post_comment_steps.rb index b65fcf68..eae555a1 100644 --- a/src/app/features/step_definitions/post_comment_steps.rb +++ b/src/app/features/step_definitions/post_comment_steps.rb @@ -7,13 +7,17 @@ end Then(/^I should see the view spotted page$/) do - expect(page).to have_xpath('.//h2', text: "Spotted n. 1") + expect(page).to have_xpath('.//h2', text: "Spotted n.") end And(/^I should see my new comment on the timeline$/) do expect(page).to have_xpath('.//div', text: "Comment Teste") end +When(/^I dont fill the content comment field$/) do + fill_in "comment[content]", with: "" +end + # - - - Given (/^I posted a comment successfully$/) do @@ -33,9 +37,9 @@ end -Given (/^There is a comment$/) do +Given (/^There is a comment created$/) do steps %Q{ - Given There is a spotted + Given There is a spotted created } u = Comment.new(:content => "Comment Test", :user_id => @user.id, :spotted_id => @spotted.id) @@ -43,3 +47,4 @@ @comment = Comment.find_by(content: "Comment Test") end + diff --git a/src/app/features/step_definitions/post_spotted_steps.rb b/src/app/features/step_definitions/post_spotted_steps.rb index 78f1beae..ac62da50 100644 --- a/src/app/features/step_definitions/post_spotted_steps.rb +++ b/src/app/features/step_definitions/post_spotted_steps.rb @@ -6,6 +6,10 @@ expect(page).to have_xpath('.//div', text: "Spotted Teste") end +When("I dont fill the content spotted field") do + fill_in "spotted[content]", with: "" +end + # - - - Given (/^I posted a spotted successfully on the college page$/) do @@ -38,7 +42,7 @@ @spotted = Spotted.find_by(content: "Spotted") end -Given (/^There is a spotted$/) do +Given (/^There is a spotted created$/) do steps %Q{ Given There is a college page created } diff --git a/src/app/features/step_definitions/receive_notification_steps.rb b/src/app/features/step_definitions/receive_notification_steps.rb index f758b234..22f2328f 100644 --- a/src/app/features/step_definitions/receive_notification_steps.rb +++ b/src/app/features/step_definitions/receive_notification_steps.rb @@ -4,4 +4,8 @@ Then("I should see my notifications") do expect(page).to have_xpath('.//div', text: "Novo comentário") +end + +Then("I shouldnt see my notifications") do + expect(page).not_to have_xpath('.//div', text: "Novo comentário") end \ No newline at end of file diff --git a/src/app/features/step_definitions/sign_up_steps.rb b/src/app/features/step_definitions/sign_up_steps.rb index b7cffac7..21a09c70 100644 --- a/src/app/features/step_definitions/sign_up_steps.rb +++ b/src/app/features/step_definitions/sign_up_steps.rb @@ -2,19 +2,26 @@ visit new_user_path end -When(/^I fill the user registration form$/) do - @user = FactoryBot.build(:user) +When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value| + fill_in(field.gsub(' ', '_'), :with => value) +end + +When /^I fill the user registration form$/ do + steps %Q{ + When I fill in "user_first_name" with "teste001" + When I fill in "user_last_name" with "user" + When I fill in "user_nickname" with "teste001.user" + When I fill in "user_birth_date" with "1998-10-25" + When I fill in "user_email" with "teste001.user@spottapp.com.br" + When I fill in "user_password" with "teste001user" + When I fill in "user_password_confirmation" with "teste001user" + When I fill in "user_country" with "Brasil" + When I fill in "user_state" with "SP" + When I fill in "user_city" with "São Paulo" + } +end - fill_in "user[email]", with: @user.email - fill_in "user[nickname]", with: @user.nickname - fill_in "user[first_name]", with: @user.first_name - fill_in "user[last_name]", with: @user.last_name - fill_in "user[birth_date]", with: @user.birth_date - fill_in "user[password]", with: @user.password - fill_in "user[password_confirmation]", with: @user.password_confirmation - fill_in "user[country]", with: @user.country - fill_in "user[state]", with: @user.state - fill_in "user[city]", with: @user.city +When /^I attach a profile picture$/ do attach_file("user[profile_picture]", 'features/upload-files/icon-384x384.png') end @@ -22,18 +29,31 @@ click_button button_name end +When /^I check the checkbox to see the page's wizard$/ do + find(:css, "#checkbox").set(true) +end + Then(/^I should see the welcome page$/) do expect(page).to have_xpath('.//div[@class="alert alert-success alert-dismissible"]') expect(page).to have_xpath('.//form[@action="/users/new"]') expect(page).to have_xpath('.//form[@action="/entrar"]') end +Then /^I should see the page's wizard$/ do + expect(page).to have_xpath('.//div[@class="jumbotron"]/h2', text: 'Páginas de instituições próximas') +end + +Then (/^I should see the red failed toast$/) do + expect(page).to have_xpath('.//div[@class="alert alert-danger"]') +end + # - - - Given(/^I have an account$/) do steps %Q{ Given I am on the create account page When I fill the user registration form + And I attach a profile picture And I click the Cadastrar button Then I should see the welcome page } @@ -69,13 +89,4 @@ u.save @user = User.find_by(nickname: "teste003.user") -end - -When /^I check the checkbox to see the page's wizard$/ do - find(:css, "#checkbox").set(true) -end - -Then /^I should see the page's wizard$/ do - expect(page).to have_xpath('.//div[@class="jumbotron"]/h2', text: 'Páginas de instituições próximas') -end - \ No newline at end of file +end \ No newline at end of file diff --git a/src/app/features/support/env.rb b/src/app/features/support/env.rb index 44a7cffc..80f7b872 100644 --- a/src/app/features/support/env.rb +++ b/src/app/features/support/env.rb @@ -62,5 +62,7 @@ require 'report_builder' -# Capybara.javascript_driver = :selenium_chrome #roda no navegador -# Capybara.javascript_driver = :selenium_chrome_headless #roda com o nageador em background \ No newline at end of file +# Capybara.configure do |config| +# config.default_driver = :selenium_chrome #roda no navegador +# # config.default_driver = :selenium_chrome_headless #roda com o nageador em background +# end \ No newline at end of file diff --git a/src/app/features/update_user_data.feature b/src/app/features/update_user_data.feature index 1e2e5007..22e10a95 100644 --- a/src/app/features/update_user_data.feature +++ b/src/app/features/update_user_data.feature @@ -5,6 +5,7 @@ I want to update my user data So that I can change my profile information Background: I am logged in + Given There is an unregistered user And I logged in successfully Scenario: Update my user data information @@ -12,4 +13,18 @@ Scenario: Update my user data information When I fill the username with a new username information And I fill the passwords fields And I click the Salvar button - Then I should see the green success toast \ No newline at end of file + Then I should see the green success toast + +Scenario: User tries to update user name with existing user name + Given I am on the edit user page + And I fill in "user nickname" with "teste002.user" + And I fill the passwords fields + And I click the Salvar button + Then I should see the red failed toast + +Scenario: User tries to update user but put the wrong password + Given I am on the edit user page + And I fill in "user nickname" with "newuser.user" + And I fill in "user password_confirmation" with "wrong password" + And I click the Salvar button + Then I should see the red failed toast \ No newline at end of file