From 94f71b38199a6040463a86520abe91628f03cab7 Mon Sep 17 00:00:00 2001 From: Omar Rodriguez Arenas Date: Tue, 13 Sep 2022 11:40:26 -0600 Subject: [PATCH 1/5] Increase capybara wait time Capybara is timing out on tests when uploading files. The value for `default_max_wait_time` had been previously increased to 5 but that continues to make tests fail. Increasing this time will hopefully decrease failed tests due to latency in asynchronous processes. --- test/application_system_test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 7265515a1..1637e51a3 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -3,7 +3,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - Capybara.default_max_wait_time = 5 + Capybara.default_max_wait_time = 10 setup do Capybara.app_host = Jupiter::TEST_URL From 290e9317df0aad5ef552eae71403df4e2e4fa353 Mon Sep 17 00:00:00 2001 From: Omar Rodriguez Arenas Date: Wed, 14 Sep 2022 09:07:54 -0600 Subject: [PATCH 2/5] Test increase default wait time even more --- test/application_system_test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 1637e51a3..555fdb018 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -3,7 +3,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - Capybara.default_max_wait_time = 10 + Capybara.default_max_wait_time = 15 setup do Capybara.app_host = Jupiter::TEST_URL From e2f6e8f7dbabc9f94f18f267bb2ed9d23900fd8b Mon Sep 17 00:00:00 2001 From: Omar Rodriguez Arenas Date: Wed, 14 Sep 2022 09:09:47 -0600 Subject: [PATCH 3/5] Localize increased wait time to problematic areas The tests that are failing have to do with files being uploaded and the action timing out. Instead of increasing the wait time to all asynchronous process, we will localize the increased time to this action. --- test/application_system_test_case.rb | 2 +- test/system/deposit_item_test.rb | 2 +- test/system/deposit_thesis_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 555fdb018..7265515a1 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -3,7 +3,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - Capybara.default_max_wait_time = 15 + Capybara.default_max_wait_time = 5 setup do Capybara.app_host = Jupiter::TEST_URL diff --git a/test/system/deposit_item_test.rb b/test/system/deposit_item_test.rb index 47e0e96c1..53b466047 100644 --- a/test/system/deposit_item_test.rb +++ b/test/system/deposit_item_test.rb @@ -241,7 +241,7 @@ def select_date(date, field_id:) def attach_file_in_dropzone(file_path) # Attach the file to the hidden input selector - attach_file(nil, file_path, class: 'dz-hidden-input', visible: false) + attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 15) end end diff --git a/test/system/deposit_thesis_test.rb b/test/system/deposit_thesis_test.rb index 59c6527fe..6ca38efd6 100644 --- a/test/system/deposit_thesis_test.rb +++ b/test/system/deposit_thesis_test.rb @@ -214,7 +214,7 @@ class DepositThesisTest < ApplicationSystemTestCase def attach_file_in_dropzone(file_path) # Attach the file to the hidden input selector - attach_file(nil, file_path, class: 'dz-hidden-input', visible: false) + attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 15) end def select_date(date, field_id:) From 8ff895b6dd7b7bbf3ea5c492f66d6525663f9ddf Mon Sep 17 00:00:00 2001 From: Omar Rodriguez Arenas Date: Wed, 14 Sep 2022 10:08:35 -0600 Subject: [PATCH 4/5] Increase wait time for item and thesis save action After uploading the files, we also need to wait more so that the application can save the entity and continue with the process --- test/system/deposit_item_test.rb | 2 +- test/system/deposit_thesis_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/system/deposit_item_test.rb b/test/system/deposit_item_test.rb index 53b466047..41cfa0066 100644 --- a/test/system/deposit_item_test.rb +++ b/test/system/deposit_item_test.rb @@ -59,7 +59,7 @@ class DepositItemTest < ApplicationSystemTestCase attach_file_in_dropzone(file_fixture('image-sample.jpeg')) has_css? '.j-thumbnail' - click_on I18n.t('items.draft.save_and_continue'), wait: 5 + click_on I18n.t('items.draft.save_and_continue'), wait: 15 # 4. Review and Deposit Form diff --git a/test/system/deposit_thesis_test.rb b/test/system/deposit_thesis_test.rb index 6ca38efd6..d91982e3e 100644 --- a/test/system/deposit_thesis_test.rb +++ b/test/system/deposit_thesis_test.rb @@ -55,7 +55,7 @@ class DepositThesisTest < ApplicationSystemTestCase attach_file_in_dropzone(file_fixture('image-sample.jpeg')) has_css? '.j-thumbnail' - click_on I18n.t('admin.theses.draft.save_and_continue'), wait: 5 + click_on I18n.t('admin.theses.draft.save_and_continue'), wait: 15 # 4. Review and Deposit Form From 97cbd30b60eebb73c1e6c1fa7a4c1a9c321dc835 Mon Sep 17 00:00:00 2001 From: Omar Rodriguez Arenas Date: Wed, 14 Sep 2022 10:30:34 -0600 Subject: [PATCH 5/5] Change wait time to assert_selector for h2 node --- test/system/deposit_item_test.rb | 6 +++--- test/system/deposit_thesis_test.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/system/deposit_item_test.rb b/test/system/deposit_item_test.rb index 41cfa0066..c3d40d6f9 100644 --- a/test/system/deposit_item_test.rb +++ b/test/system/deposit_item_test.rb @@ -59,11 +59,11 @@ class DepositItemTest < ApplicationSystemTestCase attach_file_in_dropzone(file_fixture('image-sample.jpeg')) has_css? '.j-thumbnail' - click_on I18n.t('items.draft.save_and_continue'), wait: 15 + click_on I18n.t('items.draft.save_and_continue') # 4. Review and Deposit Form - assert_selector 'h2', text: I18n.t('items.draft.review_and_deposit_item.header') + assert_selector 'h2', text: I18n.t('items.draft.review_and_deposit_item.header'), wait: 15 click_on I18n.t('items.draft.header') @@ -241,7 +241,7 @@ def select_date(date, field_id:) def attach_file_in_dropzone(file_path) # Attach the file to the hidden input selector - attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 15) + attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 20) end end diff --git a/test/system/deposit_thesis_test.rb b/test/system/deposit_thesis_test.rb index d91982e3e..b56e325bc 100644 --- a/test/system/deposit_thesis_test.rb +++ b/test/system/deposit_thesis_test.rb @@ -59,7 +59,7 @@ class DepositThesisTest < ApplicationSystemTestCase # 4. Review and Deposit Form - assert_selector 'h2', text: I18n.t('admin.theses.draft.review_and_deposit_thesis.header') + assert_selector 'h2', text: I18n.t('admin.theses.draft.review_and_deposit_thesis.header'), wait: 15 click_on I18n.t('admin.theses.draft.header') @@ -214,7 +214,7 @@ class DepositThesisTest < ApplicationSystemTestCase def attach_file_in_dropzone(file_path) # Attach the file to the hidden input selector - attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 15) + attach_file(nil, file_path, class: 'dz-hidden-input', visible: false, wait: 20) end def select_date(date, field_id:)