Commit 9a3459452cfcdd4dc8a276a015e579d09d73ccbf

Authored by Renan Fichberg
Committed by Diego Camarinha
1 parent 6e9de148

New user step implemented to test img click

Acceptance test done to the pop-up of Mezuro Range Comments field, using the new step.

signed-off-by: Diego Araújo <diegoamc90@gmail.com>
features/metric_configuration/show.feature
... ... @@ -14,3 +14,15 @@ Feature: Show Metric Configuration
14 14 And I click the Show link
15 15 Then I should be at metric configuration sample page
16 16 And I should see the sample range
  17 +
  18 + @kalibro_restart @javascript
  19 + Scenario: When there's a range created and I want to see its comments
  20 + Given I have a sample configuration
  21 + And I have a sample reading group
  22 + And I have a sample reading within the sample reading group labeled "My Reading"
  23 + And I have a sample metric configuration within the given mezuro configuration
  24 + And I have a sample range within the sample metric configuration
  25 + And I am at the sample metric configuration page
  26 + When I click the Magnifying glass image
  27 + Then I should see "Comment"
  28 +
... ...
features/step_definitions/mezuro_range_steps.rb
... ... @@ -21,6 +21,10 @@ Given(/^I have a sample range within the sample compound metric configuration$/)
21 21 reading_id: @reading.id, id: nil})
22 22 end
23 23  
  24 +When(/^I am at the New Range page$/) do
  25 + visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id)
  26 +end
  27 +
24 28 Then(/^I should be at the New Range page$/) do
25 29 page.should have_content("New Range")
26 30 page.should have_content("Beginning")
... ... @@ -28,13 +32,11 @@ Then(/^I should be at the New Range page$/) do
28 32 page.should have_content("Comments")
29 33 end
30 34  
31   -When(/^I am at the New Range page$/) do
32   - visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id)
33   -end
34   -
35 35 Then(/^I should see the sample range$/) do
36 36 page.should have_content(@mezuro_range.label)
37 37 page.should have_content(@mezuro_range.beginning)
38 38 page.should have_content(@mezuro_range.end)
39 39 end
40 40  
  41 +
  42 +
... ...
features/step_definitions/user_steps.rb
... ... @@ -2,6 +2,11 @@ When(/^I click the (.+) link$/) do |text|
2 2 click_link text
3 3 end
4 4  
  5 +When(/^I click the (.+) image$/) do |image|
  6 + find(:xpath, "//a/img[@alt='#{image}']/..").click
  7 + sleep(1) #This sleep is essential to make the popup visible when we take a picture of the page
  8 +end
  9 +
5 10 When(/^I press the (.+) button$/) do |text|
6 11 click_button text
7 12 end
... ... @@ -21,4 +26,4 @@ end
21 26  
22 27 When(/^I take a picture of the page$/) do
23 28 page.save_screenshot("/tmp/picture.png")
24   -end
25 29 \ No newline at end of file
  30 +end
... ...