mmd-osm left a comment (openstreetmap/openstreetmap-website#6712)
Another option I've seen elsewhere is to run some tests slower. I've only
tested it on Chrome, the snap based firefox is causing some major drama (as
always). When disabling the headless mode, you can even follow along the steps.
Maybe give it a try as well:
New file test/helpers/throttle.rb:
```ruby
require "selenium-webdriver"
module ::Selenium
module WebDriver
module Remote
class Bridge
attr_accessor :speed
alias old_execute execute
def execute(*)
case speed
when :slow
sleep 0.3
when :medium
sleep 0.1
end
old_execute(*)
end
end
end
end
end
def set_speed(speed)
page.driver.browser.send(:bridge).speed = speed
end
```
Updated test:
```ruby
diff --git a/test/system/select_language_test.rb
b/test/system/select_language_test.rb
index 62e96c52b..f31d12583 100644
--- a/test/system/select_language_test.rb
+++ b/test/system/select_language_test.rb
@@ -1,9 +1,11 @@
# frozen_string_literal: true
require "application_system_test_case"
+require "helpers/throttle"
class SelectLanguageTest < ApplicationSystemTestCase
test "can select language when logged out" do
+ set_speed(:medium)
visit help_path
within_content_heading do
@@ -26,6 +28,7 @@ class SelectLanguageTest < ApplicationSystemTestCase
end
test "can select language when logged in" do
+ set_speed(:medium)
user = create(:user, :display_name => "LanguageTestUser")
sign_in_as(user)
@@ -54,6 +57,8 @@ class SelectLanguageTest < ApplicationSystemTestCase
click_on "LanguageTestUser"
click_on "Mes préférences"
+ set_speed(0)
+
within_content_body do
assert_select "Langue préférée", :selected => "français"
end
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6712#issuecomment-3761981796
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/issues/6712/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev