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 | 74 | find_button(button_name).should be_nil |
75 | 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 | 78 | item = {} |
79 | 79 | fields.rows_hash.each do |name, value| |
80 | 80 | if(name=="user" or name=="community") |
... | ... | @@ -91,15 +91,26 @@ When /^I have a Mezuro (project|reading group|configuration|repository) with the |
91 | 91 | result = MezuroPlugin::ConfigurationContent.new(item) |
92 | 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 | 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 | 114 | end |
104 | 115 | |
105 | 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 | 121 | fields.rows_hash.each do |key, value| |
111 | 122 | name = key.to_s |
112 | 123 | element = find_field(name) |
113 | - if element.tag_name.to_s == "select" | |
124 | + if (element.tag_name.to_s == "select") | |
114 | 125 | select(value, :from => name) |
115 | 126 | else |
116 | 127 | element.set value |
... | ... | @@ -130,11 +141,28 @@ When /^I have a Mezuro metric configuration with previous created configuration |
130 | 141 | }) |
131 | 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 | 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 | 161 | action_link.click |
140 | 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 @@ |
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 | 26 | | description | Sample Description | |
27 | 27 | | user | joaosilva | |
28 | 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 | 30 | Scenario: I want to see the Mezuro repository input form |
31 | + Given I am on article "Sample Project" | |
32 | 32 | When I follow "Add Repository" |
33 | 33 | Then I should see "Name" |
34 | 34 | And I should see "Description" |
... | ... | @@ -41,7 +41,8 @@ Feature: Repository |
41 | 41 | |
42 | 42 | @selenium |
43 | 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 | 46 | When I fill the fields with the new following data |
46 | 47 | | repository_name | | |
47 | 48 | | repository_description | My Description | |
... | ... | @@ -55,7 +56,8 @@ Feature: Repository |
55 | 56 | |
56 | 57 | @selenium |
57 | 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 | 61 | When I fill the fields with the new following data |
60 | 62 | | repository_name | My Name | |
61 | 63 | | repository_description | My Description | |
... | ... | @@ -69,7 +71,8 @@ Feature: Repository |
69 | 71 | |
70 | 72 | @selenium |
71 | 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 | 76 | When I fill the fields with the new following data |
74 | 77 | | repository_name | My Name | |
75 | 78 | | repository_description | My Description | |
... | ... | @@ -83,7 +86,8 @@ Feature: Repository |
83 | 86 | |
84 | 87 | @selenium |
85 | 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 | 91 | When I fill the fields with the new following data |
88 | 92 | | repository_name | My Name | |
89 | 93 | | repository_description | My Description | |
... | ... | @@ -102,19 +106,17 @@ Feature: Repository |
102 | 106 | And I should see "Sample Configuration" |
103 | 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 | 110 | @selenium |
107 | 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 | 120 | And I am on article "Sample Project" |
119 | 121 | When I follow "Edit" |
120 | 122 | Then I should see "My Name" in the "repository_name" input |
... | ... | @@ -125,9 +127,9 @@ Feature: Repository |
125 | 127 | And I should see "https://github.com/user/project.git" in the "repository_address" input |
126 | 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 | 131 | @selenium |
130 | - Scenario: I edit a Mezuro project with valid attributes | |
132 | + Scenario: I edit a Mezuro repository with valid attributes | |
131 | 133 | Given I follow "Add Repository" |
132 | 134 | And I fill the fields with the new following data |
133 | 135 | | repository_name | My Name | |
... | ... | @@ -157,9 +159,9 @@ Feature: Repository |
157 | 159 | And I should see "https://project.svn.sourceforge.net/svnroot/project" |
158 | 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 | 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 | 165 | Given I follow "Add Repository" |
164 | 166 | And I fill the fields with the new following data |
165 | 167 | | repository_name | My Name | |
... | ... | @@ -176,9 +178,9 @@ Feature: Repository |
176 | 178 | And I press "Add" |
177 | 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 | 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 | 184 | Given I follow "Add Repository" |
183 | 185 | And I fill the fields with the new following data |
184 | 186 | | repository_name | My Name | |
... | ... | @@ -195,7 +197,7 @@ Feature: Repository |
195 | 197 | And I press "Add" |
196 | 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 | 201 | @selenium |
200 | 202 | Scenario: I try to edit a repository with an existing repository name |
201 | 203 | Given I follow "Add Repository" |
... | ... | @@ -248,5 +250,4 @@ Feature: Repository |
248 | 250 | And I press "Add" |
249 | 251 | And I am on article "Sample Project" |
250 | 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" | ... | ... |