File tree Expand file tree Collapse file tree 3 files changed +13
-21
lines changed
Expand file tree Collapse file tree 3 files changed +13
-21
lines changed Original file line number Diff line number Diff line change 4545 expect ( page ) . to have_text ( 'Merge Organisations' )
4646 choose_suggestion ( 'org_org_name' , @to_org )
4747
48- # rubocop:disable Layout/LineLength
49- # Using JS to click on button as click_button 'Analyze' fails due to error like
50- # Selenium::WebDriver::Error::ElementClickInterceptedError: element click intercepted:
51- # Element <button name="button" type="submit" class="btn btn-primary">...</button> is not clickable at point (86, 349).
52- # Other element would receive the click: <div id="ui-id-2" tabindex="-1" class="ui-menu-item-wrapper">...</div>
53- # So replacing click_button 'Analyze'with
54- # rubocop:enable Layout/LineLength
55- analyze_button = find ( 'button' , text : 'Analyze' )
56- execute_script ( 'arguments[0].click();' , analyze_button )
57-
48+ click_button 'Analyze'
5849 # Wait for response
5950 sleep ( 0.3 )
6051 expect ( page ) . to have_text ( 'Summary:' )
Original file line number Diff line number Diff line change 5252
5353 # Move to the other funder Org's Templates
5454 choose_suggestion ( 'superadmin_user_org_name' , funder )
55-
56- # rubocop:disable Layout/LineLength
57- # Using JS to click as click_button "Change affiliation" fails due to error like
58- # Selenium::WebDriver::Error::ElementClickInterceptedError: element click intercepted:
59- # Element <input type="submit" name="commit" value="Change affiliation" class="btn btn-secondary" data-disable-with="Change affiliation">
60- # 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>
61- # So replacing click_button('Change affiliation')
62- # rubocop:enable Layout/LineLength
63- change_affiliation_input_button = find ( 'input[value="Change affiliation"]' )
64- execute_script ( 'arguments[0].click();' , change_affiliation_input_button )
55+ click_button ( 'Change affiliation' )
6556
6657 # Edit the original Template
6758 click_link "#{ funder . name } Templates"
Original file line number Diff line number Diff line change 66# Use the fast rack_test driver for non-feature tests by default
77Capybara . default_driver = :rack_test
88
9+ # Create a custom driver based on Capybara's :selenium_chrome_headless driver
10+ # This resolves a ElementClickInterceptedError when executing `click_button 'Sign in'` with DMP Assistant
11+ Capybara . register_driver :selenium_chrome_headless_add_window_size do |app |
12+ # Get a copy of the default options for Capybara's :selenium_chrome_headless driver
13+ options = Capybara . drivers [ :selenium_chrome_headless ] . call . options [ :options ] . dup
14+ options . add_argument ( '--window-size=1920,1080' ) # default window-size is only (800x600)
15+ # Create a new Selenium driver with the customised options
16+ Capybara ::Selenium ::Driver . new ( app , browser : :chrome , options : options )
17+ end
18+
919RSpec . configure do |config |
1020 config . before ( :each , type : :feature , js : false ) do
1121 Capybara . use_default_driver
1222 end
1323
1424 # Use the Selenium headless Chrome driver for feature tests
1525 config . before ( :each , type : :feature , js : true ) do
16- Capybara . current_driver = :selenium_chrome_headless
26+ Capybara . current_driver = :selenium_chrome_headless_add_window_size
1727 end
1828end
You can’t perform that action at this time.
0 commit comments