Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Harden copy spec

Oliver Güntherd35d4849aa53
diff --git a/spec/features/work_packages/copy_spec.rb b/spec/features/work_packages/copy_spec.rb
index 22a70175290..5aaf4751682 100644
--- a/spec/features/work_packages/copy_spec.rb
+++ b/spec/features/work_packages/copy_spec.rb
@@ -105,7 +105,8 @@ RSpec.describe 'Work package copy', js: true, selenium: true do
to_copy_work_package_page.save!
expect(page).to have_selector('.op-toast--content',
- text: I18n.t('js.notice_successful_create'))
+ text: I18n.t('js.notice_successful_create'),
+ wait: 20)
copied_work_package = WorkPackage.order(created_at: 'desc').first
@@ -156,10 +157,9 @@ RSpec.describe 'Work package copy', js: true, selenium: true do
to_copy_work_package_page.expect_fully_loaded
to_copy_work_package_page.update_attributes Description: 'Copied WP Description'
- to_copy_work_package_page.save!
- expect(page).to have_selector('.op-toast--content',
- text: I18n.t('js.notice_successful_create'))
+ to_copy_work_package_page.save!
+ find('.op-toast--content', text: I18n.t('js.notice_successful_create'), wait: 20)
copied_work_package = WorkPackage.order(created_at: 'desc').first
diff --git a/spec/support/components/wysiwyg/wysiwyg_editor.rb b/spec/support/components/wysiwyg/wysiwyg_editor.rb
index 5007010edd9..4ec1c4129e7 100644
--- a/spec/support/components/wysiwyg/wysiwyg_editor.rb
+++ b/spec/support/components/wysiwyg/wysiwyg_editor.rb
@@ -27,6 +27,9 @@ module Components
end
def set_markdown(text)
+ # wait for element to be loaded
+ editor_element
+
textarea = container.find('.op-ckeditor-source-element', visible: :all)
page.execute_script(
'jQuery(arguments[0]).trigger("op:ckeditor:setData", arguments[1])',