get timeline rows and cells. test status.

pull/513/head
Nils Kenneweg 11 years ago
parent 7b1a6e2925
commit 8c80bbfa06
  1. 51
      features/step_definitions/timelines_comparison_steps.rb
  2. 26
      features/timelines/timeline_comparison_view.feature

@ -26,10 +26,33 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
def getWPRowByName(name)
def get_timeline_row_by_name(name)
find("a", :text => name).find(:xpath, "./ancestor::tr")
end
def get_timeline_cell(name, valueName)
wpRow = get_timeline_row_by_name(name)
index = get_timelines_row_number_by_name(valueName)
wpRow.all(:xpath, "./td")[index]
end
def get_timelines_row_number_by_name(name)
result = -1
th = find("table.tl-main-table").find(:xpath, "./thead/tr/th[text()='#{name}']")
ths = find("table.tl-main-table").all(:xpath, "./thead/tr/th")
for i in 0..ths.length do
if ths[i] == th then
result = i
break
end
end
result
end
Given(/^there are the following work packages were added "(.*?)"(?: in project "([^"]*)")?:$/) do |time, project_name, table|
project = get_project(project_name)
@ -54,18 +77,20 @@ Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, tabl
target_time = 1.weeks.ago
when "two weeks ago"
target_time = 2.weeks.ago
when "three weeks ago"
target_time = 3.weeks.ago
else
target_time = Time.now
end
Timecop.freeze(target_time) do
#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!
timeline = WorkPackage.find_by_subject(name)
table.hashes.first.each do | key, value |
timeline[key] = value
end
timeline.save!
end
end
@ -83,15 +108,19 @@ When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time|
end
Then(/^I should see the work package "(.*?)" has not moved$/) do |name|
row = getWPRowByName(name)
row = get_timeline_row_by_name(name)
row.should_not have_selector(".tl-icon-changed");
end
Then(/^I should see the work package "(.*?)" has moved$/) do |name|
row = getWPRowByName(name)
row = get_timeline_row_by_name(name)
row.should have_selector(".tl-icon-changed");
end
Then(/^I should not see the work package "(.*?)"$/) do |arg1|
pending # express the regexp above with the code you wish you had
Then(/^I should see the work package "(.*?)" has not changed "(.*?)"$/) do |name, column_name|
expect(get_timeline_cell(name, column_name)).to have_no_css(".tl-icon-changed")
end
Then(/^I should see the work package "(.*?)" has changed "(.*?)"$/) do |name, column_name|
expect(get_timeline_cell(name, column_name)).to have_css(".tl-icon-changed")
end

@ -39,6 +39,11 @@ Feature: Timeline Comparison View Tests
| delete_work_packages |
| view_reportings |
| view_project_associations |
And there are the following status:
| name | default |
| new | true |
| in progress | false |
| closed | false |
And there is a project named "Volatile Planning"
And I am working in project "Volatile Planning"
And the project uses the following modules:
@ -52,21 +57,27 @@ Feature: Timeline Comparison View Tests
| March | 2014-03-01 | 2014-03-31 |
| April | 2014-04-01 | 2014-04-30 |
And the work package "February" was changed "two weeks ago" to:
| Subject | Start date | Due date |
| May | 2014-05-01 | 2014-05-31 |
| Subject | Start date | Due date | status id |
| May | 2014-05-01 | 2014-05-31 | 3 |
And the work package "January" was changed "one week ago" to:
| Subject | Start date | Due date |
| February | 2014-02-01 | 2014-02-28 |
| Subject | Start date | Due date | status id |
| February | 2014-02-01 | 2014-02-28 | 3 |
@javascript
Scenario: nine days comparison
Given I am working in the timeline "Changes" of the project called "Volatile Planning"
When there is a timeline "Changes" for project "Volatile Planning"
And I set the timeline to compare "now" to "9 days ago"
And I set the columns shown in the timeline to:
| start_date |
| due_date |
| status |
And I go to the page of the timeline "Changes" of the project called "Volatile Planning"
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 see the work package "May" has not changed "Status"
And I should see the work package "February" has changed "Status"
And I should not see the work package "January" in the timeline
@javascript
@ -74,8 +85,15 @@ Feature: Timeline Comparison View Tests
Given I am working in the timeline "Changes" of the project called "Volatile Planning"
When there is a timeline "Changes" for project "Volatile Planning"
And I set the timeline to compare "now" to "16 days ago"
And I set the columns shown in the timeline to:
| start_date |
| due_date |
| status |
And I go to the page of the timeline "Changes" of the project called "Volatile Planning"
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 see the work package "May" has changed "Status"
And I should see the work package "February" has changed "Status"
And I should not see the work package "January" in the timeline

Loading…
Cancel
Save