DEV: Attempt to fix flaky signup spec (#29396)

This commit is contained in:
Jan Cernik 2024-10-24 13:05:41 -03:00 committed by GitHub
parent 82ad7f9d17
commit d80dcaa261
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 5 deletions

View File

@ -5,6 +5,7 @@ module PageObjects
class Base class Base
include Capybara::DSL include Capybara::DSL
include RSpec::Matchers include RSpec::Matchers
include SystemHelpers
BODY_SELECTOR = "" BODY_SELECTOR = ""

View File

@ -31,8 +31,13 @@ module PageObjects
click("#login-link") click("#login-link")
end end
def click_create_account def click_create_account(expect_success: true)
click(".modal.create-account .btn-primary") 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
end
end end
def has_password_input? def has_password_input?

View File

@ -31,8 +31,11 @@ module PageObjects
click("#login-link") click("#login-link")
end end
def click_create_account def click_create_account(expect_success: true)
click(".signup-fullpage .btn-primary") 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
end
end end
def has_password_input? def has_password_input?

View File

@ -131,7 +131,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|
.fill_email("johndoe@example.com") .fill_email("johndoe@example.com")
.fill_username("john") .fill_username("john")
.fill_password("supersecurepassword") .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_content(I18n.t("js.user_fields.required", name: "Occupation"))
expect(signup_form).to have_no_css(".account-created") expect(signup_form).to have_no_css(".account-created")
end end