Commit 13629abb52750b6d83ec8e901b5fc825a9e012e2
Committed by
Rafael Manzo
1 parent
56e45f23
Exists in
colab
and in
4 other branches
Acceptance test for modules tree using MetricFu
Signed off by: Rafael Manzo <rr.manzo@gmail.com>
Showing
6 changed files
with
60 additions
and
2 deletions
Show diff stats
features/repository/show/modules_tree.feature
| @@ -38,7 +38,7 @@ Feature: Repository modules tree | @@ -38,7 +38,7 @@ Feature: Repository modules tree | ||
| 38 | And I should see "Granularity" | 38 | And I should see "Granularity" |
| 39 | And I should see "Grade" | 39 | And I should see "Grade" |
| 40 | 40 | ||
| 41 | - # This test is broken under analizo 1.17.0: https://www.pivotaltracker.com/story/show/80377258 | 41 | + # This test is broken under analizo 1.17.0: https://www.pivotaltracker.com/story/show/80377258 |
| 42 | @wip @kalibro_configuration_restart @kalibro_processor_restart @javascript | 42 | @wip @kalibro_configuration_restart @kalibro_processor_restart @javascript |
| 43 | Scenario: Module navigation | 43 | Scenario: Module navigation |
| 44 | Given I am a regular user | 44 | Given I am a regular user |
| @@ -55,3 +55,19 @@ Feature: Repository modules tree | @@ -55,3 +55,19 @@ Feature: Repository modules tree | ||
| 55 | And I click on the sample child's name | 55 | And I click on the sample child's name |
| 56 | And I wait for "5" seconds | 56 | And I wait for "5" seconds |
| 57 | Then I should see a sample child's name | 57 | Then I should see a sample child's name |
| 58 | + | ||
| 59 | + @kalibro_configuration_restart @kalibro_processor_restart @javascript @wip | ||
| 60 | + Scenario: Should show modules directories root when the process has been finished | ||
| 61 | + Given I am a regular user | ||
| 62 | + And I am signed in | ||
| 63 | + And I have a sample project | ||
| 64 | + And I have a sample configuration with MetricFu metrics | ||
| 65 | + And I have a sample ruby repository within the sample project | ||
| 66 | + And I start to process that repository | ||
| 67 | + And I wait up for a ready processing | ||
| 68 | + And I ask for the last ready processing of the given repository | ||
| 69 | + And I ask for the module result of the given processing | ||
| 70 | + When I visit the repository show page | ||
| 71 | + And I click the "Modules Tree" h3 | ||
| 72 | + And I wait for "5" seconds | ||
| 73 | + Then I should see the given module result |
features/step_definitions/kalibro_configuration_steps.rb
| @@ -55,4 +55,4 @@ end | @@ -55,4 +55,4 @@ end | ||
| 55 | Then(/^the sample configuration should be there$/) do | 55 | Then(/^the sample configuration should be there$/) do |
| 56 | expect(page).to have_content(@kalibro_configuration.name) | 56 | expect(page).to have_content(@kalibro_configuration.name) |
| 57 | expect(page).to have_content(@kalibro_configuration.description) | 57 | expect(page).to have_content(@kalibro_configuration.description) |
| 58 | -end | ||
| 59 | \ No newline at end of file | 58 | \ No newline at end of file |
| 59 | +end |
features/step_definitions/metric_configuration_steps.rb
| @@ -8,6 +8,17 @@ Given(/^I have a metric configuration with code "(.*?)" within the given mezuro | @@ -8,6 +8,17 @@ Given(/^I have a metric configuration with code "(.*?)" within the given mezuro | ||
| 8 | {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, metric: FactoryGirl.build(:metric, code: code)}) | 8 | {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, metric: FactoryGirl.build(:metric, code: code)}) |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | +Given(/^I have a sample configuration with MetricFu metrics$/) do | ||
| 12 | + reading_group = FactoryGirl.create(:reading_group) | ||
| 13 | + reading = FactoryGirl.create(:reading, {reading_group_id: reading_group.id}) | ||
| 14 | + | ||
| 15 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration) | ||
| 16 | + metric_configuration = FactoryGirl.create(:metric_configuration, | ||
| 17 | + {metric: FactoryGirl.build(:pain), | ||
| 18 | + reading_group_id: reading_group.id, | ||
| 19 | + kalibro_configuration_id: @kalibro_configuration.id}) | ||
| 20 | +end | ||
| 21 | + | ||
| 11 | When(/^I visit the sample metric configuration edit page$/) do | 22 | When(/^I visit the sample metric configuration edit page$/) do |
| 12 | visit edit_kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) | 23 | visit edit_kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) |
| 13 | end | 24 | end |
| @@ -40,3 +51,4 @@ end | @@ -40,3 +51,4 @@ end | ||
| 40 | Then(/^I should be at the choose metric page$/) do | 51 | Then(/^I should be at the choose metric page$/) do |
| 41 | expect(page).to have_content("Choose a metric from a Base Tool:") | 52 | expect(page).to have_content("Choose a metric from a Base Tool:") |
| 42 | end | 53 | end |
| 54 | + |
features/step_definitions/repository_steps.rb
| @@ -26,6 +26,11 @@ Given(/^I have a sample repository within the sample project$/) do | @@ -26,6 +26,11 @@ Given(/^I have a sample repository within the sample project$/) do | ||
| 26 | kalibro_configuration_id: @kalibro_configuration.id, id: nil}) | 26 | kalibro_configuration_id: @kalibro_configuration.id, id: nil}) |
| 27 | end | 27 | end |
| 28 | 28 | ||
| 29 | +Given(/^I have a sample ruby repository within the sample project$/) do | ||
| 30 | + @repository = FactoryGirl.create(:ruby_repository, {project_id: @project.id, | ||
| 31 | + kalibro_configuration_id: @kalibro_configuration.id, id: nil}) | ||
| 32 | +end | ||
| 33 | + | ||
| 29 | Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| | 34 | Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| |
| 30 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, | 35 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, |
| 31 | kalibro_configuration_id: @kalibro_configuration.id, id: nil, name: name}) | 36 | kalibro_configuration_id: @kalibro_configuration.id, id: nil, name: name}) |
| @@ -169,3 +174,4 @@ Then(/^"(.*?)" should be lesser than "(.*?)"$/) do |arg1, arg2| | @@ -169,3 +174,4 @@ Then(/^"(.*?)" should be lesser than "(.*?)"$/) do |arg1, arg2| | ||
| 169 | 174 | ||
| 170 | expect(v1 < v2).to be_truthy | 175 | expect(v1 < v2).to be_truthy |
| 171 | end | 176 | end |
| 177 | + |
spec/factories/metrics.rb
| @@ -21,6 +21,17 @@ FactoryGirl.define do | @@ -21,6 +21,17 @@ FactoryGirl.define do | ||
| 21 | initialize_with { new(name, code, scope, description, languages) } | 21 | initialize_with { new(name, code, scope, description, languages) } |
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | + factory :pain, class: KalibroClient::Entities::Miscellaneous::NativeMetric do | ||
| 25 | + name "Code Pain" | ||
| 26 | + code "pain" | ||
| 27 | + scope "CLASS" | ||
| 28 | + description nil | ||
| 29 | + languages { [:ruby] } | ||
| 30 | + metric_collector_name "MetricFu" | ||
| 31 | + | ||
| 32 | + initialize_with { new(name, code, scope, description, languages) } | ||
| 33 | + end | ||
| 34 | + | ||
| 24 | factory :compound_metric, class: KalibroClient::Entities::Miscellaneous::CompoundMetric do | 35 | factory :compound_metric, class: KalibroClient::Entities::Miscellaneous::CompoundMetric do |
| 25 | name "Compound" | 36 | name "Compound" |
| 26 | code "compound" | 37 | code "compound" |
spec/factories/repositories.rb
| @@ -27,6 +27,19 @@ FactoryGirl.define do | @@ -27,6 +27,19 @@ FactoryGirl.define do | ||
| 27 | send_email "test@test.com" | 27 | send_email "test@test.com" |
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | + factory :ruby_repository, class: Repository do | ||
| 31 | + id 2 | ||
| 32 | + name "KalibroConfigurations" | ||
| 33 | + description "Kalibro Configurations" | ||
| 34 | + license "GPLv3" | ||
| 35 | + period 1 | ||
| 36 | + scm_type "GIT" | ||
| 37 | + address "https://github.com/mezuro/kalibro_processor.git" | ||
| 38 | + kalibro_configuration_id 1 | ||
| 39 | + project_id 1 | ||
| 40 | + send_email "test@test.com" | ||
| 41 | + end | ||
| 42 | + | ||
| 30 | factory :another_repository, parent: :repository do | 43 | factory :another_repository, parent: :repository do |
| 31 | id 2 | 44 | id 2 |
| 32 | end | 45 | end |