Commit 837674678183011a6055864b9e539d5c3b3e01f4
1 parent
24281da8
Exists in
colab
and in
4 other branches
Acceptance tests of RepositoriesController when the process fails.
Showing
2 changed files
with
32 additions
and
2 deletions
Show diff stats
features/repository/show/metric_results.feature
@@ -38,8 +38,21 @@ Feature: Repository metric results | @@ -38,8 +38,21 @@ Feature: Repository metric results | ||
38 | When I visit the repository show page | 38 | When I visit the repository show page |
39 | And I click the "Metric Results" h3 | 39 | And I click the "Metric Results" h3 |
40 | And I see a sample metric's name | 40 | And I see a sample metric's name |
41 | - Then I should see "Missing range" | 41 | + Then I should see "Missing range" |
42 | + | ||
43 | + @kalibro_restart @kalibro_processor_restart @javascript | ||
44 | + Scenario: Should show the error message when the process fails | ||
45 | + Given I am a regular user | ||
46 | + And I am signed in | ||
47 | + And I have a sample project | ||
48 | + And I have a sample configuration with native metrics | ||
49 | + And I have a sample of an invalid repository within the sample project | ||
50 | + And I start to process that repository | ||
51 | + And I wait up for a error processing | ||
52 | + When I visit the repository show page | ||
53 | + And I click the "Metric Results" h3 | ||
54 | + Then I should see "Repository process returned with error. There are no metric results." | ||
42 | 55 | ||
43 | # TODO: Scenario: Should show the graphic of a given metric | 56 | # TODO: Scenario: Should show the graphic of a given metric |
44 | # It was getting really difficult to test this because of Poltergeist's timeouts | 57 | # It was getting really difficult to test this because of Poltergeist's timeouts |
45 | - # so we gave up on this for now | ||
46 | \ No newline at end of file | 58 | \ No newline at end of file |
59 | + # so we gave up on this for now |
features/step_definitions/repository_steps.rb
@@ -34,6 +34,11 @@ Given(/^I have a sample repository within the sample project named "(.+)"$/) do | @@ -34,6 +34,11 @@ Given(/^I have a sample repository within the sample project named "(.+)"$/) do | ||
34 | configuration_id: @mezuro_configuration.id, id: nil, name: name}) | 34 | configuration_id: @mezuro_configuration.id, id: nil, name: name}) |
35 | end | 35 | end |
36 | 36 | ||
37 | +Given(/^I have a sample of an invalid repository within the sample project$/) do | ||
38 | + @repository = FactoryGirl.create(:repository, {project_id: @project.id, | ||
39 | + configuration_id: @mezuro_configuration.id, id: nil, address: "https://invalidrepository.git"}) | ||
40 | +end | ||
41 | + | ||
37 | Given(/^I start to process that repository$/) do | 42 | Given(/^I start to process that repository$/) do |
38 | @repository.process | 43 | @repository.process |
39 | end | 44 | end |
@@ -50,6 +55,18 @@ Given(/^I wait up for a ready processing$/) do | @@ -50,6 +55,18 @@ Given(/^I wait up for a ready processing$/) do | ||
50 | end | 55 | end |
51 | end | 56 | end |
52 | 57 | ||
58 | +Given(/^I wait up for a error processing$/) do | ||
59 | + unless Processing.last_processing_state_of(@repository.id) == "ERROR" | ||
60 | + while(true) | ||
61 | + if Processing.last_processing_state_of(@repository.id) == "ERROR" | ||
62 | + break | ||
63 | + else | ||
64 | + sleep(10) | ||
65 | + end | ||
66 | + end | ||
67 | + end | ||
68 | +end | ||
69 | + | ||
53 | Given(/^I am at the New Repository page$/) do | 70 | Given(/^I am at the New Repository page$/) do |
54 | visit new_project_repository_path(@project.id) | 71 | visit new_project_repository_path(@project.id) |
55 | end | 72 | end |