Merge pull request #505 from opf/feature/comparison-cukes

pull/485/merge
Hagen Schink 11 years ago
commit 55e4cb2622
  1. 1
      doc/CHANGELOG.md
  2. 41
      features/step_definitions/timelines_comparison_steps.rb
  3. 4
      features/timelines/timeline_comparison_view.feature

@ -32,6 +32,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#1991` Migrate text references to issues/planning elements
* `#2304` Introduce keyboard shortcuts
* `#2334` Deselecting all types in project configuration creates 500
* `#2336` Cukes for timelines start/end date comparison
* `#2386` Remove timelines_journals_helper
* Allow using environment variables instead of configuration.yml

@ -26,6 +26,10 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
def getWPRowByName(name)
find("a", :text => name).find(:xpath, "./ancestor::tr")
end
Given(/^there are the following work packages were added "(.*?)"(?: in project "([^"]*)")?:$/) do |time, project_name, table|
project = get_project(project_name)
@ -36,12 +40,9 @@ Given(/^there are the following work packages were added "(.*?)"(?: in project "
else
target_time = Time.now
end
Timecop.travel(target_time)
create_work_packages_from_table table, project
# Ensure timecop returns after each scenario
Support::ResetTimecop.reset_after
Timecop.freeze(target_time) do
create_work_packages_from_table table, project
end
end
Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, table|
@ -56,17 +57,17 @@ Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, tabl
else
target_time = Time.now
end
Timecop.travel(target_time)
#TODO provide generic support for all possible values.
work_package = WorkPackage.find_by_subject(name)
work_package.subject = table.hashes.first[:subject]
work_package.start_date = table.hashes.first[:start_date]
work_package.due_date = table.hashes.first[:due_date]
work_package.save!
Timecop.freeze(target_time) do
# Ensure timecop returns after each scenario
Support::ResetTimecop.reset_after
#TODO provide generic support for all possible values.
work_package = WorkPackage.find_by_subject(name)
work_package.subject = table.hashes.first[:subject]
work_package.start_date = table.hashes.first[:start_date]
work_package.due_date = table.hashes.first[:due_date]
work_package.save!
end
end
When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time|
@ -81,12 +82,14 @@ When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time|
page.execute_script("jQuery('#content form').submit()")
end
Then(/^I should see the work package "(.*?)" has not moved$/) do |arg1|
pending # express the regexp above with the code you wish you had
Then(/^I should see the work package "(.*?)" has not moved$/) do |name|
row = getWPRowByName(name)
row.should_not have_selector(".tl-icon-changed");
end
Then(/^I should see the work package "(.*?)" has moved$/) do |arg1|
pending # express the regexp above with the code you wish you had
Then(/^I should see the work package "(.*?)" has moved$/) do |name|
row = getWPRowByName(name)
row.should have_selector(".tl-icon-changed");
end
Then(/^I should not see the work package "(.*?)"$/) do |arg1|

@ -67,7 +67,7 @@ Feature: Timeline Comparison View Tests
And I wait for timeline to load table
Then I should see the work package "May" has not moved
And I should see the work package "February" has moved
And I should not see the work package "January"
And I should not see the work package "January" in the timeline
@javascript
Scenario: sixteen days comparison
@ -78,4 +78,4 @@ Feature: Timeline Comparison View Tests
And I wait for timeline to load table
Then I should see the work package "May" has moved
And I should see the work package "February" has moved
And I should not see the work package "January"
And I should not see the work package "January" in the timeline
Loading…
Cancel
Save