fix tests for autosave_brouillon
This commit is contained in:
parent
f9c4e967d6
commit
482bfdb059
2 changed files with 14 additions and 13 deletions
|
@ -42,8 +42,8 @@ feature 'The user' do
|
|||
fill_in('dossier_link', with: '123')
|
||||
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
|
||||
|
||||
click_on 'Enregistrer le brouillon'
|
||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
||||
blur
|
||||
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||
|
||||
# check data on the dossier
|
||||
expect(user_dossier.brouillon?).to be true
|
||||
|
@ -116,7 +116,8 @@ feature 'The user' do
|
|||
|
||||
expect(page).to have_content('Supprimer', count: 2)
|
||||
|
||||
click_on 'Enregistrer le brouillon'
|
||||
blur
|
||||
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||
|
||||
expect(page).to have_content('Supprimer', count: 2)
|
||||
|
||||
|
@ -124,13 +125,17 @@ feature 'The user' do
|
|||
click_on 'Supprimer l’élément'
|
||||
end
|
||||
|
||||
click_on 'Enregistrer le brouillon'
|
||||
blur
|
||||
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||
|
||||
expect(page).to have_content('Supprimer', count: 1)
|
||||
end
|
||||
|
||||
let(:simple_procedure) do
|
||||
tdcs = [build(:type_de_champ, mandatory: true, libelle: 'texte obligatoire')]
|
||||
tdcs = [
|
||||
build(:type_de_champ, mandatory: true, libelle: 'texte obligatoire'),
|
||||
build(:type_de_champ, mandatory: false, libelle: 'texte optionnel')
|
||||
]
|
||||
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
|
||||
end
|
||||
|
||||
|
@ -139,9 +144,9 @@ feature 'The user' do
|
|||
fill_individual
|
||||
|
||||
# Check an incomplete dossier can be saved as a draft, even when mandatory fields are missing
|
||||
click_on 'Enregistrer le brouillon'
|
||||
expect(user_dossier.reload.brouillon?).to be(true)
|
||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
||||
fill_in('texte optionnel', with: 'ça ne suffira pas')
|
||||
blur
|
||||
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||
|
||||
# Check an incomplete dossier cannot be submitted when mandatory fields are missing
|
||||
|
@ -185,7 +190,6 @@ feature 'The user' do
|
|||
expect(page).to have_text('RIB.pdf')
|
||||
|
||||
# Expect the submit buttons to be enabled
|
||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||
|
||||
# Reload the current page
|
||||
|
@ -226,7 +230,6 @@ feature 'The user' do
|
|||
attach_file('Pièce justificative 1', Rails.root + 'spec/fixtures/files/file.pdf')
|
||||
expect(page).to have_text('Une erreur s’est produite pendant l’envoi du fichier')
|
||||
expect(page).to have_button('Ré-essayer', visible: true)
|
||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||
|
||||
# Test that retrying after a failure works
|
||||
|
@ -234,7 +237,6 @@ feature 'The user' do
|
|||
click_on('Ré-essayer', visible: true)
|
||||
expect(page).to have_text('analyse antivirus en cours')
|
||||
expect(page).to have_text('file.pdf')
|
||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||
|
||||
# Reload the current page
|
||||
|
|
|
@ -53,8 +53,7 @@ feature 'Invitations' do
|
|||
expect(page).to have_no_selector('.button.invite-user-action')
|
||||
|
||||
fill_in 'Texte obligatoire', with: 'Some edited value'
|
||||
click_button 'Enregistrer le brouillon'
|
||||
expect(page).to have_text('Votre brouillon a bien été sauvegardé')
|
||||
blur
|
||||
expect(page).to have_field('Texte obligatoire', with: 'Some edited value')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue