Commit 37d94bf1de9b26728444ff26e884b232e65fcbdc

Authored by Diego Camarinha
Committed by Paulo Meireles
1 parent 2227335c

[Mezuro] Refactored some cucumber scenarios.

features/step_definitions/mezuro_steps.rb
@@ -27,3 +27,8 @@ end @@ -27,3 +27,8 @@ end
27 27
28 Then /^I don't fill anything$/ do 28 Then /^I don't fill anything$/ do
29 end 29 end
  30 +
  31 +Then /^I should see "([^\"]*)" inside an alert$/ do |message|
  32 + selenium.get_alert.should eql(message)
  33 + selenium.chooseOkOnNextConfirmation();
  34 +end
plugins/mezuro/test/features/adding_metric_configuration.feature
@@ -8,12 +8,8 @@ Feature: Add metric configuration to a configuration @@ -8,12 +8,8 @@ Feature: Add metric configuration to a configuration
8 | joaosilva | Joao Silva | 8 | joaosilva | Joao Silva |
9 And I am logged in as "joaosilva" 9 And I am logged in as "joaosilva"
10 And "Mezuro" plugin is enabled 10 And "Mezuro" plugin is enabled
11 - And the following community  
12 - | identifier | name |  
13 - | mycommunity | My Community |  
14 - And "Joao Silva" is admin of "My Community"  
15 - And I am on My Community's cms  
16 - And I create a content of type "Kalibro configuration" with the following data 11 + And I go to the Control panel
  12 + And I create a Mezuro configuration with the following data
17 | Title | My Configuration | 13 | Title | My Configuration |
18 | Description | A sample description | 14 | Description | A sample description |
19 15
@@ -29,7 +25,7 @@ Feature: Add metric configuration to a configuration @@ -29,7 +25,7 @@ Feature: Add metric configuration to a configuration
29 Then I should see "Lines of Code" 25 Then I should see "Lines of Code"
30 And I should see "Analizo" 26 And I should see "Analizo"
31 And I should see "Sample Code" 27 And I should see "Sample Code"
32 - 28 +
33 Scenario: adding a native metric configuration without code 29 Scenario: adding a native metric configuration without code
34 When I follow "Add metric" 30 When I follow "Add metric"
35 And I follow "Analizo" 31 And I follow "Analizo"
@@ -39,7 +35,7 @@ Feature: Add metric configuration to a configuration @@ -39,7 +35,7 @@ Feature: Add metric configuration to a configuration
39 Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" 35 Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration"
40 36
41 Scenario: adding a compound metric configuration 37 Scenario: adding a compound metric configuration
42 - When I follow "Add metric" 38 + When I follow "Add Metric"
43 And I follow "New Compound Metric" 39 And I follow "New Compound Metric"
44 And I fill in the following: 40 And I fill in the following:
45 | Name: | Compound sample | 41 | Name: | Compound sample |
@@ -64,4 +60,4 @@ Feature: Add metric configuration to a configuration @@ -64,4 +60,4 @@ Feature: Add metric configuration to a configuration
64 And I select "Class" from "Scope:" 60 And I select "Class" from "Scope:"
65 And I select "Average" from "Aggregation Form:" 61 And I select "Average" from "Aggregation Form:"
66 And I press "Add" 62 And I press "Add"
67 - Then I should see "Compound sample" 63 + Then I should see "Metric with invalid code or script: invalid script"
plugins/mezuro/test/features/adding_ranges.feature
@@ -8,15 +8,11 @@ Feature: Add range to a metric configuration @@ -8,15 +8,11 @@ Feature: Add range to a metric configuration
8 | joaosilva | Joao Silva | 8 | joaosilva | Joao Silva |
9 And I am logged in as "joaosilva" 9 And I am logged in as "joaosilva"
10 And "Mezuro" plugin is enabled 10 And "Mezuro" plugin is enabled
11 - And the following community  
12 - | identifier | name |  
13 - | mycommunity | My Community |  
14 - And "Joao Silva" is admin of "My Community"  
15 - And I am on My Community's cms  
16 - And I create a content of type "Kalibro configuration" with the following data 11 + And I go to the Control Panel
  12 + And I create a Mezuro configuration with the following data
17 | Title | My Configuration | 13 | Title | My Configuration |
18 | Description | A sample description | 14 | Description | A sample description |
19 - And I follow "Add metric" 15 + And I follow "Add Metric"
20 And I follow "Analizo" 16 And I follow "Analizo"
21 And I follow "Lines of Code" 17 And I follow "Lines of Code"
22 And I fill in the following: 18 And I fill in the following:
@@ -24,9 +20,6 @@ Feature: Add range to a metric configuration @@ -24,9 +20,6 @@ Feature: Add range to a metric configuration
24 | Weight: | 10.0 | 20 | Weight: | 10.0 |
25 And I select "Average" from "Aggregation Form:" 21 And I select "Average" from "Aggregation Form:"
26 And I press "Add" 22 And I press "Add"
27 - Then I should see "Lines of Code"  
28 - And I should see "Analizo"  
29 - And I should see "Sample Code"  
30 23
31 Scenario: adding a range to a metric configuration 24 Scenario: adding a range to a metric configuration
32 When I follow "New Range" and wait 25 When I follow "New Range" and wait
@@ -35,8 +28,37 @@ Feature: Add range to a metric configuration @@ -35,8 +28,37 @@ Feature: Add range to a metric configuration
35 | (*) Beginning: | 1 | 28 | (*) Beginning: | 1 |
36 | (*) End: | 10 | 29 | (*) End: | 10 |
37 | (*) Grade: | 100 | 30 | (*) Grade: | 100 |
38 - | (*) Color: | FFFF00FF | 31 + | (*) Color: | FF00FF |
39 | Comments: | Comentário | 32 | Comments: | Comentário |
40 And I press "Save Range" and wait 33 And I press "Save Range" and wait
41 - And I should see "label" within "#ranges" 34 + Then I should see "label" within "#ranges"
42 35
  36 + Scenario: adding a range with invalid beginning field
  37 + When I follow "New Range" and wait
  38 + And I fill in the following:
  39 + | (*) Label: | label |
  40 + | (*) Beginning: | teste |
  41 + | (*) End: | 10 |
  42 + | (*) Grade: | 100 |
  43 + | (*) Color: | FF00FF |
  44 + | Comments: | Comentário |
  45 + And I press "Save Range" and wait
  46 + Then I should see "Beginning, End and Grade must be numeric values." inside an alert
  47 +
  48 + Scenario: adding a range with beginning greater than end
  49 + When I follow "New Range" and wait
  50 + And I fill in the following:
  51 + | (*) Label: | label |
  52 + | (*) Beginning: | 100 |
  53 + | (*) End: | 10 |
  54 + | (*) Grade: | 100 |
  55 + | (*) Color: | FF00FF |
  56 + | Comments: | Comentário |
  57 + And I press "Save Range" and wait
  58 + Then I should see "End must be greater than Beginning." inside an alert
  59 +
  60 + Scenario: adding a range with no parameters
  61 + When I follow "New Range" and wait
  62 + And I dont't fill anything
  63 + And I press "Save Range" and wait
  64 + Then I should see "Please fill all fields marked with (*)." inside an alert