From c1e07473271f6103e919f4c9333a5dacb18519e3 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Wed, 4 Dec 2013 13:28:15 -0200 Subject: [PATCH] Acceptance test for processing assynchronous reloading --- features/repository/show/repository_info.feature | 16 +++++++++++++++- features/step_definitions/repository_steps.rb | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/features/repository/show/repository_info.feature b/features/repository/show/repository_info.feature index 348492d..d1c1ce1 100644 --- a/features/repository/show/repository_info.feature +++ b/features/repository/show/repository_info.feature @@ -55,6 +55,7 @@ Feature: Show Repository And I start to process that repository When I visit the repository show page Then I should see the sample repository name + And I should see "LOADING" And I should see "Address" And I should see "Configuration" And I should see "State" @@ -62,4 +63,17 @@ Feature: Show Repository When I click the "Metric Results" h3 Then I should see "Loading data. Please, wait." When I click the "Modules Tree" h3 - Then I should see "Loading data. Please, wait." \ No newline at end of file + Then I should see "Loading data. Please, wait." + When I click the "Processing information" h3 + And I wait for "75" seconds or until I see "COLLECTING" + And I wait for "60" seconds or until I see "ANALYZING" + And I wait for "400" seconds or until I see "READY" + When I click the "Metric Results" h3 + Then I should see "Metric" + And I should see "Value" + And I should see "Weight" + And I should see "Threshold" + When I click the "Modules Tree" h3 + Then I should see "Name" + And I should see "Granularity" + And I should see "Grade" \ No newline at end of file diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index 7275771..38f114b 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -115,4 +115,14 @@ end Then(/^I should see a loaded graphic for the sample metric$/) do page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil +end + +Then(/^I wait for "(.*?)" seconds or until I see "(.*?)"$/) do |timeout, text| + start_time = Time.now + while(page.html.match(text).nil?) + break if (Time.now - start_time) >= timeout.to_f + sleep 1 + end + + page.should have_content(text) end \ No newline at end of file -- libgit2 0.21.2