From 37d94bf1de9b26728444ff26e884b232e65fcbdc Mon Sep 17 00:00:00 2001 From: Diego Araújo + Rafael Manzo Date: Tue, 9 Oct 2012 17:52:00 -0300 Subject: [PATCH] [Mezuro] Refactored some cucumber scenarios. --- features/step_definitions/mezuro_steps.rb | 5 +++++ plugins/mezuro/test/features/adding_metric_configuration.feature | 14 +++++--------- plugins/mezuro/test/features/adding_ranges.feature | 46 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/features/step_definitions/mezuro_steps.rb b/features/step_definitions/mezuro_steps.rb index 88492d3..641ffa0 100644 --- a/features/step_definitions/mezuro_steps.rb +++ b/features/step_definitions/mezuro_steps.rb @@ -27,3 +27,8 @@ end Then /^I don't fill anything$/ do end + +Then /^I should see "([^\"]*)" inside an alert$/ do |message| + selenium.get_alert.should eql(message) + selenium.chooseOkOnNextConfirmation(); +end diff --git a/plugins/mezuro/test/features/adding_metric_configuration.feature b/plugins/mezuro/test/features/adding_metric_configuration.feature index 4f8cc38..6995fd1 100644 --- a/plugins/mezuro/test/features/adding_metric_configuration.feature +++ b/plugins/mezuro/test/features/adding_metric_configuration.feature @@ -8,12 +8,8 @@ Feature: Add metric configuration to a configuration | joaosilva | Joao Silva | And I am logged in as "joaosilva" And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - And I am on My Community's cms - And I create a content of type "Kalibro configuration" with the following data + And I go to the Control panel + And I create a Mezuro configuration with the following data | Title | My Configuration | | Description | A sample description | @@ -29,7 +25,7 @@ Feature: Add metric configuration to a configuration Then I should see "Lines of Code" And I should see "Analizo" And I should see "Sample Code" - + Scenario: adding a native metric configuration without code When I follow "Add metric" And I follow "Analizo" @@ -39,7 +35,7 @@ Feature: Add metric configuration to a configuration Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" Scenario: adding a compound metric configuration - When I follow "Add metric" + When I follow "Add Metric" And I follow "New Compound Metric" And I fill in the following: | Name: | Compound sample | @@ -64,4 +60,4 @@ Feature: Add metric configuration to a configuration And I select "Class" from "Scope:" And I select "Average" from "Aggregation Form:" And I press "Add" - Then I should see "Compound sample" + Then I should see "Metric with invalid code or script: invalid script" diff --git a/plugins/mezuro/test/features/adding_ranges.feature b/plugins/mezuro/test/features/adding_ranges.feature index 8af9f0c..71e55ca 100644 --- a/plugins/mezuro/test/features/adding_ranges.feature +++ b/plugins/mezuro/test/features/adding_ranges.feature @@ -8,15 +8,11 @@ Feature: Add range to a metric configuration | joaosilva | Joao Silva | And I am logged in as "joaosilva" And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - And I am on My Community's cms - And I create a content of type "Kalibro configuration" with the following data + And I go to the Control Panel + And I create a Mezuro configuration with the following data | Title | My Configuration | | Description | A sample description | - And I follow "Add metric" + And I follow "Add Metric" And I follow "Analizo" And I follow "Lines of Code" And I fill in the following: @@ -24,9 +20,6 @@ Feature: Add range to a metric configuration | Weight: | 10.0 | And I select "Average" from "Aggregation Form:" And I press "Add" - Then I should see "Lines of Code" - And I should see "Analizo" - And I should see "Sample Code" Scenario: adding a range to a metric configuration When I follow "New Range" and wait @@ -35,8 +28,37 @@ Feature: Add range to a metric configuration | (*) Beginning: | 1 | | (*) End: | 10 | | (*) Grade: | 100 | - | (*) Color: | FFFF00FF | + | (*) Color: | FF00FF | | Comments: | Comentário | And I press "Save Range" and wait - And I should see "label" within "#ranges" + Then I should see "label" within "#ranges" + Scenario: adding a range with invalid beginning field + When I follow "New Range" and wait + And I fill in the following: + | (*) Label: | label | + | (*) Beginning: | teste | + | (*) End: | 10 | + | (*) Grade: | 100 | + | (*) Color: | FF00FF | + | Comments: | Comentário | + And I press "Save Range" and wait + Then I should see "Beginning, End and Grade must be numeric values." inside an alert + + Scenario: adding a range with beginning greater than end + When I follow "New Range" and wait + And I fill in the following: + | (*) Label: | label | + | (*) Beginning: | 100 | + | (*) End: | 10 | + | (*) Grade: | 100 | + | (*) Color: | FF00FF | + | Comments: | Comentário | + And I press "Save Range" and wait + Then I should see "End must be greater than Beginning." inside an alert + + Scenario: adding a range with no parameters + When I follow "New Range" and wait + And I dont't fill anything + And I press "Save Range" and wait + Then I should see "Please fill all fields marked with (*)." inside an alert -- libgit2 0.21.2