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,4 +20,5 @@ Feature: Repository metric results
20 And I see a sample metric's name 20 And I see a sample metric's name
21 When I click on the sample metric's name 21 When I click on the sample metric's name
22 Then I should see "Loading data. Please, wait." 22 Then I should see "Loading data. Please, wait."
  23 + When I wait up for the ajax request
23 Then I should see a loaded graphic for the sample metric 24 Then I should see a loaded graphic for the sample metric
24 \ No newline at end of file 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,6 +81,12 @@ When(/^I click the "(.*?)" h3$/) do |text|
81 page.find('h3', text: text).click() 81 page.find('h3', text: text).click()
82 end 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 Then(/^I should see the sample repository name$/) do 90 Then(/^I should see the sample repository name$/) do
85 page.should have_content(@repository.name) 91 page.should have_content(@repository.name)
86 end 92 end
@@ -108,8 +114,5 @@ Then(/^I should see the given repository's content$/) do @@ -108,8 +114,5 @@ Then(/^I should see the given repository's content$/) do
108 end 114 end
109 115
110 Then(/^I should see a loaded graphic for the sample metric$/) do 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 page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil 117 page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil
115 end 118 end
116 \ No newline at end of file 119 \ No newline at end of file