A platform for community discussion. Free, open, simple.
DEV: Attempt to fix flaky signup spec (#29396)
Jan Cernikd80dcaa2612a
diff --git a/spec/system/page_objects/modals/base.rb b/spec/system/page_objects/modals/base.rbindex 963800bf05e..51c174f2799 100644--- a/spec/system/page_objects/modals/base.rb+++ b/spec/system/page_objects/modals/base.rb@@ -5,6 +5,7 @@ module PageObjectsclass Baseinclude Capybara::DSLinclude RSpec::Matchers+ include SystemHelpersBODY_SELECTOR = ""diff --git a/spec/system/page_objects/modals/signup.rb b/spec/system/page_objects/modals/signup.rbindex 0dfacd68afe..2015b3b6f80 100644--- a/spec/system/page_objects/modals/signup.rb+++ b/spec/system/page_objects/modals/signup.rb@@ -31,8 +31,13 @@ module PageObjectsclick("#login-link")end- def click_create_account- click(".modal.create-account .btn-primary")+ def click_create_account(expect_success: true)+ try_until_success(timeout: 5) do+ click(".modal.create-account .btn-primary")+ if expect_success+ expect(page).to have_css(".modal.create-account .btn-primary.is-loading")+ end+ endenddef has_password_input?diff --git a/spec/system/page_objects/pages/signup.rb b/spec/system/page_objects/pages/signup.rbindex 9f2c2e30245..afe6c1de062 100644--- a/spec/system/page_objects/pages/signup.rb+++ b/spec/system/page_objects/pages/signup.rb@@ -31,8 +31,11 @@ module PageObjectsclick("#login-link")end- def click_create_account- click(".signup-fullpage .btn-primary")+ def click_create_account(expect_success: true)+ try_until_success(timeout: 5) do+ click(".signup-fullpage .btn-primary")+ expect(page).to have_css(".signup-fullpage .btn-primary.is-loading") if expect_success+ endenddef has_password_input?diff --git a/spec/system/signup_spec.rb b/spec/system/signup_spec.rbindex 8962e7f7042..7222e42d0d7 100644--- a/spec/system/signup_spec.rb+++ b/spec/system/signup_spec.rb@@ -131,7 +131,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|.fill_email("[email protected]").fill_username("john").fill_password("supersecurepassword")- .click_create_account+ .click_create_account(expect_success: false)expect(signup_form).to have_content(I18n.t("js.user_fields.required", name: "Occupation"))expect(signup_form).to have_no_css(".account-created")end