Skip to content

Commit

Permalink
Update smoke test to work with one login
Browse files Browse the repository at this point in the history
The smoke test needs to be smarter now that we will introduce one login.

We need to check if one login is enabled but we don't have control over
the host app, as we use a remote host, when we deploy to review we use
the review app host, same with deploying to other envs.

This commit tries to make the smoke test smarted and tests one login or
magic link depending on what is the sign up method on the host.
  • Loading branch information
CatalinVoineag committed Dec 18, 2024
1 parent 25f95c8 commit 2a7e262
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions spec/smoke/candidate_login_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
RSpec.describe 'Smoke test', :smoke, type: :feature do
it 'allows new account creation' do
when_i_go_to_the_account_creation_page
when_i_choose_to_create_an_account
then_i_can_create_an_account

when_i_type_in_my_email_address
and_i_click_continue
then_i_have_been_sent_an_email
if magic_link_signup?
when_i_choose_to_create_an_account
then_i_can_create_an_account

when_i_type_in_my_email_address
and_i_click_continue
then_i_have_been_sent_an_email
else
and_i_click_continue
then_i_am_redirected_to_one_login
end
end

def magic_link_signup?
page.has_content?('Do you already have an account?')
end

def when_i_go_to_the_account_creation_page
Expand All @@ -33,4 +43,8 @@ def and_i_click_continue
def then_i_have_been_sent_an_email
expect(page).to have_content('Check your email')
end

def then_i_am_redirected_to_one_login
page.current_host == ENV.fetch('GOVUK_ONE_LOGIN_ISSUER_URL', '').chomp('/')
end
end

0 comments on commit 2a7e262

Please sign in to comment.