Commit c1e07473271f6103e919f4c9333a5dacb18519e3

Authored by Rafael Manzo
Committed by Paulo Meireles
1 parent 72a678f9

Acceptance test for processing assynchronous reloading

features/repository/show/repository_info.feature
... ... @@ -55,6 +55,7 @@ Feature: Show Repository
55 55 And I start to process that repository
56 56 When I visit the repository show page
57 57 Then I should see the sample repository name
  58 + And I should see "LOADING"
58 59 And I should see "Address"
59 60 And I should see "Configuration"
60 61 And I should see "State"
... ... @@ -62,4 +63,17 @@ Feature: Show Repository
62 63 When I click the "Metric Results" h3
63 64 Then I should see "Loading data. Please, wait."
64 65 When I click the "Modules Tree" h3
65   - Then I should see "Loading data. Please, wait."
66 66 \ No newline at end of file
  67 + Then I should see "Loading data. Please, wait."
  68 + When I click the "Processing information" h3
  69 + And I wait for "75" seconds or until I see "COLLECTING"
  70 + And I wait for "60" seconds or until I see "ANALYZING"
  71 + And I wait for "400" seconds or until I see "READY"
  72 + When I click the "Metric Results" h3
  73 + Then I should see "Metric"
  74 + And I should see "Value"
  75 + And I should see "Weight"
  76 + And I should see "Threshold"
  77 + When I click the "Modules Tree" h3
  78 + Then I should see "Name"
  79 + And I should see "Granularity"
  80 + And I should see "Grade"
67 81 \ No newline at end of file
... ...
features/step_definitions/repository_steps.rb
... ... @@ -115,4 +115,14 @@ end
115 115  
116 116 Then(/^I should see a loaded graphic for the sample metric$/) do
117 117 page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil
  118 +end
  119 +
  120 +Then(/^I wait for "(.*?)" seconds or until I see "(.*?)"$/) do |timeout, text|
  121 + start_time = Time.now
  122 + while(page.html.match(text).nil?)
  123 + break if (Time.now - start_time) >= timeout.to_f
  124 + sleep 1
  125 + end
  126 +
  127 + page.should have_content(text)
118 128 end
119 129 \ No newline at end of file
... ...