Tests
This commit is contained in:
parent
d6defce137
commit
a4b8d816de
7 changed files with 439 additions and 50 deletions
|
@ -43,9 +43,28 @@ describe 'France Connect Particulier Connexion' do
|
|||
before { page.find('.fr-connect').click }
|
||||
|
||||
scenario 'he is redirected to user dossiers page' do
|
||||
expect(page).to have_content('Dossiers')
|
||||
expect(page).to have_content("Choisissez votre e-mail de contact")
|
||||
expect(page).to have_selector("#use_france_connect_email_yes", visible: false, wait: 10)
|
||||
find('#use_france_connect_email_yes').click
|
||||
click_on 'Confirmer'
|
||||
expect(page).to have_content("Confirmation envoyée")
|
||||
click_on 'Continuer'
|
||||
expect(User.find_by(email: email)).not_to be nil
|
||||
end
|
||||
|
||||
scenario 'he can choose not to use FranceConnect email and input an alternative email' do
|
||||
expect(page).to have_content("Choisissez votre e-mail de contact")
|
||||
expect(page).to have_selector("#use_france_connect_email_no", visible: false, wait: 10)
|
||||
|
||||
find('#use_france_connect_email_no').click
|
||||
expect(page).to have_selector("input[name='alternative_email']", visible: true, wait: 10)
|
||||
|
||||
fill_in 'alternative_email', with: 'alternative@example.com'
|
||||
click_on 'Confirmer'
|
||||
expect(page).to have_content("Confirmation envoyée")
|
||||
click_on 'Continuer'
|
||||
expect(User.find_by(email: 'alternative@example.com')).not_to be nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'and an user exists with the same email' do
|
||||
|
@ -79,17 +98,18 @@ describe 'France Connect Particulier Connexion' do
|
|||
let!(:another_user) { create(:user, email: 'an_existing_email@a.com', password: SECURE_PASSWORD) }
|
||||
|
||||
scenario 'it uses another email that belongs to another account' do
|
||||
page.find('#it-is-not-mine').click
|
||||
fill_in 'email', with: 'an_existing_email@a.com'
|
||||
click_on 'Utiliser ce mail'
|
||||
find('label[for="it-is-not-mine"]').click
|
||||
|
||||
expect(page).to have_css('#password-for-another-account', visible: true)
|
||||
expect(page).to have_css('.new-account', visible: true)
|
||||
|
||||
within '#new-account-password-confirmation' do
|
||||
fill_in 'password', with: SECURE_PASSWORD
|
||||
click_on 'Fusionner les comptes'
|
||||
within '.new-account' do
|
||||
fill_in 'email', with: 'an_existing_email@a.com'
|
||||
click_on 'Utiliser ce mail'
|
||||
end
|
||||
|
||||
fill_in 'password-for-another-account', with: SECURE_PASSWORD
|
||||
last_button = all('input[type="submit"][value="Fusionner les comptes"]').last.click
|
||||
puts last_button.click
|
||||
expect(page).to have_content('Dossiers')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue