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

Switch `admin/attribute_help_texts_spec` to cuprite

Aaron Contrerasa3c62135ed5d
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index caf024ceb0b..adf1732e50c 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -28,7 +28,9 @@
require 'spec_helper'
-RSpec.describe 'Attribute help texts', js: true do
+RSpec.describe 'Attribute help texts',
+ js: true,
+ with_cuprite: true do
shared_let(:admin) { create(:admin) }
let(:instance) { AttributeHelpText.last }
@@ -43,13 +45,14 @@ RSpec.describe 'Attribute help texts', js: true do
visit attribute_help_texts_path
end
- context 'with direct uploads (Regression #34285)', with_direct_uploads: true do
+ # TODO: Migrate to cuprite when the `better_cuprite_billy` driver is added
+ context 'with direct uploads (Regression #34285)', with_cuprite: false, with_direct_uploads: true do
before do
allow_any_instance_of(Attachment).to receive(:diskfile).and_return image_fixture
end
it 'can upload an image' do
- page.find('.attribute-help-texts--create-button').click
+ find('.attribute-help-texts--create-button').click
select 'Status', from: 'attribute_help_text_attribute_name'
editor.set_markdown('My attribute help text')
@@ -69,7 +72,7 @@ RSpec.describe 'Attribute help texts', js: true do
# Create help text
# -> new
- page.find('.attribute-help-texts--create-button').click
+ find('.attribute-help-texts--create-button').click
# Set attributes
# -> create
@@ -103,7 +106,7 @@ RSpec.describe 'Attribute help texts', js: true do
# -> edit
SeleniumHubWaiter.wait
- page.find('.attribute-help-text--entry td a', text: 'Status').click
+ find('.attribute-help-text--entry td a', text: 'Status').click
SeleniumHubWaiter.wait
expect(page).to have_selector('#attribute_help_text_attribute_name[disabled]')
editor.set_markdown(' ')
@@ -135,14 +138,15 @@ RSpec.describe 'Attribute help texts', js: true do
visit attribute_help_texts_path
# Create new, status is now blocked
- page.find('.attribute-help-texts--create-button').click
+ find('.attribute-help-texts--create-button').click
expect(page).to have_selector('#attribute_help_text_attribute_name option', text: 'Assignee')
expect(page).not_to have_selector('#attribute_help_text_attribute_name option', text: 'Status')
visit attribute_help_texts_path
# Destroy
- page.find('.attribute-help-text--entry .icon-delete').click
- page.driver.browser.switch_to.alert.accept
+ accept_alert do
+ find('.attribute-help-text--entry .icon-delete').click
+ end
expect(page).to have_selector('.generic-table--no-results-container')
expect(AttributeHelpText.count).to be_zero
diff --git a/spec/features/support/components/attribute_help_text_modal.rb b/spec/features/support/components/attribute_help_text_modal.rb
index 2142d121d4c..bfccb14e7f5 100644
--- a/spec/features/support/components/attribute_help_text_modal.rb
+++ b/spec/features/support/components/attribute_help_text_modal.rb
@@ -60,7 +60,14 @@ module Components
def close!
# make backdrop click an the pixel x:10,y:10
page.find('.spot-modal-overlay').tap do |element|
- element.click(x: -((element.native.size.width / 2) - 10), y: -((element.native.size.height / 2) - 10))
+ if RSpec.current_example.metadata[:with_cuprite]
+ width = element.style('width')["width"].to_i
+ height = element.style('height')["height"].to_i
+ else
+ width = element.native.size.width
+ height = element.native.size.height
+ end
+ element.click(x: -((width / 2) - 10), y: -((height / 2) - 10))
end
expect(page).not_to have_selector('[data-qa-selector="attribute-help-text--header"]', text: help_text.attribute_caption)
end
diff --git a/spec/support/shared/with_direct_uploads.rb b/spec/support/shared/with_direct_uploads.rb
index 9eefbcacc7d..0b2bfbfb591 100644
--- a/spec/support/shared/with_direct_uploads.rb
+++ b/spec/support/shared/with_direct_uploads.rb
@@ -61,7 +61,7 @@ class WithDirectUploads
end
def around(example)
- example.metadata[:driver] = :chrome_billy
+ example.metadata[:javascript_driver] = example.metadata[:driver] = :chrome_billy
csp_config = SecureHeaders::Configuration.instance_variable_get("@default_config").csp