From 8d6e4574524ea7f471ddfd9cea99234196a5a21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 10 May 2017 10:53:25 +0200 Subject: [PATCH] Fix tests --- .../stylesheets/layout/_work_packages_full_view.sass | 6 ++++++ .../work_packages/details/details_relations_spec.rb | 2 +- spec/features/work_packages/indem_sums_spec.rb | 2 +- spec/features/work_packages/pagination_spec.rb | 6 +++--- spec/support/pages/split_work_package.rb | 2 +- spec/support/pages/work_packages_table.rb | 4 ++-- spec/support/pages/work_packages_timeline.rb | 10 +++++++--- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/layout/_work_packages_full_view.sass b/app/assets/stylesheets/layout/_work_packages_full_view.sass index 13dcc824dc..0f47ab2587 100644 --- a/app/assets/stylesheets/layout/_work_packages_full_view.sass +++ b/app/assets/stylesheets/layout/_work_packages_full_view.sass @@ -29,8 +29,14 @@ //++ body.controller-work_packages.action-show +body.controller-work_packages.full-create overflow-x: auto + // Fix selenium scrolling the #content which shouldn't be possible + // This appears to be caused by somehow setting the scrollTop to move to an element. + #content + overflow: visible + .work-packages--show-view display: flex flex-direction: column diff --git a/spec/features/work_packages/details/details_relations_spec.rb b/spec/features/work_packages/details/details_relations_spec.rb index 5c10b0f80a..6399acfb54 100644 --- a/spec/features/work_packages/details/details_relations_spec.rb +++ b/spec/features/work_packages/details/details_relations_spec.rb @@ -256,7 +256,7 @@ describe 'Work package relations tab', js: true, selenium: true do add_relation('follows', relatable) # Switch to full view - find('.work-packages-show-view-button').click + find('.work-packages--details-fullscreen-icon').click # Expect to have row created_row = find(".relation-row-#{relatable.id}", wait: 10) diff --git a/spec/features/work_packages/indem_sums_spec.rb b/spec/features/work_packages/indem_sums_spec.rb index 266eb6ba0d..7f3cc38c2e 100644 --- a/spec/features/work_packages/indem_sums_spec.rb +++ b/spec/features/work_packages/indem_sums_spec.rb @@ -52,7 +52,7 @@ RSpec.feature 'Work package index sums', js: true do scenario 'calculates summs correctly' do expect(page).to have_content('Work packages') - within('#work-packages-index') do + within('.work-packages-list-view--container') do expect(page).to have_content(work_package_1.subject) expect(page).to have_content(work_package_2.subject) end diff --git a/spec/features/work_packages/pagination_spec.rb b/spec/features/work_packages/pagination_spec.rb index b2f8bfb3fb..3747fc093f 100644 --- a/spec/features/work_packages/pagination_spec.rb +++ b/spec/features/work_packages/pagination_spec.rb @@ -50,7 +50,7 @@ RSpec.feature 'Work package pagination', js: true do scenario do expect(page).to have_content('Work packages') - within('#work-packages-index') do + within('.work-packages-list-view--container') do expect(page).to have_content(work_package_1.subject) expect(page).to_not have_content(work_package_2.subject) end @@ -59,7 +59,7 @@ RSpec.feature 'Work package pagination', js: true do click_link '2' end - within('#work-packages-index') do + within('.work-packages-list-view--container') do expect(page).to have_content(work_package_2.subject) expect(page).to_not have_content(work_package_1.subject) end @@ -68,7 +68,7 @@ RSpec.feature 'Work package pagination', js: true do click_link '50' end - within('#work-packages-index') do + within('.work-packages-list-view--container') do expect(page).to have_content(work_package_1.subject) expect(page).to have_content(work_package_2.subject) end diff --git a/spec/support/pages/split_work_package.rb b/spec/support/pages/split_work_package.rb index c36c815af7..41223fb434 100644 --- a/spec/support/pages/split_work_package.rb +++ b/spec/support/pages/split_work_package.rb @@ -43,7 +43,7 @@ module Pages end def switch_to_fullscreen - find('.work-packages-show-view-button').click + find('.work-packages--details-fullscreen-icon').click FullWorkPackage.new(work_package, project) end diff --git a/spec/support/pages/work_packages_table.rb b/spec/support/pages/work_packages_table.rb index 072a521da3..deeb7f7d35 100644 --- a/spec/support/pages/work_packages_table.rb +++ b/spec/support/pages/work_packages_table.rb @@ -118,14 +118,14 @@ module Pages def click_on_row(work_package) loading_indicator_saveguard - page.driver.browser.mouse.click(row(work_package).native) + page.driver.browser.action.click(row(work_package).native).perform end def open_full_screen_by_doubleclick(work_package) loading_indicator_saveguard # The 'id' column should have enough space to be clicked click_target = row(work_package).find('.wp-table--cell-span.id') - page.driver.browser.mouse.double_click(click_target.native) + page.driver.browser.action.double_click(click_target.native).perform FullWorkPackage.new(work_package, project) end diff --git a/spec/support/pages/work_packages_timeline.rb b/spec/support/pages/work_packages_timeline.rb index 1e83123994..fe6689017c 100644 --- a/spec/support/pages/work_packages_timeline.rb +++ b/spec/support/pages/work_packages_timeline.rb @@ -35,19 +35,23 @@ module Pages find('#work-packages-timeline-toggle-button').click end + def timeline_row_selector(wp_id) + "#wp-timeline-row-#{wp_id}" + end + def expect_timeline!(open: true) if open expect(page).to have_selector('#work-packages-timeline-toggle-button.-active') - expect(page).to have_selector('.work-package-table .wp-timeline-cell') + expect(page).to have_selector('.wp-table-timeline--container .wp-timeline-cell') else expect(page).to have_no_selector('#work-packages-timeline-toggle-button.-active') - expect(page).to have_no_selector('.work-package-table .wp-timeline-cell', visible: true) + expect(page).to have_no_selector('.wp-table-timeline--container .wp-timeline-cell', visible: true) end end def expect_timeline_element(work_package) type = work_package.milestone? ? :milestone : :bar - expect(page).to have_selector("#{work_package_row_selector(work_package)} .timeline-element.#{type}") + expect(page).to have_selector("#{timeline_row_selector(work_package.id)} .timeline-element.#{type}") end end end