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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Switch `work_packages/datepicker/datepicker_logic_spec` to cuprite
Aaron Contreras2536705eb9af
diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rbindex 1ccf4803287..f5e88e7b815 100644--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb@@ -30,7 +30,8 @@ require 'spec_helper'require 'support/edit_fields/edit_field'RSpec.describe 'Datepicker modal logic test cases (WP #43539)',- js: true, with_settings: { date_format: '%Y-%m-%d' } do+ js: true,+ with_cuprite: true, with_settings: { date_format: '%Y-%m-%d' } doshared_let(:user) { create(:admin) }shared_let(:type_bug) { create(:type_bug) }@@ -221,8 +222,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.expect_due_date '2021-02-12'datepicker.expect_duration 3- # The spec clears faster than the due date is filled, wait a bit- sleep 1datepicker.clear_durationdatepicker.expect_start_date '2021-02-09'@@ -245,8 +244,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.expect_due_date '2021-02-12'datepicker.expect_duration 3- # The spec clears faster than the due date is filled, wait a bit- sleep 1datepicker.clear_duration_with_icondatepicker.expect_start_date '2021-02-09'@@ -269,8 +266,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.expect_due_date '2021-02-12'datepicker.expect_duration 3- # The spec clears faster than the due date is filled, wait a bit- sleep 1datepicker.clear_duration_with_icondatepicker.expect_start_date '2021-02-09'@@ -284,8 +279,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.expect_due_date '2021-02-09'datepicker.expect_duration 3- # Clear again- sleep 1datepicker.clear_duration_with_icondatepicker.expect_start_date '2021-02-05'@@ -338,7 +331,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',# simulate someone deleting some chars to type a new datedatepicker.set_start_date '2021-02-'- sleep 2datepicker.set_start_date '2021-02-09'datepicker.expect_start_date '2021-02-09'@@ -756,8 +748,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.focus_durationdatepicker.expect_duration_highlighted- sleep 1-datepicker.select_day 17datepicker.expect_start_date '2021-02-17'datepicker.expect_due_date '2021-02-18'@@ -790,8 +780,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.focus_durationdatepicker.expect_duration_highlighted- sleep 1-datepicker.select_day 19datepicker.expect_start_date '2021-02-18'datepicker.expect_due_date '2021-02-19'@@ -824,8 +812,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.focus_durationdatepicker.expect_duration_highlighted- sleep 1-datepicker.select_day 19datepicker.expect_start_date '2021-02-18'datepicker.expect_due_date '2021-02-19'@@ -858,8 +844,6 @@ RSpec.describe 'Datepicker modal logic test cases (WP #43539)',datepicker.focus_durationdatepicker.expect_duration_highlighted- sleep 1-datepicker.select_day 17datepicker.expect_start_date '2021-02-17'datepicker.expect_due_date '2021-02-18'diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rbindex 3ca2d85d004..51cfb431925 100644--- a/spec/support/components/datepicker/work_package_datepicker.rb+++ b/spec/support/components/datepicker/work_package_datepicker.rb@@ -77,26 +77,20 @@ module Componentsdef set_milestone_date(value)focus_milestone_date- fill_in 'date', with: value, fill_options: { clear: :backspace }-- # Wait until debounce applied- sleep 1+ clear_input_field_contents('date')+ fill_in 'date', with: valueenddef set_start_date(value)focus_start_date- fill_in 'startDate', with: value, fill_options: { clear: :backspace }-- # Wait for the value to be applied- sleep 1+ clear_input_field_contents('startDate')+ fill_in 'startDate', with: valueenddef set_due_date(value)focus_due_date- fill_in 'endDate', with: value, fill_options: { clear: :backspace }-- # Wait for the value to be applied- sleep 1+ clear_input_field_contents('endDate')+ fill_in 'endDate', with: valueenddef expect_start_highlighted@@ -135,7 +129,8 @@ module Componentsdef set_duration(value)focus_duration- fill_in 'duration', with: value, fill_options: { clear: :backspace }+ clear_input_field_contents('duration')+ fill_in 'duration', with: value# Focus a different fieldstart_date_field.click@@ -187,7 +182,8 @@ module Componentsdef clear_durationduration_field.click- fill_in 'duration', with: '', fill_options: { clear: :backspace }+ clear_input_field_contents('duration')+ fill_in 'duration', with: ''# Focus a different fieldstart_date_field.clickdiff --git a/spec/support/shared/cuprite_helpers.rb b/spec/support/shared/cuprite_helpers.rbindex 3b20f6f4881..edbbdb0bfd1 100644--- a/spec/support/shared/cuprite_helpers.rb+++ b/spec/support/shared/cuprite_helpers.rb@@ -47,8 +47,12 @@ end# Ferrum is yet support `fill_options` as a Hashdef clear_input_field_contents(input_element)- input_element.value.length.times do- input_element.send_keys(:backspace)+ if input_element.is_a? String+ input_element = find_field(input_element)+ end++ (input_element.value.length + 1).times do+ input_element.native.node.type(:backspace)endend