Commit 1e31a204c0226267c55d7791cb50fd8a71f60e91
Committed by
Paulo Meireles
1 parent
e7dafeeb
Exists in
master
and in
29 other branches
[Mezuro] Updating acceptance tests.
Showing
3 changed files
with
154 additions
and
40 deletions
Show diff stats
features/step_definitions/mezuro_steps.rb
@@ -74,7 +74,7 @@ Then /^I should not see "([^"]*)" button$/ do |button_name| | @@ -74,7 +74,7 @@ Then /^I should not see "([^"]*)" button$/ do |button_name| | ||
74 | find_button(button_name).should be_nil | 74 | find_button(button_name).should be_nil |
75 | end | 75 | end |
76 | 76 | ||
77 | -When /^I have a Mezuro (project|reading group|configuration|repository) with the following data$/ do |type,fields| | 77 | +When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type, fields| |
78 | item = {} | 78 | item = {} |
79 | fields.rows_hash.each do |name, value| | 79 | fields.rows_hash.each do |name, value| |
80 | if(name=="user" or name=="community") | 80 | if(name=="user" or name=="community") |
@@ -91,15 +91,26 @@ When /^I have a Mezuro (project|reading group|configuration|repository) with the | @@ -91,15 +91,26 @@ When /^I have a Mezuro (project|reading group|configuration|repository) with the | ||
91 | result = MezuroPlugin::ConfigurationContent.new(item) | 91 | result = MezuroPlugin::ConfigurationContent.new(item) |
92 | end | 92 | end |
93 | 93 | ||
94 | + result.save! | ||
95 | +end | ||
96 | + | ||
97 | +When /^I have a Mezuro (reading|repository) with the following data$/ do |type, fields| | ||
98 | + item = {} | ||
99 | + fields.rows_hash.each do |name, value| | ||
100 | + if(name=="user" or name=="community") | ||
101 | + item.merge!(:profile=>Profile[value]) | ||
102 | + else | ||
103 | + item.merge!(name => value) | ||
104 | + end | ||
105 | + end | ||
94 | if (type == "repository") | 106 | if (type == "repository") |
95 | - puts Kalibro::Configuration.all.last.id | ||
96 | - puts Kalibro::Project.all.last.id | ||
97 | - item.merge(:configuration_id => Kalibro::Configuration.all.last.id) | ||
98 | - result = Kalibro::Repository.new(item) | ||
99 | - result.save Kalibro::Project.all.last.id | ||
100 | - else | ||
101 | - result.save! | ||
102 | - end | 107 | + item.merge!(:configuration_id => Kalibro::Configuration.all.last.id) |
108 | + item.merge!(:project_id => Kalibro::Project.all.last.id) | ||
109 | + Kalibro::Repository.create(item) | ||
110 | + elsif (type == "reading") | ||
111 | + item.merge!(:group_id => Kalibro::ReadingGroup.all.last.id) | ||
112 | + Kalibro::Reading.create(item) | ||
113 | + end | ||
103 | end | 114 | end |
104 | 115 | ||
105 | When /^I erase the "([^"]*)" field$/ do |field_name| | 116 | When /^I erase the "([^"]*)" field$/ do |field_name| |
@@ -110,7 +121,7 @@ When /^I fill the fields with the new following data$/ do |fields| | @@ -110,7 +121,7 @@ When /^I fill the fields with the new following data$/ do |fields| | ||
110 | fields.rows_hash.each do |key, value| | 121 | fields.rows_hash.each do |key, value| |
111 | name = key.to_s | 122 | name = key.to_s |
112 | element = find_field(name) | 123 | element = find_field(name) |
113 | - if element.tag_name.to_s == "select" | 124 | + if (element.tag_name.to_s == "select") |
114 | select(value, :from => name) | 125 | select(value, :from => name) |
115 | else | 126 | else |
116 | element.set value | 127 | element.set value |
@@ -130,11 +141,28 @@ When /^I have a Mezuro metric configuration with previous created configuration | @@ -130,11 +141,28 @@ When /^I have a Mezuro metric configuration with previous created configuration | ||
130 | }) | 141 | }) |
131 | end | 142 | end |
132 | 143 | ||
133 | -When /^I follow the (edit|remove) link for "([^"]*)" repository$/ do |action,repository_name| | ||
134 | - project_id = Kalibro::Project.all.last.id | ||
135 | - repositories = Kalibro::Repository.repositories_of project_id | ||
136 | - repository_id = repositories.select {|option| option.name == repository_name}.first.id | 144 | +When /^I follow the (edit|remove) link for "([^"]*)" (repository|reading)$/ do |action, name, type| |
145 | + if (type == "repository") | ||
146 | + project_id = Kalibro::Project.all.last.id | ||
147 | + repositories = Kalibro::Repository.repositories_of project_id | ||
148 | + id = repositories.select {|option| option.name == name}.first.id | ||
149 | + elsif (type == "reading") | ||
150 | + reading_group_id = Kalibro::ReadingGroup.all.last.id | ||
151 | + readings = Kalibro::Reading.readings_of reading_group_id | ||
152 | + id = readings.select {|option| option.label == name}.first.id | ||
153 | + if (action == "edit") | ||
154 | + action = name | ||
155 | + end | ||
156 | + end | ||
157 | + | ||
137 | elements = all('a', :text => action.capitalize) | 158 | elements = all('a', :text => action.capitalize) |
138 | - action_link = elements.select {|element| (/repository_id=#{repository_id}/ =~ element[:href]) }.first | 159 | + link = type + "_id" |
160 | + action_link = elements.select {|element| (/#{link}=#{id}/ =~ element[:href]) }.first | ||
139 | action_link.click | 161 | action_link.click |
140 | end | 162 | end |
163 | + | ||
164 | +Then /^I should see the "([^"]*)" color$/ do |color_name| | ||
165 | + elements = all('td', :text => "") | ||
166 | + found = elements.select { |element| color_name == element[:bgcolor]}.first | ||
167 | + assert_not_nil found | ||
168 | +end |
@@ -0,0 +1,85 @@ | @@ -0,0 +1,85 @@ | ||
1 | +@kalibro_restart | ||
2 | +Feature: Reading | ||
3 | + As a Mezuro user | ||
4 | + I want to create, edit and remove a reading | ||
5 | + | ||
6 | + Background: | ||
7 | + Given the following users | ||
8 | + | login | name | | ||
9 | + | joaosilva | Joao Silva | | ||
10 | + And I am logged in as "joaosilva" | ||
11 | + And "Mezuro" plugin is enabled | ||
12 | + And I have a Mezuro reading group with the following data | ||
13 | + | name | Sample Reading Group | | ||
14 | + | description | Sample Description | | ||
15 | + | user | joaosilva | | ||
16 | + | ||
17 | + @selenium | ||
18 | + Scenario: I want to see the Mezuro reading input form | ||
19 | + Given I am on article "Sample Reading Group" | ||
20 | + When I follow "Add Reading" | ||
21 | + Then I should see "Sample Reading Group Reading Group" in a link | ||
22 | + And I should see "Label" | ||
23 | + And I should see "Grade" | ||
24 | + And I should see "Color" | ||
25 | + And I should see "Save" button | ||
26 | + | ||
27 | + @selenium | ||
28 | + Scenario: I try to add a reading with no name | ||
29 | + Given I am on article "Sample Reading Group" | ||
30 | + When I follow "Add Reading" | ||
31 | + And I fill the fields with the new following data | ||
32 | + | reading_label | | | ||
33 | + | reading_grade | 10.2 | | ||
34 | + | reading_color | ABCDEF | | ||
35 | + And I press "Save" | ||
36 | + Then I should see "Please fill all fields marked with (*)." inside an alert | ||
37 | + | ||
38 | + @selenium | ||
39 | + Scenario: I try to add a reading with no grade | ||
40 | + Given I am on article "Sample Reading Group" | ||
41 | + When I follow "Add Reading" | ||
42 | + And I fill the fields with the new following data | ||
43 | + | reading_label | Useless | | ||
44 | + | reading_grade | | | ||
45 | + | reading_color | f51313 | | ||
46 | + And I press "Save" | ||
47 | + Then I should see "Please fill all fields marked with (*)." inside an alert | ||
48 | + | ||
49 | + @selenium | ||
50 | + Scenario: I try to add a reading with no color | ||
51 | + Given I am on article "Sample Reading Group" | ||
52 | + When I follow "Add Reading" | ||
53 | + And I fill the fields with the new following data | ||
54 | + | reading_label | Fantastic | | ||
55 | + | reading_grade | 4.0 | | ||
56 | + | reading_color | | | ||
57 | + And I press "Save" | ||
58 | + Then I should see "Please fill all fields marked with (*)." inside an alert | ||
59 | + | ||
60 | + @selenium | ||
61 | + Scenario: I want to add a reading with no color | ||
62 | + Given I am on article "Sample Reading Group" | ||
63 | + When I follow "Add Reading" | ||
64 | + And I fill the fields with the new following data | ||
65 | + | reading_label | Normal | | ||
66 | + | reading_grade | 1.0 | | ||
67 | + | reading_color | 19cbd1 | | ||
68 | + And I press "Save" | ||
69 | + Then I should see "Normal" | ||
70 | + And I should see "1.0" | ||
71 | + And I should see the "#19cbd1" color | ||
72 | + And I should see "Remove" | ||
73 | + | ||
74 | + @selenium | ||
75 | + Scenario: I want to see a reading edit form | ||
76 | + Given I have a Mezuro reading with the following data | ||
77 | + | label | Simple | | ||
78 | + | grade | 2.0 | | ||
79 | + | color | 34afe2 | | ||
80 | + And I am on article "Sample Reading Group" | ||
81 | + When I follow the edit link for "Simple" reading | ||
82 | + Then I should see "Simple" in the "reading_label" input | ||
83 | + And I should see "2.0" in the "reading_grade" input | ||
84 | + And I should see "34afe2" in the "reading_color" input | ||
85 | + And I should see "Save" button |
plugins/mezuro/features/repository.feature
@@ -26,9 +26,9 @@ Feature: Repository | @@ -26,9 +26,9 @@ Feature: Repository | ||
26 | | description | Sample Description | | 26 | | description | Sample Description | |
27 | | user | joaosilva | | 27 | | user | joaosilva | |
28 | And I have a Mezuro metric configuration with previous created configuration and reading group | 28 | And I have a Mezuro metric configuration with previous created configuration and reading group |
29 | - And I am on article "Sample Project" | ||
30 | 29 | ||
31 | Scenario: I want to see the Mezuro repository input form | 30 | Scenario: I want to see the Mezuro repository input form |
31 | + Given I am on article "Sample Project" | ||
32 | When I follow "Add Repository" | 32 | When I follow "Add Repository" |
33 | Then I should see "Name" | 33 | Then I should see "Name" |
34 | And I should see "Description" | 34 | And I should see "Description" |
@@ -41,7 +41,8 @@ Feature: Repository | @@ -41,7 +41,8 @@ Feature: Repository | ||
41 | 41 | ||
42 | @selenium | 42 | @selenium |
43 | Scenario: I try to add a repository with no name | 43 | Scenario: I try to add a repository with no name |
44 | - Given I follow "Add Repository" | 44 | + Given I am on article "Sample Project" |
45 | + And I follow "Add Repository" | ||
45 | When I fill the fields with the new following data | 46 | When I fill the fields with the new following data |
46 | | repository_name | | | 47 | | repository_name | | |
47 | | repository_description | My Description | | 48 | | repository_description | My Description | |
@@ -55,7 +56,8 @@ Feature: Repository | @@ -55,7 +56,8 @@ Feature: Repository | ||
55 | 56 | ||
56 | @selenium | 57 | @selenium |
57 | Scenario: I try to add a repository with no address | 58 | Scenario: I try to add a repository with no address |
58 | - Given I follow "Add Repository" | 59 | + Given I am on article "Sample Project" |
60 | + And I follow "Add Repository" | ||
59 | When I fill the fields with the new following data | 61 | When I fill the fields with the new following data |
60 | | repository_name | My Name | | 62 | | repository_name | My Name | |
61 | | repository_description | My Description | | 63 | | repository_description | My Description | |
@@ -69,7 +71,8 @@ Feature: Repository | @@ -69,7 +71,8 @@ Feature: Repository | ||
69 | 71 | ||
70 | @selenium | 72 | @selenium |
71 | Scenario: I try to add a repository with a invalid address | 73 | Scenario: I try to add a repository with a invalid address |
72 | - Given I follow "Add Repository" | 74 | + Given I am on article "Sample Project" |
75 | + And I follow "Add Repository" | ||
73 | When I fill the fields with the new following data | 76 | When I fill the fields with the new following data |
74 | | repository_name | My Name | | 77 | | repository_name | My Name | |
75 | | repository_description | My Description | | 78 | | repository_description | My Description | |
@@ -83,7 +86,8 @@ Feature: Repository | @@ -83,7 +86,8 @@ Feature: Repository | ||
83 | 86 | ||
84 | @selenium | 87 | @selenium |
85 | Scenario: I want to add a repository with valid attributes | 88 | Scenario: I want to add a repository with valid attributes |
86 | - Given I follow "Add Repository" | 89 | + Given I am on article "Sample Project" |
90 | + And I follow "Add Repository" | ||
87 | When I fill the fields with the new following data | 91 | When I fill the fields with the new following data |
88 | | repository_name | My Name | | 92 | | repository_name | My Name | |
89 | | repository_description | My Description | | 93 | | repository_description | My Description | |
@@ -102,19 +106,17 @@ Feature: Repository | @@ -102,19 +106,17 @@ Feature: Repository | ||
102 | And I should see "Sample Configuration" | 106 | And I should see "Sample Configuration" |
103 | And I should see "Status" | 107 | And I should see "Status" |
104 | 108 | ||
105 | - #FIXME: create the step given I have repository... | 109 | + #FIXME: Check the new rule "I have a Mezuro repository" |
106 | @selenium | 110 | @selenium |
107 | Scenario: I want to see the repository edit form | 111 | Scenario: I want to see the repository edit form |
108 | - Given I follow "Add Repository" | ||
109 | - And I fill the fields with the new following data | ||
110 | - | repository_name | My Name | | ||
111 | - | repository_description | My Description | | ||
112 | - | repository_license | ISC License (ISC) | | ||
113 | - | repository_process_period | Not Periodically | | ||
114 | - | repository_type | GIT | | ||
115 | - | repository_address | https://github.com/user/project.git | | ||
116 | - | repository_configuration_id | Sample Configuration | | ||
117 | - And I press "Add" | 112 | + Given I have a Mezuro repository with the following data |
113 | + | name | My Name | | ||
114 | + | description | My Description | | ||
115 | + | license | ISC License (ISC) | | ||
116 | + | process_period | Not Periodically | | ||
117 | + | type | GIT | | ||
118 | + | address | https://github.com/user/project.git | | ||
119 | + | configuration_id | Sample Configuration | | ||
118 | And I am on article "Sample Project" | 120 | And I am on article "Sample Project" |
119 | When I follow "Edit" | 121 | When I follow "Edit" |
120 | Then I should see "My Name" in the "repository_name" input | 122 | Then I should see "My Name" in the "repository_name" input |
@@ -125,9 +127,9 @@ Feature: Repository | @@ -125,9 +127,9 @@ Feature: Repository | ||
125 | And I should see "https://github.com/user/project.git" in the "repository_address" input | 127 | And I should see "https://github.com/user/project.git" in the "repository_address" input |
126 | And I should see "Sample Configuration" in the repository configuration select field | 128 | And I should see "Sample Configuration" in the repository configuration select field |
127 | 129 | ||
128 | - #FIXME: create the step given I have repository... | 130 | + #FIXME: Check the new rule "I have a Mezuro repository" |
129 | @selenium | 131 | @selenium |
130 | - Scenario: I edit a Mezuro project with valid attributes | 132 | + Scenario: I edit a Mezuro repository with valid attributes |
131 | Given I follow "Add Repository" | 133 | Given I follow "Add Repository" |
132 | And I fill the fields with the new following data | 134 | And I fill the fields with the new following data |
133 | | repository_name | My Name | | 135 | | repository_name | My Name | |
@@ -157,9 +159,9 @@ Feature: Repository | @@ -157,9 +159,9 @@ Feature: Repository | ||
157 | And I should see "https://project.svn.sourceforge.net/svnroot/project" | 159 | And I should see "https://project.svn.sourceforge.net/svnroot/project" |
158 | And I should see "Sample Configuration" | 160 | And I should see "Sample Configuration" |
159 | 161 | ||
160 | - #FIXME: create the step given I have repository... | 162 | + #FIXME: Check the new rule "I have a Mezuro repository" |
161 | @selenium | 163 | @selenium |
162 | - Scenario: I try to edit a Mezuro project leaving empty its title | 164 | + Scenario: I try to edit a Mezuro repository leaving empty its title |
163 | Given I follow "Add Repository" | 165 | Given I follow "Add Repository" |
164 | And I fill the fields with the new following data | 166 | And I fill the fields with the new following data |
165 | | repository_name | My Name | | 167 | | repository_name | My Name | |
@@ -176,9 +178,9 @@ Feature: Repository | @@ -176,9 +178,9 @@ Feature: Repository | ||
176 | And I press "Add" | 178 | And I press "Add" |
177 | Then I should see "Please fill all fields marked with (*)." inside an alert | 179 | Then I should see "Please fill all fields marked with (*)." inside an alert |
178 | 180 | ||
179 | - #FIXME: create the step given I have repository... | 181 | + #FIXME: Check the new rule "I have a Mezuro repository" |
180 | @selenium | 182 | @selenium |
181 | - Scenario: I try to edit a Mezuro project leaving empty its address | 183 | + Scenario: I try to edit a Mezuro repository leaving empty its address |
182 | Given I follow "Add Repository" | 184 | Given I follow "Add Repository" |
183 | And I fill the fields with the new following data | 185 | And I fill the fields with the new following data |
184 | | repository_name | My Name | | 186 | | repository_name | My Name | |
@@ -195,7 +197,7 @@ Feature: Repository | @@ -195,7 +197,7 @@ Feature: Repository | ||
195 | And I press "Add" | 197 | And I press "Add" |
196 | Then I should see "Please fill all fields marked with (*)." inside an alert | 198 | Then I should see "Please fill all fields marked with (*)." inside an alert |
197 | 199 | ||
198 | - #FIXME: create the step given I have repository... | 200 | + #FIXME: Check the new rule "I have a Mezuro repository" |
199 | @selenium | 201 | @selenium |
200 | Scenario: I try to edit a repository with an existing repository name | 202 | Scenario: I try to edit a repository with an existing repository name |
201 | Given I follow "Add Repository" | 203 | Given I follow "Add Repository" |
@@ -248,5 +250,4 @@ Feature: Repository | @@ -248,5 +250,4 @@ Feature: Repository | ||
248 | And I press "Add" | 250 | And I press "Add" |
249 | And I am on article "Sample Project" | 251 | And I am on article "Sample Project" |
250 | When I follow the remove link for "My Name" repository | 252 | When I follow the remove link for "My Name" repository |
251 | - And I should not see "My Name" | ||
252 | - | 253 | + Then I should not see "My Name" |