Fix for failing Rubocop tests.#3405
Merged
benjaminfaure merged 2 commits intodevelopmentfrom Apr 11, 2024
Merged
Conversation
benjaminfaure
approved these changes
Apr 9, 2024
Changes:
- To deal with missing favicon.ico error ( ActionController::RoutingError:
No route matches [GET] "/favicon.ico") :
added config/routes_test.rb to add a route will return an empty response
with a 200 OK status code when the browser requests the favicon.ico file.
Then for test purposes we add the lines to config/encvironments/test.rb:
# Add config/routes_test.rb to routes
config.paths['config/routes.rb'] << Rails.root.join('config/routes_test.rb')
- The other outstanding errors arose because in the test environment
we sometimes encounter errors like (Selenium::WebDriver::Error::ElementClickInterceptedError: element click intercepted:
# Element <input type="submit" name="commit" value="Change affiliation" class="btn btn-secondary" data-disable-with="Change affiliation">
# is not clickable at point (101, 203). Other element would receive
the click: <div id="ui-id-2" tabindex="-1"
class="ui-menu-item-wrapper">...</div>).
To get round this we use JS to click on element using code like
this:
change_affiliation_input_button = find('input[value="Change affiliation"]')
execute_script('arguments[0].click();', change_affiliation_input_button)
ca2bf8a to
55321d0
Compare
:selenium_chrome_headless driver has a default window-size of (800x600). This small window-size seems to result in the `Selenium::WebDriver::Error::ElementClickInterceptedError:` This commit increases the window-size and also reverts the prior fix for these errors (commit 55321d0)
Contributor
Author
|
@aaronskiba You fix was neater than mine for the Selenium::WebDriver::Error::ElementClickInterceptedError. Yours is future proof. |
gjacob24
approved these changes
Apr 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
To deal with missing favicon.ico error ( ActionController::RoutingError: No route matches [GET] "/favicon.ico") : added config/routes_test.rb to add a route will return an empty response with a 200 OK status code when the browser requests the favicon.ico file. Then for test purposes we add the lines to config/encvironments/test.rb: # Add config/routes_test.rb to routes config.paths['config/routes.rb'] << Rails.root.join('config/routes_test.rb')
The other outstanding errors arose because in the test environment we sometimes encounter errors like (Selenium::WebDriver::Error::ElementClickInterceptedError: element click intercepted: # Element # is not clickable at point (101, 203). Other element would receive the click:
To get round this we use JS to click on element using code like
this:
change_affiliation_input_button = find('input[value="Change affiliation"]')
execute_script('arguments[0].click();', change_affiliation_input_button)