Commit a8553e0af85729f3e3c1d5fb121cdda87b3f3552

Authored by Rafael Manzo
2 parents 387ca768 aa63dd05

Merge pull request #74 from mezuro/colorpicker_test

Colorpicker test
features/reading/new.feature
... ... @@ -14,6 +14,7 @@ Feature: New reading
14 14 And I should see "Label"
15 15 And I should see "Grade"
16 16 And I should see "Color"
  17 + And I press the Pick color button
17 18  
18 19 @kalibro_restart
19 20 Scenario: With valid fields
... ... @@ -26,6 +27,28 @@ Feature: New reading
26 27 And I fill the Color field with "00000ff00"
27 28 When I press the Save button
28 29 Then I should be in the Sample Reading Group page
  30 +
  31 + @kalibro_restart @javascript
  32 + Scenario: Checking color picker existence
  33 + Given I am a regular user
  34 + And I am signed in
  35 + And I own a sample reading group
  36 + And I am at the New Reading page
  37 + When I press the Pick color button
  38 + Then I should see a color picker Canvas
  39 +
  40 + @kalibro_restart @javascript
  41 + Scenario: Selecting a valid color with color picker
  42 + Given I am a regular user
  43 + And I am signed in
  44 + And I own a sample reading group
  45 + And I am at the New Reading page
  46 + And I fill the Label field with "My Reading"
  47 + And I fill the Grade field with "1"
  48 + When I press the Pick color button
  49 + And I click on the center of the color picker
  50 + And I press the Save button
  51 + Then I should be in the Sample Reading Group page
29 52  
30 53 @kalibro_restart
31 54 Scenario: With an existing label (Label uniqueness test)
... ...
features/step_definitions/reading_steps.rb
... ... @@ -18,7 +18,14 @@ When(/^I click the "(.*?)" td$/) do |text|
18 18 p page.find('td', text: text).methods
19 19 end
20 20  
  21 +When(/^I click on the center of the color picker$/) do
  22 + page.find('div.colorpicker_color').click
  23 +end
  24 +
21 25 Then(/^I should be at the New Reading page$/) do
22 26 visit new_reading_group_reading_path(@reading_group.id)
23 27 end
24 28  
  29 +Then(/^I should see a color picker Canvas$/) do
  30 + page.find('div.colorpicker')
  31 +end
... ...