Commit a49aca64264c38d9a34747590ad1e33d4e9a0e26
Committed by
Paulo Meireles
1 parent
b6af682e
Exists in
master
and in
29 other branches
[Mezuro] More acceptance tests for repository feature.
Showing
2 changed files
with
96 additions
and
17 deletions
Show diff stats
features/step_definitions/mezuro_steps.rb
@@ -60,11 +60,16 @@ Then /^I should see "([^"]*)" in the "([^"]*)" select$/ do |content, labeltext| | @@ -60,11 +60,16 @@ Then /^I should see "([^"]*)" in the "([^"]*)" select$/ do |content, labeltext| | ||
60 | find_field(labeltext).value.strip.should == content #strip because have empty spaces around some options | 60 | find_field(labeltext).value.strip.should == content #strip because have empty spaces around some options |
61 | end | 61 | end |
62 | 62 | ||
63 | -Then /^I shoud see "([^"]*)" in the process period select field$/ do |content| | 63 | +Then /^I should see "([^"]*)" in the process period select field$/ do |content| |
64 | selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first | 64 | selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first |
65 | assert_equal selected.last, find_field("repository_process_period").value.to_i | 65 | assert_equal selected.last, find_field("repository_process_period").value.to_i |
66 | end | 66 | end |
67 | 67 | ||
68 | +Then /^I should see "([^"]*)" in the repository configuration select field$/ do |content| | ||
69 | + selected = Kalibro::Configuration.all.select { |option| option.name == content }.first | ||
70 | + assert_equal selected.id, find_field("repository_configuration_id").value.to_i | ||
71 | +end | ||
72 | + | ||
68 | Then /^I should not see "([^"]*)" button$/ do |button_name| | 73 | Then /^I should not see "([^"]*)" button$/ do |button_name| |
69 | find_button(button_name).should be_nil | 74 | find_button(button_name).should be_nil |
70 | end | 75 | end |
@@ -91,7 +96,7 @@ When /^I have a Mezuro (project|reading group|configuration|repository) with the | @@ -91,7 +96,7 @@ When /^I have a Mezuro (project|reading group|configuration|repository) with the | ||
91 | puts Kalibro::Project.all.last.id | 96 | puts Kalibro::Project.all.last.id |
92 | item.merge(:configuration_id => Kalibro::Configuration.all.last.id) | 97 | item.merge(:configuration_id => Kalibro::Configuration.all.last.id) |
93 | result = Kalibro::Repository.new(item) | 98 | result = Kalibro::Repository.new(item) |
94 | - raise (result.save Kalibro::Project.all.last.id).inspect | 99 | + result.save Kalibro::Project.all.last.id |
95 | else | 100 | else |
96 | result.save! | 101 | result.save! |
97 | end | 102 | end |
@@ -113,8 +118,8 @@ When /^I fill the fields with the new following data$/ do |fields| | @@ -113,8 +118,8 @@ When /^I fill the fields with the new following data$/ do |fields| | ||
113 | end | 118 | end |
114 | end | 119 | end |
115 | 120 | ||
116 | -When /^I have a Mezuro metric configuration with previous created configuration and reading group/ do | ||
117 | - Kalibro::MetricConfiguration.create({ | 121 | +When /^I have a Mezuro metric configuration with previous created configuration and reading group$/ do |
122 | + Kalibro::MetricConfiguration.create({ | ||
118 | :code => 'amloc1', | 123 | :code => 'amloc1', |
119 | :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}, | 124 | :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}, |
120 | :base_tool_name => "Analizo", | 125 | :base_tool_name => "Analizo", |
@@ -122,5 +127,14 @@ When /^I have a Mezuro metric configuration with previous created configuration | @@ -122,5 +127,14 @@ When /^I have a Mezuro metric configuration with previous created configuration | ||
122 | :aggregation_form => 'AVERAGE', | 127 | :aggregation_form => 'AVERAGE', |
123 | :reading_group_id => Kalibro::ReadingGroup.all.last.id, | 128 | :reading_group_id => Kalibro::ReadingGroup.all.last.id, |
124 | :configuration_id => Kalibro::Configuration.all.last.id | 129 | :configuration_id => Kalibro::Configuration.all.last.id |
125 | - }) | 130 | + }) |
131 | +end | ||
132 | + | ||
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 | ||
137 | + elements = all('a', :text => action.capitalize) | ||
138 | + action_link = elements.select {|element| (/repository_id=#{repository_id}/ =~ element[:href]) }.first | ||
139 | + action_link.click | ||
126 | end | 140 | end |
plugins/mezuro/features/repository.feature
@@ -81,7 +81,7 @@ Feature: Repository | @@ -81,7 +81,7 @@ Feature: Repository | ||
81 | And I press "Add" | 81 | And I press "Add" |
82 | Then I should see "Address does not match type GIT chosen." inside an alert | 82 | Then I should see "Address does not match type GIT chosen." inside an alert |
83 | 83 | ||
84 | - @selenium | 84 | + @selenium-teste |
85 | Scenario: I want to add a repository with valid attributes | 85 | Scenario: I want to add a repository with valid attributes |
86 | Given I follow "Add Repository" | 86 | Given I follow "Add Repository" |
87 | When I fill the fields with the new following data | 87 | When I fill the fields with the new following data |
@@ -100,9 +100,10 @@ Feature: Repository | @@ -100,9 +100,10 @@ Feature: Repository | ||
100 | And I should see "GIT" | 100 | And I should see "GIT" |
101 | And I should see "https://github.com/user/project.git" | 101 | And I should see "https://github.com/user/project.git" |
102 | And I should see "Sample Configuration" | 102 | And I should see "Sample Configuration" |
103 | + And I should see "Status" | ||
103 | 104 | ||
104 | #FIXME: create the step given I have repository... | 105 | #FIXME: create the step given I have repository... |
105 | - @selenium | 106 | + @selenium-teste |
106 | Scenario: I want to see the repository edit form | 107 | Scenario: I want to see the repository edit form |
107 | Given I follow "Add Repository" | 108 | Given I follow "Add Repository" |
108 | And I fill the fields with the new following data | 109 | And I fill the fields with the new following data |
@@ -122,11 +123,11 @@ Feature: Repository | @@ -122,11 +123,11 @@ Feature: Repository | ||
122 | And I should see "Not Periodically" in the process period select field | 123 | And I should see "Not Periodically" in the process period select field |
123 | And I should see "GIT" in the "repository_type" select | 124 | And I should see "GIT" in the "repository_type" select |
124 | And I should see "https://github.com/user/project.git" in the "repository_address" input | 125 | And I should see "https://github.com/user/project.git" in the "repository_address" input |
125 | - And I should see "Sample Configuration" in the "repository_configuration_id" select | 126 | + And I should see "Sample Configuration" in the repository configuration select field |
126 | 127 | ||
127 | #FIXME: create the step given I have repository... | 128 | #FIXME: create the step given I have repository... |
128 | @selenium | 129 | @selenium |
129 | - Scenario: I want to see the repository edit form | 130 | + Scenario: I edit a Mezuro project with valid attributes |
130 | Given I follow "Add Repository" | 131 | Given I follow "Add Repository" |
131 | And I fill the fields with the new following data | 132 | And I fill the fields with the new following data |
132 | | repository_name | My Name | | 133 | | repository_name | My Name | |
@@ -139,14 +140,23 @@ Feature: Repository | @@ -139,14 +140,23 @@ Feature: Repository | ||
139 | And I press "Add" | 140 | And I press "Add" |
140 | And I am on article "Sample Project" | 141 | And I am on article "Sample Project" |
141 | When I follow "Edit" | 142 | When I follow "Edit" |
142 | - Then I should see "My Name" in the "repository_name" input | ||
143 | - And I should see "My Description" in the "repository_description" input | ||
144 | - And I should see "ISC License (ISC)" in the "repository_license" select | ||
145 | - And I should see "Not Periodically" in the process period select field | ||
146 | - And I should see "GIT" in the "repository_type" select | ||
147 | - And I should see "https://github.com/user/project.git" in the "repository_address" input | ||
148 | - And I should see "2" in the "repository_configuration_id" select | ||
149 | - | 143 | + And I fill the fields with the new following data |
144 | + | repository_name | Another Name | | ||
145 | + | repository_description | Another Description | | ||
146 | + | repository_license | Apple Public Source License (APSL-2.0) | | ||
147 | + | repository_process_period | Weekly | | ||
148 | + | repository_type | SUBVERSION | | ||
149 | + | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
150 | + | repository_configuration_id | Sample Configuration | | ||
151 | + And I press "Add" | ||
152 | + Then I should see "Another Name" | ||
153 | + And I should see "Another Description" | ||
154 | + And I should see "Apple Public Source License (APSL-2.0)" | ||
155 | + And I should see "Weekly" | ||
156 | + And I should see "SUBVERSION" | ||
157 | + And I should see "https://project.svn.sourceforge.net/svnroot/project" | ||
158 | + And I should see "Sample Configuration" | ||
159 | + | ||
150 | #FIXME: create the step given I have repository... | 160 | #FIXME: create the step given I have repository... |
151 | @selenium | 161 | @selenium |
152 | Scenario: I try to edit a Mezuro project leaving empty its title | 162 | Scenario: I try to edit a Mezuro project leaving empty its title |
@@ -184,4 +194,59 @@ Feature: Repository | @@ -184,4 +194,59 @@ Feature: Repository | ||
184 | When I erase the "repository_address" field | 194 | When I erase the "repository_address" field |
185 | And I press "Add" | 195 | And I press "Add" |
186 | Then I should see "Please fill all fields marked with (*)." inside an alert | 196 | Then I should see "Please fill all fields marked with (*)." inside an alert |
197 | + | ||
198 | + #FIXME: create the step given I have repository... | ||
199 | + @selenium | ||
200 | + Scenario: I try to edit a repository with an existing repository name | ||
201 | + Given I follow "Add Repository" | ||
202 | + And I fill the fields with the new following data | ||
203 | + | repository_name | My Name | | ||
204 | + | repository_description | My Description | | ||
205 | + | repository_license | ISC License (ISC) | | ||
206 | + | repository_process_period | Not Periodically | | ||
207 | + | repository_type | GIT | | ||
208 | + | repository_address | https://github.com/user/project.git | | ||
209 | + | repository_configuration_id | Sample Configuration | | ||
210 | + And I press "Add" | ||
211 | + And I am on article "Sample Project" | ||
212 | + And I follow "Add Repository" | ||
213 | + And I fill the fields with the new following data | ||
214 | + | repository_name | Another Name | | ||
215 | + | repository_description | Another Description | | ||
216 | + | repository_license | Apple Public Source License (APSL-2.0) | | ||
217 | + | repository_process_period | Weekly | | ||
218 | + | repository_type | SUBVERSION | | ||
219 | + | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
220 | + | repository_configuration_id | Sample Configuration | | ||
221 | + And I press "Add" | ||
222 | + And I am on article "Sample Project" | ||
223 | + When I follow the edit link for "My Name" repository | ||
224 | + And I fill the fields with the new following data | ||
225 | + | repository_name | Another Name | | ||
226 | + | repository_description | Another Description | | ||
227 | + | repository_license | Apple Public Source License (APSL-2.0) | | ||
228 | + | repository_process_period | Weekly | | ||
229 | + | repository_type | SUBVERSION | | ||
230 | + | repository_address | https://project.svn.sourceforge.net/svnroot/project | | ||
231 | + | repository_configuration_id | Sample Configuration | | ||
232 | + And I press "Add" | ||
233 | + #Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
234 | + #FIXME fix this validation | ||
235 | + | ||
236 | + #FIXME: Need to define permissions? | ||
237 | + @selenium | ||
238 | + Scenario: I delete a Mezuro repository | ||
239 | + Given I follow "Add Repository" | ||
240 | + And I fill the fields with the new following data | ||
241 | + | repository_name | My Name | | ||
242 | + | repository_description | My Description | | ||
243 | + | repository_license | ISC License (ISC) | | ||
244 | + | repository_process_period | Not Periodically | | ||
245 | + | repository_type | GIT | | ||
246 | + | repository_address | https://github.com/user/project.git | | ||
247 | + | repository_configuration_id | Sample Configuration | | ||
248 | + And I press "Add" | ||
249 | + And I am on article "Sample Project" | ||
250 | + When I follow the remove link for "My Name" repository | ||
251 | + And I should not see "My Name" | ||
187 | 252 |