Skip to content

Commit

Permalink
Merge pull request #13 from leogiraldimg/tests/caminhos-tristes
Browse files Browse the repository at this point in the history
Tests/caminhos tristes
  • Loading branch information
leogiraldimg authored Dec 5, 2019
2 parents 55f477c + 7ec7287 commit e409f43
Show file tree
Hide file tree
Showing 20 changed files with 262 additions and 78 deletions.
7 changes: 4 additions & 3 deletions src/app/app/assets/stylesheets/spotted.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
51 changes: 48 additions & 3 deletions src/app/features/001_sign_up.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 "<form field>" with "<value>"
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
8 changes: 7 additions & 1 deletion src/app/features/002_login_click.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
30 changes: 26 additions & 4 deletions src/app/features/003_create_page_click.feature
Original file line number Diff line number Diff line change
@@ -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
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 "<form field>" with "<value>"
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 | |
12 changes: 8 additions & 4 deletions src/app/features/access_college_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion src/app/features/delete_college.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
14 changes: 7 additions & 7 deletions src/app/features/delete_pages_administrator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

18 changes: 12 additions & 6 deletions src/app/features/post_comment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
8 changes: 7 additions & 1 deletion src/app/features/post_spotted.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
14 changes: 10 additions & 4 deletions src/app/features/receive_notification.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
49 changes: 34 additions & 15 deletions src/app/features/step_definitions/create_page_click_steps.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions src/app/features/step_definitions/delete_college_steps.rb
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions src/app/features/step_definitions/login_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit e409f43

Please sign in to comment.