diff --git a/src/app/features/003_create_page_click.feature b/src/app/features/003_create_page_click.feature index f7adda2b..e379b252 100644 --- a/src/app/features/003_create_page_click.feature +++ b/src/app/features/003_create_page_click.feature @@ -1,20 +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 -Scenario: spotted page manager clicks the create new page button with invalid data +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 with invalid data + 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/step_definitions/create_page_click_steps.rb b/src/app/features/step_definitions/create_page_click_steps.rb index f85e6c2d..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,48 +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" - select 'Manual', from: "college[admin_approves_spotted]" - select 'Não', from: "college[request_to_participate]" +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 fill the create new page form with invalid data") do - fill_in "college[name]", with: "" - 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 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 @@ -53,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 }