reuse safeguards for wp index loaded in specs

pull/3263/head
Jens Ulferts 9 years ago
parent d5f44a0c60
commit 751751f6b4
  1. 5
      spec/features/work_packages/details/inplace_editor/description_editor_spec.rb
  2. 5
      spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb
  3. 11
      spec/features/work_packages/work_packages_page.rb

@ -2,6 +2,7 @@ require 'spec_helper'
require 'features/work_packages/details/inplace_editor/shared_examples' require 'features/work_packages/details/inplace_editor/shared_examples'
require 'features/work_packages/details/inplace_editor/shared_contexts' require 'features/work_packages/details/inplace_editor/shared_contexts'
require 'features/work_packages/details/inplace_editor/work_package_field' require 'features/work_packages/details/inplace_editor/work_package_field'
require 'features/work_packages/work_packages_page'
describe 'description inplace editor', js: true do describe 'description inplace editor', js: true do
include_context 'maximized window' include_context 'maximized window'
@ -19,12 +20,12 @@ describe 'description inplace editor', js: true do
} }
let(:user) { FactoryGirl.create :admin } let(:user) { FactoryGirl.create :admin }
let(:field) { WorkPackageField.new page, property_name } let(:field) { WorkPackageField.new page, property_name }
let(:work_packages_page) { WorkPackagesPage.new(project) }
before do before do
allow(User).to receive(:current).and_return(user) allow(User).to receive(:current).and_return(user)
visit project_work_packages_path(project)
ensure_wp_table_loaded work_packages_page.visit_index
row = page.find("#work-package-#{work_package.id}") row = page.find("#work-package-#{work_package.id}")
row.double_click row.double_click

@ -2,6 +2,7 @@ require 'spec_helper'
require 'features/work_packages/details/inplace_editor/shared_examples' require 'features/work_packages/details/inplace_editor/shared_examples'
require 'features/work_packages/details/inplace_editor/shared_contexts' require 'features/work_packages/details/inplace_editor/shared_contexts'
require 'features/work_packages/details/inplace_editor/work_package_field' require 'features/work_packages/details/inplace_editor/work_package_field'
require 'features/work_packages/work_packages_page'
describe 'subject inplace editor', js: true do describe 'subject inplace editor', js: true do
include_context 'maximized window' include_context 'maximized window'
@ -11,11 +12,13 @@ describe 'subject inplace editor', js: true do
let(:property_title) { 'Subject' } let(:property_title) { 'Subject' }
let!(:work_package) { FactoryGirl.create :work_package, project: project } let!(:work_package) { FactoryGirl.create :work_package, project: project }
let(:user) { FactoryGirl.create :admin } let(:user) { FactoryGirl.create :admin }
let(:work_packages_page) { WorkPackagesPage.new(project) }
let(:field) { WorkPackageField.new page, property_name } let(:field) { WorkPackageField.new page, property_name }
before do before do
allow(User).to receive(:current).and_return(user) allow(User).to receive(:current).and_return(user)
visit project_work_packages_path(project)
work_packages_page.visit_index
ensure_wp_table_loaded ensure_wp_table_loaded

@ -29,6 +29,7 @@
class WorkPackagesPage class WorkPackagesPage
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
include Capybara::DSL include Capybara::DSL
include RSpec::Matchers
def initialize(project = nil) def initialize(project = nil)
@project = project @project = project
@ -36,6 +37,8 @@ class WorkPackagesPage
def visit_index def visit_index
visit index_path visit index_path
ensure_index_page_loaded
end end
def visit_new def visit_new
@ -64,6 +67,8 @@ class WorkPackagesPage
def select_query(query) def select_query(query)
visit query_path(query) visit query_path(query)
ensure_index_page_loaded
end end
def find_filter(filter_name) def find_filter(filter_name)
@ -79,4 +84,10 @@ class WorkPackagesPage
def query_path(query) def query_path(query)
"#{index_path}?query_id=#{query.id}" "#{index_path}?query_id=#{query.id}"
end end
def ensure_index_page_loaded
if Capybara.current_driver == Capybara.javascript_driver
expect(page).to have_selector('.advanced-filters--filter', visible: false)
end
end
end end

Loading…
Cancel
Save