From 3019f0fbecc399401f209d536e927e35b1a6d251 Mon Sep 17 00:00:00 2001 From: barbie-bot Date: Thu, 2 Apr 2026 19:10:47 +0000 Subject: [PATCH] Fix ElementClickInterceptedError in test_update_status_fails_for_admin The test injects a submit button into a table row to simulate an unauthorized PATCH request, verifying the server returns 422. The button was obscured by a full-row overlay, causing Selenium to throw ElementClickInterceptedError. Since the test exercises server-side authorization rather than UI behavior, switched to a JS click via execute_script to bypass the visual interception check. Co-Authored-By: Claude Sonnet 4.6 --- test/system/users_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/users_test.rb b/test/system/users_test.rb index 070c514..2a5eab3 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -229,7 +229,7 @@ class UsersTest < ApplicationSystemTestCase user = User.find_by_email!(first(:link).text) inject_button_to first('td:not(.link)'), "update status", user_path(user), method: :patch, params: {user: {status: User.statuses.keys.sample}}, data: {turbo: false} - click_on "update status" + execute_script("arguments[0].click()", find_button("update status")) end assert_title 'The change you wanted was rejected (422)' end