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 27  
28 28 Then /^I don't fill anything$/ do
29 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 8 | joaosilva | Joao Silva |
9 9 And I am logged in as "joaosilva"
10 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 13 | Title | My Configuration |
18 14 | Description | A sample description |
19 15  
... ... @@ -29,7 +25,7 @@ Feature: Add metric configuration to a configuration
29 25 Then I should see "Lines of Code"
30 26 And I should see "Analizo"
31 27 And I should see "Sample Code"
32   -
  28 +
33 29 Scenario: adding a native metric configuration without code
34 30 When I follow "Add metric"
35 31 And I follow "Analizo"
... ... @@ -39,7 +35,7 @@ Feature: Add metric configuration to a configuration
39 35 Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration"
40 36  
41 37 Scenario: adding a compound metric configuration
42   - When I follow "Add metric"
  38 + When I follow "Add Metric"
43 39 And I follow "New Compound Metric"
44 40 And I fill in the following:
45 41 | Name: | Compound sample |
... ... @@ -64,4 +60,4 @@ Feature: Add metric configuration to a configuration
64 60 And I select "Class" from "Scope:"
65 61 And I select "Average" from "Aggregation Form:"
66 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 8 | joaosilva | Joao Silva |
9 9 And I am logged in as "joaosilva"
10 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 13 | Title | My Configuration |
18 14 | Description | A sample description |
19   - And I follow "Add metric"
  15 + And I follow "Add Metric"
20 16 And I follow "Analizo"
21 17 And I follow "Lines of Code"
22 18 And I fill in the following:
... ... @@ -24,9 +20,6 @@ Feature: Add range to a metric configuration
24 20 | Weight: | 10.0 |
25 21 And I select "Average" from "Aggregation Form:"
26 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 24 Scenario: adding a range to a metric configuration
32 25 When I follow "New Range" and wait
... ... @@ -35,8 +28,37 @@ Feature: Add range to a metric configuration
35 28 | (*) Beginning: | 1 |
36 29 | (*) End: | 10 |
37 30 | (*) Grade: | 100 |
38   - | (*) Color: | FFFF00FF |
  31 + | (*) Color: | FF00FF |
39 32 | Comments: | Comentário |
40 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
... ...