Commit 72a678f92ec8bb7d60263701b394b8c4b8da9f74

Authored by Rafael Manzo
Committed by Paulo Meireles
1 parent 3c9c5329

Metric results feature with a new step definition for ajax

features/repository/show/metric_results.feature
... ... @@ -20,4 +20,5 @@ Feature: Repository metric results
20 20 And I see a sample metric's name
21 21 When I click on the sample metric's name
22 22 Then I should see "Loading data. Please, wait."
  23 + When I wait up for the ajax request
23 24 Then I should see a loaded graphic for the sample metric
24 25 \ No newline at end of file
... ...
features/step_definitions/repository_steps.rb
... ... @@ -81,6 +81,12 @@ When(/^I click the "(.*?)" h3$/) do |text|
81 81 page.find('h3', text: text).click()
82 82 end
83 83  
  84 +When(/^I wait up for the ajax request$/) do
  85 + while (page.driver.network_traffic.last.response_parts.empty?) do
  86 + sleep(10)
  87 + end
  88 +end
  89 +
84 90 Then(/^I should see the sample repository name$/) do
85 91 page.should have_content(@repository.name)
86 92 end
... ... @@ -108,8 +114,5 @@ Then(/^I should see the given repository's content$/) do
108 114 end
109 115  
110 116 Then(/^I should see a loaded graphic for the sample metric$/) do
111   - while (page.driver.network_traffic.last.response_parts.empty?) do
112   - sleep(10)
113   - end
114 117 page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil
115 118 end
116 119 \ No newline at end of file
... ...