A platform for community discussion. Free, open, simple.
DEV: Improve `PageObjects::Pages::UserPreferencesSecurity#visit_second_factor` (#32017)
Alan Guo Xiang Tanac26a52c6d88
diff --git a/spec/system/email_change_spec.rb b/spec/system/email_change_spec.rbindex 4af59c10816..3d473eb8b23 100644--- a/spec/system/email_change_spec.rb+++ b/spec/system/email_change_spec.rb@@ -83,7 +83,7 @@ describe "Changing email", type: :system doauthenticator = page.driver.browser.add_virtual_authenticator(options)user_preferences_security_page.visit(user)- user_preferences_security_page.visit_second_factor(password)+ user_preferences_security_page.visit_second_factor(user, password)find(".security-key .new-security-key").clickexpect(user_preferences_security_page).to have_css("input#security-key-name")diff --git a/spec/system/forgot_password_spec.rb b/spec/system/forgot_password_spec.rbindex 34885e492b6..7a73d8fc038 100644--- a/spec/system/forgot_password_spec.rb+++ b/spec/system/forgot_password_spec.rb@@ -27,7 +27,7 @@ shared_examples "forgot password scenarios" dosign_in(user)user_preferences_security_page.visit(user)- user_preferences_security_page.visit_second_factor("supersecurepassword")+ user_preferences_security_page.visit_second_factor(user, "supersecurepassword")find(".security-key .new-security-key").clickexpect(user_preferences_security_page).to have_css("input#security-key-name")diff --git a/spec/system/page_objects/pages/user_preferences_security.rb b/spec/system/page_objects/pages/user_preferences_security.rbindex fe1abed1b90..6dbbc8538bd 100644--- a/spec/system/page_objects/pages/user_preferences_security.rb+++ b/spec/system/page_objects/pages/user_preferences_security.rb@@ -8,11 +8,11 @@ module PageObjectsselfend- def visit_second_factor(password)+ def visit_second_factor(user, password)click_button "Manage Two-Factor Authentication"find(".confirm-session input#password").fill_in(with: password)find(".confirm-session .btn-primary:not([disabled])").click- has_no_css?(".confirm-session")+ expect(page).to have_current_path("/u/#{user.username}/preferences/second-factor")selfendenddiff --git a/spec/system/user_page/user_preferences_security_spec.rb b/spec/system/user_page/user_preferences_security_spec.rbindex e96ef406d41..fbab198114e 100644--- a/spec/system/user_page/user_preferences_security_spec.rb+++ b/spec/system/user_page/user_preferences_security_spec.rb@@ -24,7 +24,7 @@ describe "User preferences | Security", type: :system doauthenticator = page.driver.browser.add_virtual_authenticator(options)user_preferences_security_page.visit(user)- user_preferences_security_page.visit_second_factor(password)+ user_preferences_security_page.visit_second_factor(user, password)find(".security-key .new-security-key").clickexpect(user_preferences_security_page).to have_css("input#security-key-name")