From 8fc462247e79e72b89f151cf3c099280af7c75f1 Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Tue, 10 Dec 2024 15:54:59 +0200 Subject: [PATCH] # This is a combination of 6 commits. # This is the 1st commit message: Resource calculate dates # This is the commit message #2: Overcommit # This is the commit message #3: Fix specs # This is the commit message #4: Force error # This is the commit message #5: Test # This is the commit message #6: Test --- .overcommit.yml | 3 +++ Gemfile | 1 + Gemfile.lock | 8 ++++++ .../resource_calculate_dates.feature | 3 ++- staff_features/shared/step_definitions.rb | 27 +++++++------------ 5 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 .overcommit.yml diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..efbdbcb7 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,3 @@ +RuboCop: + enabled: true + on_warn: fail diff --git a/Gemfile b/Gemfile index eaff8a71..0142a5f3 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'byebug' gem 'capybara' gem 'cucumber' gem 'cuke_linter' +gem 'overcommit', require: false gem 'rspec-expectations' gem 'rubocop-packaging', require: false gem 'selenium-webdriver' diff --git a/Gemfile.lock b/Gemfile.lock index 39364224..61dc30e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,6 +17,8 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + childprocess (5.1.0) + logger (~> 1.5) cucumber (9.2.0) builder (~> 3.2) cucumber-ci-environment (> 9, < 11) @@ -48,6 +50,7 @@ GEM cucumber-gherkin (< 29.0) diff-lcs (1.5.1) ffi (1.17.0-x86_64-linux-gnu) + iniparse (1.5.0) json (2.7.2) language_server-protocol (3.17.0.3) logger (1.6.0) @@ -56,6 +59,10 @@ GEM multi_test (1.1.0) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) + overcommit (0.64.0) + childprocess (>= 0.6.3, < 6) + iniparse (~> 1.4) + rexml (~> 3.2) parallel (1.26.3) parser (3.3.4.2) ast (~> 2.4.1) @@ -112,6 +119,7 @@ DEPENDENCIES capybara cucumber cuke_linter + overcommit rspec-expectations rubocop-packaging selenium-webdriver diff --git a/staff_features/resources/resource_calculate_dates.feature b/staff_features/resources/resource_calculate_dates.feature index e3a7a836..e28658b5 100644 --- a/staff_features/resources/resource_calculate_dates.feature +++ b/staff_features/resources/resource_calculate_dates.feature @@ -6,8 +6,9 @@ Feature: Resource calculate dates Scenario: Dates sub record is added to the Resource When the user clicks on 'More' And the user clicks on 'Calculate Dates' + And the user selects 'Calculate for all dates' in the modal And the user clicks on 'Calculate Date Record' in the modal - And the user selects 'Single' from 'Type' in the date calculator result in the modal + And the user selects 'Single' from 'Type' in the modal And the user fills in 'Begin' with '2022' in the modal And the user clicks on 'Create Date Record' in the modal And the user clicks on 'Save' diff --git a/staff_features/shared/step_definitions.rb b/staff_features/shared/step_definitions.rb index 07364166..85eb1699 100644 --- a/staff_features/shared/step_definitions.rb +++ b/staff_features/shared/step_definitions.rb @@ -55,6 +55,12 @@ within '.modal-content' do click_on_string string + + if string == 'Calculate Date Record' + click_on 'Cancel' + end + + raise "Force error" end end @@ -188,29 +194,16 @@ select option, from: label, match: :first end -When 'the user selects {string} from {string} in the date calculator result in the modal' do |option, label| - wait_for_ajax - - tries = 0 - begin - find('#date_calculator_create_date_form') - rescue Capybara::ElementNotFound => e - raise e if tries == 5 - - tries += 1 - sleep 3 - retry - end - - within '#date_calculator_create_date_form' do - select option, from: label +When 'the user selects {string} in the modal' do |select_option| + within '.modal-content' do + find('#label').select select_option end end When 'the user selects {string} from {string} in the modal' do |option, label| wait_for_ajax - within '#date-calculator-result' do + within '.modal-content' do select option, from: label end end