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
fix first batch of tests
Klaus Zanders3b3ee5110aea
diff --git a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb b/modules/reporting/spec/features/support/components/cost_reports_base_table.rbindex 88611e39871..e34585e4b11 100644--- a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb+++ b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb@@ -34,6 +34,7 @@ module Componentsinclude Capybara::RSpecMatchersinclude RSpec::Matchersinclude Flash::Expectations+ include Redmine::I18nattr_reader :time_logging_modal@@ -57,19 +58,22 @@ module Componentsexpect(page).to have_css("#{row_selector(row)} .units", text: value)end- def edit_time_entry(new_value, row)+ def edit_time_entry(row, hours:)SeleniumHubWaiter.waitpage.find("#{row_selector(row)} .icon-edit").clicktime_logging_modal.is_visible true- time_logging_modal.update_field "hours", new_value- time_logging_modal.work_package_is_missing false+ time_logging_modal.change_hours(hours)+ # time_logging_modal.work_package_is_missing false- time_logging_modal.perform_action "Save"+ time_logging_modal.submitSeleniumHubWaiter.wait+ # TODO: ensure page reload ... should happen automatically and does so in the browser+ page.refresh+expect_action_icon "edit", row- expect_value new_value, row+ expect_value l_hours(hours), rowenddef edit_cost_entry(new_value, row, cost_entry_id)diff --git a/modules/reporting/spec/features/update_entries_spec.rb b/modules/reporting/spec/features/update_entries_spec.rbindex 783639f3e18..15322f32c0a 100644--- a/modules/reporting/spec/features/update_entries_spec.rb+++ b/modules/reporting/spec/features/update_entries_spec.rb@@ -75,7 +75,7 @@ RSpec.describe "Updating entries within the cost report", :js, :selenium dotable.expect_action_icon "edit", 1table.expect_action_icon "delete", 1- table.edit_time_entry 2, 1+ table.edit_time_entry 1, hours: 2table.delete_entry 1table.rows_count 0diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rbindex 0d48bd11487..94d7aa70b4f 100644--- a/spec/features/support/components/time_logging_modal.rb+++ b/spec/features/support/components/time_logging_modal.rb@@ -31,37 +31,39 @@ module Componentsinclude Capybara::DSLinclude Capybara::RSpecMatchersinclude RSpec::Matchers-- attr_reader :activity_field,- :comment_field,- :hours_field,- :spent_on_field,- :work_package_field,- :user_field-- def initialize- @activity_field = EditField.new(page, "time_entry[activity_id]")- @comment_field = EditField.new(page, "time_entry[comment]")- @hours_field = EditField.new(page, "time_entry[hours]")- @spent_on_field = EditField.new(page, "time_entry[spent_on]")- @work_package_field = EditField.new(page, "time_entry[work_package_id]")- @user_field = EditField.new(page, "time_entry[user_id]")- end+ include ::Components::Autocompleter::AutocompleteHelpersdef is_visible(visible)if visiblewithin modal_container do- expect(page)- .to have_text(I18n.t("js.button_log_time"))+ expect(page).to have_text(I18n.t("button_log_time"))endelseexpect(page).to have_no_css "dialog#time-entry-dialog"endend+ def change_hours(value)+ within modal_container do+ fill_in "time_entry_hours", with: value+ end+ end++ def submit+ within modal_container do+ click_on I18n.t("button_log_time")+ end+ end++ def cancel+ within modal_container do+ click_on I18n.t("button_cancel")+ end+ end+def has_field_with_value(field, value)within modal_container do- expect(page).to have_field field_identifier(field), with: value, visible: :all+ expect(page).to have_field "#time_entry_#{field}", with: value, visible: :allendend@@ -133,10 +135,6 @@ module Componentsprivate- def field_object(field_name)- send(:"#{field_name}_field")- end-def modal_containerpage.find("dialog#time-entry-dialog")end