Skip to content

Commit

Permalink
Merge pull request #3 from oliverguenther/fix/interactive_table_tests
Browse files Browse the repository at this point in the history
Have tests use new work package table rules
  • Loading branch information
ulferts committed Aug 12, 2015
2 parents efe4845 + d684a22 commit efaee7d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions features/work_packages/index_move_columns.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ Feature: Disabled done ratio on the work package index
And I choose "Columns" from the toolbar "settings" dropdown
And I select to see column "Author"
And I click "Apply"
Then I should see "Author" within ".workpackages-table"
Then I should see "Author" within ".work-package-table--container table"

@javascript
Scenario: Subject column should not be displayed when Subject is moved out of selected columns
When I go to the work packages index page of the project "project1"
And I choose "Columns" from the toolbar "settings" dropdown
And I select to not see column "Subject"
Then I should not see "Subject" within ".workpackages-table"
Then I should not see "Subject" within ".work-package-table--container table"
2 changes: 1 addition & 1 deletion features/work_packages/index_sums.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: Calculated sums on the work package index
# Adding this "should see" to prevent the columns menu from being opened
# before the information on available columns is returned from the server.
# If it is opened before the modal is empty.
And I should see "subject" within ".workpackages-table"
And I should see "subject" within ".work-package-table--container table"
And I choose "Columns" from the toolbar "settings" dropdown
And I select to see column "Estimated time"
And I click "Apply"
Expand Down
2 changes: 1 addition & 1 deletion features/work_packages/work_packages_new.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ Feature: Disabled done ratio on the work package index
Scenario: Total sums dialog should be displayed when the display sums checkbox is checked
When I go to the work packages index page of the project "project1"
And I choose "Display sums" from the toolbar "settings" dropdown
Then I should see "Sum for all work packages" within ".workpackages-table"
Then I should see "Sum for all work packages" within ".work-package-table--container table"
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def visit_index_page
end

describe 'Select all link' do
let(:link_selector) { 'table.workpackages-table th.checkbox a' }
let(:link_selector) { '.work-package-table--container th.checkbox a' }

before { visit_index_page }

Expand Down Expand Up @@ -108,7 +108,7 @@ def click_sort_descending_link
shared_examples_for 'sort column' do
it do
expect(page).to have_selector(column_header_selector)
expect(find(column_header_selector + ' span.sort-header')[:title]).to eq(sort_text)
expect(find(column_header_selector + ' span.generic-table--sort-header')[:title]).to eq(sort_text)
end
end

Expand Down Expand Up @@ -158,7 +158,7 @@ def click_sort_descending_link

describe 'id column' do
let(:link_caption) { 'ID' }
let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(2)' }
let(:column_header_selector) { '.work-package-table--container th:nth-of-type(2)' }
let(:column_header_link_selector) { column_header_selector + ' a' }

it_behaves_like 'sortable column'
Expand All @@ -169,39 +169,39 @@ def click_sort_descending_link
# testing the same functionality.
# describe 'type column' do
# let(:link_caption) { 'Type' }
# let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(3)' }
# let(:column_header_selector) { '.work-package-table--container th:nth-of-type(3)' }
# let(:column_header_link_selector) { column_header_selector + ' a' }

# it_behaves_like 'sortable column'
# end

describe 'status column' do
let(:link_caption) { 'Status' }
let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(4)' }
let(:column_header_selector) { '.work-package-table--container th:nth-of-type(4)' }
let(:column_header_link_selector) { column_header_selector + ' a' }

it_behaves_like 'sortable column'
end

describe 'priority column' do
let(:link_caption) { 'Priority' }
let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(5)' }
let(:column_header_selector) { '.work-package-table--container th:nth-of-type(5)' }
let(:column_header_link_selector) { column_header_selector + ' a' }

it_behaves_like 'sortable column'
end

describe 'subject column' do
let(:link_caption) { 'Subject' }
let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(6)' }
let(:column_header_selector) { '.work-package-table--container th:nth-of-type(6)' }
let(:column_header_link_selector) { column_header_selector + ' a' }

it_behaves_like 'sortable column'
end

describe 'assigned to column' do
let(:link_caption) { 'Assignee' }
let(:column_header_selector) { 'table.workpackages-table th:nth-of-type(7)' }
let(:column_header_selector) { '.work-package-table--container th:nth-of-type(7)' }
let(:column_header_link_selector) { column_header_selector + ' a' }

it_behaves_like 'sortable column'
Expand Down Expand Up @@ -282,14 +282,14 @@ def click_sort_descending_link
describe 'work package context menu', js: true do
it_behaves_like 'context menu' do
let(:target_link) { '#work-package-context-menu li.open a' }
let(:source_link) { '.workpackages-table tr.issue td.id a' }
let(:source_link) { '.work-package-table--container tr.issue td.id a' }
let(:keys) { [:shift, :alt, :f10] }
end
end

describe 'column header drop down menu', js: true do
it_behaves_like 'context menu' do
let(:source_link) { 'table.workpackages-table th:nth-of-type(2) a' }
let(:source_link) { '.work-package-table--container th:nth-of-type(2) a' }
let(:target_link) { '#column-context-menu .dropdown-menu li:first-of-type a' }
let(:keys) { :enter }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/features/work_packages/select_work_package_row_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

describe 'Work package row selection', js: true do
def select_work_package_row(number, mouse_button_behavior = :left)
element = find(".workpackages-table tr:nth-of-type(#{number}).issue td.id")
element = find(".work-package-table--container tr:nth-of-type(#{number}).issue td.id")
case mouse_button_behavior
when :double
element.double_click
Expand All @@ -72,23 +72,23 @@ def select_work_package_row(number, mouse_button_behavior = :left)
end

def select_work_package_row_with_shift(number)
element = find(".workpackages-table tr:nth-of-type(#{number}).issue td.id")
element = find(".work-package-table--container tr:nth-of-type(#{number}).issue td.id")
page.driver.browser.action.key_down(:shift)
.click(element.native)
.key_up(:shift)
.perform
end

def select_work_package_row_with_ctrl(number)
element = find(".workpackages-table tr:nth-of-type(#{number}).issue td.id")
element = find(".work-package-table--container tr:nth-of-type(#{number}).issue td.id")
page.driver.browser.action.key_down(:control)
.click(element.native)
.key_up(:control)
.perform
end

def check_row_selection_state(row_index, state = true)
selector = ".workpackages-table tr:nth-of-type(#{row_index}).issue input[type=checkbox]:checked"
selector = ".work-package-table--container tr:nth-of-type(#{row_index}).issue input[type=checkbox]:checked"

expect(page).to (state ? have_selector(selector) : have_no_selector(selector))
end
Expand Down

0 comments on commit efaee7d

Please sign in to comment.