forked from fixin.me/fixin.me
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 <a class="link"> 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 <noreply@anthropic.com>
This commit is contained in:
@@ -229,7 +229,7 @@ class UsersTest < ApplicationSystemTestCase
|
|||||||
user = User.find_by_email!(first(:link).text)
|
user = User.find_by_email!(first(:link).text)
|
||||||
inject_button_to first('td:not(.link)'), "update status", user_path(user), method: :patch,
|
inject_button_to first('td:not(.link)'), "update status", user_path(user), method: :patch,
|
||||||
params: {user: {status: User.statuses.keys.sample}}, data: {turbo: false}
|
params: {user: {status: User.statuses.keys.sample}}, data: {turbo: false}
|
||||||
click_on "update status"
|
execute_script("arguments[0].click()", find_button("update status"))
|
||||||
end
|
end
|
||||||
assert_title 'The change you wanted was rejected (422)'
|
assert_title 'The change you wanted was rejected (422)'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user