FIX: flakey spec in sidebar with new font size (#21728)

This commit also includes two changes to the rails helper which make tests more consistent on different devices. With this change the failure was reproducible locally and not only on CI:

```
options.add_argument("--force-device-scale-factor=1")
```

The fix itself is quite simple and attempts to find safe click coordinates, the previous solution could fail depending on the size of the sidebar.
This commit is contained in:
Joffrey JAFFEUX 2023-05-24 18:59:12 +02:00 committed by GitHub
parent 2aae8d6092
commit 38d358fb9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -289,6 +289,7 @@ RSpec.configure do |config|
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--mute-audio")
options.add_argument("--force-device-scale-factor=1")
end
Capybara.register_driver :selenium_chrome do |app|
@ -310,6 +311,7 @@ RSpec.configure do |config|
options.add_argument("--disable-dev-shm-usage")
options.add_emulation(device_name: "iPhone 12 Pro")
options.add_argument("--mute-audio")
options.add_argument("--force-device-scale-factor=1")
end
Capybara.register_driver :selenium_mobile_chrome do |app|

View File

@ -42,8 +42,8 @@ module PageObjects
end
def click_outside
dropdown = page.find(SIDEBAR_HAMBURGER_DROPDOWN)
dropdown.click(x: dropdown.rect.width + 1, y: 1)
width = page.evaluate_script("document.body.clientWidth")
page.find("body").click(x: width - 1, y: 1)
end
end
end