Merge pull request #10720 from tchak/capybara-playwright-driver
use playwright driver
This commit is contained in:
commit
763fdc95d9
20 changed files with 92 additions and 60 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -137,6 +137,9 @@ jobs:
|
|||
- name: Setup the app runtime and dependencies
|
||||
uses: ./.github/actions/ci-setup-rails
|
||||
|
||||
- name: Setup playwright
|
||||
run: bunx playwright install chromium
|
||||
|
||||
- name: Pre-compile assets
|
||||
uses: ./.github/actions/ci-setup-assets
|
||||
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -19,6 +19,7 @@ gem 'anchored'
|
|||
gem 'bcrypt'
|
||||
gem 'bootsnap', '>= 1.4.4', require: false # Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'browser'
|
||||
gem 'capybara-playwright-driver'
|
||||
gem 'charlock_holmes'
|
||||
gem 'chartkick'
|
||||
gem 'chunky_png'
|
||||
|
|
|
@ -157,6 +157,10 @@ GEM
|
|||
capybara-email (3.0.2)
|
||||
capybara (>= 2.4, < 4.0)
|
||||
mail
|
||||
capybara-playwright-driver (0.5.2)
|
||||
addressable
|
||||
capybara
|
||||
playwright-ruby-client (>= 1.16.0)
|
||||
capybara-screenshot (1.0.26)
|
||||
capybara (>= 1.0, < 4)
|
||||
launchy
|
||||
|
@ -483,6 +487,9 @@ GEM
|
|||
pdf-core (0.9.0)
|
||||
pg (1.5.6)
|
||||
phonelib (0.8.8)
|
||||
playwright-ruby-client (1.46.0)
|
||||
concurrent-ruby (>= 1.1.6)
|
||||
mime-types (>= 3.0)
|
||||
prawn (2.4.0)
|
||||
pdf-core (~> 0.9.0)
|
||||
ttfunk (~> 1.7)
|
||||
|
@ -899,6 +906,7 @@ DEPENDENCIES
|
|||
browser
|
||||
capybara
|
||||
capybara-email
|
||||
capybara-playwright-driver
|
||||
capybara-screenshot
|
||||
charlock_holmes
|
||||
chartkick
|
||||
|
|
|
@ -20,6 +20,7 @@ FileUtils.chdir APP_ROOT do
|
|||
# Install JavaScript dependencies
|
||||
system! 'bun --version'
|
||||
system! 'bun install'
|
||||
system! 'bunx playwright install chromium'
|
||||
|
||||
if ENV["UPDATE_WEBDRIVER"]
|
||||
puts "\n== Updating webdrivers =="
|
||||
|
|
|
@ -24,6 +24,14 @@ def setup_driver(app, download_path, options)
|
|||
end
|
||||
end
|
||||
|
||||
Capybara.register_driver :playwright do |app|
|
||||
Capybara::Playwright::Driver.new(app,
|
||||
browser_type: (ENV['PLAYWRIGHT_BROWSER'] || 'chromium').to_sym, # :chromium (default) or :firefox, :webkit
|
||||
headless: ENV['NO_HEADLESS'].blank?,
|
||||
locale: Rails.application.config.i18n.default_locale,
|
||||
downloadsPath: Capybara.save_path)
|
||||
end
|
||||
|
||||
Capybara.register_driver :chrome do |app|
|
||||
options = Selenium::WebDriver::Chrome::Options.new
|
||||
options.add_argument('--no-sandbox') unless ENV['SANDBOX']
|
||||
|
@ -62,6 +70,10 @@ Capybara::Screenshot.prune_strategy = :keep_last_run
|
|||
Capybara::Screenshot.register_driver :chrome do |driver, path|
|
||||
driver.save_screenshot(path)
|
||||
end
|
||||
# Tell Capybara::Screenshot how to take screenshots when using the playwright driver
|
||||
Capybara::Screenshot.register_driver :playwright do |driver, path|
|
||||
driver.save_screenshot(path)
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before(:each, type: :system) do
|
||||
|
@ -69,6 +81,10 @@ RSpec.configure do |config|
|
|||
end
|
||||
|
||||
config.before(:each, type: :system, js: true) do
|
||||
driven_by :playwright
|
||||
end
|
||||
|
||||
config.before(:each, type: :system, chrome: true) do
|
||||
driven_by :chrome
|
||||
end
|
||||
|
||||
|
|
|
@ -96,6 +96,13 @@ module SystemHelpers
|
|||
end
|
||||
end
|
||||
|
||||
def playwright_debug
|
||||
page.driver.with_playwright_page do |page|
|
||||
page.context.enable_debug_console!
|
||||
page.pause
|
||||
end
|
||||
end
|
||||
|
||||
def pause
|
||||
$stderr.write 'Spec paused. Press enter to continue:'
|
||||
$stdin.gets
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'wcag rules for usager', js: true do
|
||||
describe 'wcag rules for usager', chrome: true do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :for_individual) }
|
||||
let(:password) { 'a very complicated password' }
|
||||
let(:litteraire_user) { create(:user, password: password) }
|
||||
|
|
|
@ -17,7 +17,7 @@ describe 'As an administrateur', js: true do
|
|||
end
|
||||
end
|
||||
|
||||
scenario 'I can register', js: true do
|
||||
scenario 'I can register' do
|
||||
expect(new_admin.reload.user.active?).to be(false)
|
||||
|
||||
confirmation_email = open_email(admin_email)
|
||||
|
|
|
@ -144,7 +144,8 @@ describe 'As an administrateur, I want to manage the procedure’s attestation',
|
|||
}
|
||||
|
||||
fill_in "Contenu du pied de page", with: ["line1", "line2", "line3", "line4"].join("\n")
|
||||
expect(page).to have_field("Contenu du pied de page", with: "line1\nline2\nline3line4")
|
||||
# FIXME we should get line1\nline2\nline3line4 instead of line1\nline2\nline3\nline4 because row is set to 3
|
||||
expect(page).to have_field("Contenu du pied de page", with: "line1\nline2\nline3\nline4")
|
||||
|
||||
click_on "Publier"
|
||||
expect(attestation.reload).to be_published
|
||||
|
|
|
@ -146,10 +146,7 @@ describe 'Inviting an expert:' do
|
|||
click_on '1 avis à donner'
|
||||
click_on avis.dossier.user.email
|
||||
|
||||
# click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
||||
# For some reason, clicking the download link does not trigger the download in the headless browser
|
||||
# for some member of the team, so we need to go to the download link directly
|
||||
visit telecharger_pjs_expert_avis_path(avis.dossier.procedure, avis)
|
||||
click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
||||
|
||||
DownloadHelpers.wait_for_download
|
||||
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
|
||||
|
|
|
@ -9,7 +9,7 @@ describe 'BatchOperation a dossier:', js: true do
|
|||
let(:procedure) { create(:simple_procedure, :published, instructeurs: [instructeur], administrateurs: [administrateurs(:default_admin)]) }
|
||||
|
||||
context 'with an instructeur' do
|
||||
scenario 'create a BatchOperation' do
|
||||
scenario 'create a BatchOperation', chrome: true do
|
||||
dossier_1 = create(:dossier, :accepte, procedure: procedure)
|
||||
dossier_2 = create(:dossier, :accepte, procedure: procedure)
|
||||
dossier_3 = create(:dossier, :accepte, procedure: procedure)
|
||||
|
|
|
@ -52,7 +52,8 @@ describe 'Instructing a dossier:', js: true do
|
|||
click_on 'Instruire le dossier'
|
||||
|
||||
within('.instruction-button') do
|
||||
click_on 'Accepter'
|
||||
# FIXME click_on 'Accepter' is not working for some reason
|
||||
find_link('Accepter').click
|
||||
end
|
||||
|
||||
within('.accept.motivation') do
|
||||
|
@ -210,7 +211,7 @@ describe 'Instructing a dossier:', js: true do
|
|||
expect(Archive.first.month).not_to be_nil
|
||||
end
|
||||
end
|
||||
context 'with dossiers having attached files', js: true do
|
||||
context 'with dossiers having attached files' do
|
||||
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur]) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let(:champ) { dossier.champs_public.first }
|
||||
|
@ -231,10 +232,7 @@ describe 'Instructing a dossier:', js: true do
|
|||
|
||||
scenario 'A instructeur can download an archive containing a single attachment' do
|
||||
find(:css, '[aria-controls=print-pj-menu]').click
|
||||
# click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
||||
# For some reason, clicking the download link does not trigger the download in the headless browser
|
||||
# for some member of the team, so we need to go to the download link directly
|
||||
visit telecharger_pjs_instructeur_dossier_path(procedure, dossier)
|
||||
click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
||||
|
||||
DownloadHelpers.wait_for_download
|
||||
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
|
||||
|
@ -254,7 +252,9 @@ describe 'Instructing a dossier:', js: true do
|
|||
content_type: "application/pdf",
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE })
|
||||
|
||||
visit telecharger_pjs_instructeur_dossier_path(procedure, dossier)
|
||||
find(:css, '[aria-controls=print-pj-menu]').click
|
||||
click_on 'Télécharger le dossier et toutes ses pièces jointes'
|
||||
|
||||
DownloadHelpers.wait_for_download
|
||||
files = ZipTricks::FileReader.read_zip_structure(io: File.open(DownloadHelpers.download))
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ describe "procedure filters" do
|
|||
end
|
||||
end
|
||||
|
||||
scenario "should add be able to add created_at column", js: true do
|
||||
scenario "should add be able to add created_at column", chrome: true do
|
||||
add_column("Créé le")
|
||||
within ".dossiers-table" do
|
||||
expect(page).to have_link("Créé le")
|
||||
|
@ -51,7 +51,7 @@ describe "procedure filters" do
|
|||
end
|
||||
end
|
||||
|
||||
scenario "should add be able to add and remove custom type_de_champ column", js: true do
|
||||
scenario "should add be able to add and remove custom type_de_champ column", chrome: true do
|
||||
add_column(type_de_champ.libelle)
|
||||
within ".dossiers-table" do
|
||||
expect(page).to have_link(type_de_champ.libelle)
|
||||
|
@ -206,7 +206,7 @@ describe "procedure filters" do
|
|||
fill_in "Valeur", with: filter_value
|
||||
when :date
|
||||
find("input#value[type=date]", visible: true)
|
||||
fill_in "Valeur", with: filter_value
|
||||
fill_in "Valeur", with: Date.parse(filter_value)
|
||||
when :enum
|
||||
find("select#value", visible: false)
|
||||
select filter_value, from: "Valeur"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'The user' do
|
||||
describe 'The user', js: true do
|
||||
let(:password) { SECURE_PASSWORD }
|
||||
let!(:user) { create(:user, password: password) }
|
||||
|
||||
|
@ -8,7 +8,7 @@ describe 'The user' do
|
|||
let(:user_dossier) { user.dossiers.first }
|
||||
let!(:dossier_to_link) { create(:dossier) }
|
||||
|
||||
scenario 'fill a dossier', js: true, vcr: true do
|
||||
scenario 'fill a dossier', vcr: true do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -19,9 +19,9 @@ describe 'The user' do
|
|||
# fill data
|
||||
fill_in('text', with: 'super texte', match: :first)
|
||||
fill_in('textarea', with: 'super textarea')
|
||||
fill_in('date', with: '12-12-2012', match: :first)
|
||||
fill_in('date', with: Date.parse('2012-12-12'), match: :first)
|
||||
fill_in('datetime', with: Time.zone.parse('2023-01-06T07:05'))
|
||||
find("input[type=datetime-local]").send_keys(:arrow_up).send_keys(:arrow_down) # triggers onChange
|
||||
find("input[type=datetime-local]").send_keys('ArrowUp').send_keys('ArrowDown') # triggers onChange
|
||||
# fill_in('number', with: '42'), deadchamp, should be migrated to textchamp
|
||||
fill_in('decimal_number', with: '17')
|
||||
fill_in('integer_number', with: '12')
|
||||
|
@ -125,7 +125,7 @@ describe 'The user' do
|
|||
expect(page).to have_text('file.pdf')
|
||||
end
|
||||
|
||||
scenario 'fill nothing and every error anchor links points to an existing element', js: true do
|
||||
scenario 'fill nothing and every error anchor links points to an existing element' do
|
||||
log_in(user, procedure)
|
||||
fill_individual
|
||||
click_on 'Déposer le dossier'
|
||||
|
@ -141,7 +141,7 @@ describe 'The user' do
|
|||
create(:procedure, :published, :for_individual, types_de_champ_public: [{ type: :repetition, mandatory: true, children: [{ libelle: 'sub type de champ' }] }])
|
||||
end
|
||||
|
||||
scenario 'fill a dossier with repetition', js: true do
|
||||
scenario 'fill a dossier with repetition' do
|
||||
log_in(user, procedure_with_repetition)
|
||||
|
||||
fill_individual
|
||||
|
@ -184,7 +184,7 @@ describe 'The user' do
|
|||
])
|
||||
}
|
||||
|
||||
scenario 'save an incomplete dossier as draft but cannot not submit it', js: true do
|
||||
scenario 'save an incomplete dossier as draft but cannot not submit it' do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -219,7 +219,7 @@ describe 'The user' do
|
|||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
|
||||
scenario 'fill address not in BAN', js: true do
|
||||
scenario 'fill address not in BAN' do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -230,7 +230,7 @@ describe 'The user' do
|
|||
expect(champ_for('address').full_address?).to be_falsey
|
||||
end
|
||||
|
||||
scenario 'numbers champs formatting', js: true do
|
||||
scenario 'numbers champs formatting' do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -287,7 +287,7 @@ describe 'The user' do
|
|||
}
|
||||
end
|
||||
|
||||
scenario 'extends dossier experation date more than one time, ', js: true do
|
||||
scenario 'extends dossier experation date more than one time, ' do
|
||||
simple_procedure.update(procedure_expires_when_termine_enabled: true)
|
||||
user_old_dossier = create(:dossier,
|
||||
procedure: simple_procedure,
|
||||
|
@ -312,7 +312,7 @@ describe 'The user' do
|
|||
let(:procedure_with_pjs) { create(:procedure, :published, :for_individual, types_de_champ_public: [{ type: :piece_justificative, mandatory: true, libelle: 'Pièce justificative 1' }, { type: :piece_justificative, mandatory: true, libelle: 'Pièce justificative 2' }]) }
|
||||
let(:old_procedure_with_disabled_pj_validation) { create(:procedure, :published, :for_individual, types_de_champ_public: [{ type: :piece_justificative, mandatory: true, libelle: 'Pièce justificative 1', skip_pj_validation: true }]) }
|
||||
|
||||
scenario 'add an attachment', js: true do
|
||||
scenario 'add an attachment' do
|
||||
log_in(user, procedure_with_pjs)
|
||||
fill_individual
|
||||
|
||||
|
@ -336,7 +336,7 @@ describe 'The user' do
|
|||
expect(page).to have_text('RIB.pdf')
|
||||
end
|
||||
|
||||
scenario 'add an invalid attachment on an old procedure where pj validation is disabled', js: true do
|
||||
scenario 'add an invalid attachment on an old procedure where pj validation is disabled' do
|
||||
log_in(user, old_procedure_with_disabled_pj_validation)
|
||||
fill_individual
|
||||
|
||||
|
@ -345,7 +345,7 @@ describe 'The user' do
|
|||
expect(page).to have_no_text('La pièce justificative n’est pas d’un type accepté')
|
||||
end
|
||||
|
||||
scenario 'retry on transcient upload error', js: true do
|
||||
scenario 'retry on transcient upload error' do
|
||||
log_in(user, procedure_with_pjs)
|
||||
fill_individual
|
||||
|
||||
|
@ -374,7 +374,7 @@ describe 'The user' do
|
|||
expect(page).to have_text('file.pdf')
|
||||
end
|
||||
|
||||
scenario "upload multiple pieces justificatives on same champ", js: true do
|
||||
scenario "upload multiple pieces justificatives on same champ" do
|
||||
log_in(user, procedure_with_pjs)
|
||||
fill_individual
|
||||
|
||||
|
@ -437,7 +437,7 @@ describe 'The user' do
|
|||
])
|
||||
end
|
||||
|
||||
scenario 'submit a dossier with an hidden mandatory champ within a repetition', js: true do
|
||||
scenario 'submit a dossier with an hidden mandatory champ within a repetition' do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -467,7 +467,7 @@ describe 'The user' do
|
|||
])
|
||||
end
|
||||
|
||||
scenario 'fill a dossier', js: true do
|
||||
scenario 'fill a dossier' do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -499,7 +499,7 @@ describe 'The user' do
|
|||
])
|
||||
end
|
||||
|
||||
scenario 'submit a dossier with an hidden mandatory champ ', js: true do
|
||||
scenario 'submit a dossier with an hidden mandatory champ ' do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -508,7 +508,7 @@ describe 'The user' do
|
|||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
|
||||
scenario 'cannot submit a reveal dossier with a revealed mandatory champ ', js: true do
|
||||
scenario 'cannot submit a reveal dossier with a revealed mandatory champ ' do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -540,7 +540,7 @@ describe 'The user' do
|
|||
])
|
||||
end
|
||||
|
||||
scenario 'fill a dossier', js: true do
|
||||
scenario 'fill a dossier' do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -589,7 +589,7 @@ describe 'The user' do
|
|||
end
|
||||
|
||||
context 'draft autosave' do
|
||||
scenario 'autosave a draft', js: true do
|
||||
scenario 'autosave a draft' do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -604,7 +604,7 @@ describe 'The user' do
|
|||
expect(page).to have_field('texte obligatoire', with: 'a valid user input')
|
||||
end
|
||||
|
||||
scenario 'retry on autosave error', :capybara_ignore_server_errors, js: true do
|
||||
scenario 'retry on autosave error', :capybara_ignore_server_errors do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -624,7 +624,7 @@ describe 'The user' do
|
|||
expect(page).to have_field('texte obligatoire', with: 'a valid user input')
|
||||
end
|
||||
|
||||
scenario 'autosave redirects to sign-in after being disconnected', js: true do
|
||||
scenario 'autosave redirects to sign-in after being disconnected' do
|
||||
log_in(user, simple_procedure)
|
||||
fill_individual
|
||||
|
||||
|
@ -632,7 +632,6 @@ describe 'The user' do
|
|||
# (either because signing-out in another tab, or because the session cookie expired)
|
||||
logout(:user)
|
||||
fill_in('texte obligatoire', with: 'a valid user input')
|
||||
blur
|
||||
|
||||
# … they are redirected to the sign-in page.
|
||||
expect(page).to have_current_path(new_user_session_path)
|
||||
|
|
|
@ -44,11 +44,10 @@ describe 'Creating a new dossier:', js: true do
|
|||
let(:expected_birthday) { Date.new(1987, 12, 10) }
|
||||
|
||||
before do
|
||||
fill_in 'Date de naissance', with: birthday_format
|
||||
fill_in 'Date de naissance', with: expected_birthday
|
||||
end
|
||||
|
||||
context 'when the birthday is asked' do
|
||||
let(:birthday_format) { '12-10-1987' }
|
||||
it_behaves_like 'the user can create a new draft'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,14 +22,14 @@ describe 'dropdown list with other option activated', js: true do
|
|||
]
|
||||
end
|
||||
|
||||
scenario 'Select other option and the other input hidden must appear', js: true do
|
||||
scenario 'Select other option and the other input hidden must appear' do
|
||||
fill_individual
|
||||
|
||||
find('.fr-fieldset__content .fr-radio-group:last-of-type input').select_option
|
||||
choose "Autre"
|
||||
expect(page).to have_selector('.drop_down_other', visible: true)
|
||||
end
|
||||
|
||||
scenario "Getting back from other save the new option", js: true do
|
||||
scenario "Getting back from other save the new option" do
|
||||
fill_individual
|
||||
|
||||
choose "Autre"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Dossier en_construction" do
|
||||
describe "Dossier en_construction", js: true do
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure) { create(:procedure, :for_individual, types_de_champ_public: [{ type: :piece_justificative }, { type: :titre_identite }]) }
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_individual, :with_populated_champs, user:, procedure:) }
|
||||
|
@ -13,7 +13,7 @@ describe "Dossier en_construction" do
|
|||
dossier.find_editing_fork(dossier.user).champs_public.find { _1.stable_id == tdc.stable_id }
|
||||
}
|
||||
|
||||
scenario 'delete a non mandatory piece justificative', js: true do
|
||||
scenario 'delete a non mandatory piece justificative' do
|
||||
visit_dossier(dossier)
|
||||
|
||||
expect(page).not_to have_button("Remplacer")
|
||||
|
@ -28,7 +28,7 @@ describe "Dossier en_construction" do
|
|||
tdc.update_attribute(:mandatory, true)
|
||||
end
|
||||
|
||||
scenario 'remplace a mandatory piece justificative', js: true do
|
||||
scenario 'remplace a mandatory piece justificative' do
|
||||
visit_dossier(dossier)
|
||||
|
||||
click_on "Supprimer le fichier toto.txt"
|
||||
|
@ -52,7 +52,7 @@ describe "Dossier en_construction" do
|
|||
tdc.update_attribute(:mandatory, true)
|
||||
end
|
||||
|
||||
scenario 'remplace a mandatory titre identite', js: true do
|
||||
scenario 'remplace a mandatory titre identite' do
|
||||
visit_dossier(dossier)
|
||||
|
||||
click_on "Supprimer le fichier toto.png"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'linked dropdown lists' do
|
||||
describe 'linked dropdown lists', js: true do
|
||||
let(:password) { SECURE_PASSWORD }
|
||||
let!(:user) { create(:user, password: password) }
|
||||
|
||||
|
@ -21,7 +21,7 @@ describe 'linked dropdown lists' do
|
|||
let(:user_dossier) { user.dossiers.first }
|
||||
context 'not mandatory' do
|
||||
let(:mandatory) { false }
|
||||
scenario 'change primary value, secondary options are updated', js: true do
|
||||
scenario 'change primary value, secondary options are updated' do
|
||||
log_in(user.email, password, procedure)
|
||||
|
||||
fill_individual
|
||||
|
@ -44,7 +44,7 @@ describe 'linked dropdown lists' do
|
|||
context 'mandatory' do
|
||||
let(:mandatory) { true }
|
||||
|
||||
scenario 'change primary value, secondary options are updated', js: true do
|
||||
scenario 'change primary value, secondary options are updated' do
|
||||
log_in(user.email, password, procedure)
|
||||
|
||||
fill_individual
|
||||
|
|
|
@ -58,7 +58,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
context 'when there is more than one page' do
|
||||
let(:dossiers_per_page) { 2 }
|
||||
|
||||
scenario 'the user can navigate through the other pages' do
|
||||
scenario 'the user can navigate through the other pages', chrome: true do
|
||||
expect(page).not_to have_link(dossier_en_instruction.procedure.libelle)
|
||||
page.click_link("Suivant")
|
||||
page.click_link("Suivant")
|
||||
|
@ -184,7 +184,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
expect(page).not_to have_link('Supprimer le dossier', href: dossier_path(dossier_en_instruction))
|
||||
end
|
||||
|
||||
context 'when user clicks on delete button', js: true do
|
||||
context 'when user clicks on delete button' do
|
||||
scenario 'the dossier is deleted' do
|
||||
expect(page).to have_content(dossier_en_construction.procedure.libelle)
|
||||
within(:css, ".card", match: :first) do
|
||||
|
@ -207,7 +207,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
expect(page).to have_link(nil, href: clone_dossier_path(dossier_en_instruction))
|
||||
end
|
||||
|
||||
context 'when user clicks on clone button', js: true do
|
||||
context 'when user clicks on clone button' do
|
||||
scenario 'the dossier is cloned' do
|
||||
within(:css, ".card", match: :first) do
|
||||
click_on 'Autres actions'
|
||||
|
@ -227,7 +227,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
expect(page).to have_link('Télécharger mon dossier', href: dossier_path("#{dossier_traite_expire.id}.pdf"))
|
||||
end
|
||||
|
||||
context 'when user clicks on restore button', js: true do
|
||||
context 'when user clicks on restore button' do
|
||||
scenario 'the dossier is restored' do
|
||||
click_on "3 supprimés"
|
||||
expect(page).to have_content(dossier_en_construction_supprime.procedure.libelle)
|
||||
|
@ -238,7 +238,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when user clicks on restore and extend button', js: true do
|
||||
context 'when user clicks on restore and extend button' do
|
||||
scenario 'the dossier is restored and extended' do
|
||||
click_on "3 supprimés"
|
||||
expect(page).to have_content(dossier_en_construction_expire.procedure.libelle)
|
||||
|
|
|
@ -36,7 +36,7 @@ describe 'Managing password:', js: true do
|
|||
let(:weak_password) { '12345678' }
|
||||
let(:strong_password) { 'a new, long, and complicated password!' }
|
||||
|
||||
scenario 'an admin can reset their password', js: true do
|
||||
scenario 'an admin can reset their password' do
|
||||
visit root_path
|
||||
within('.fr-header .fr-container .fr-header__tools .fr-btns-group') do
|
||||
click_on 'Se connecter'
|
||||
|
@ -75,7 +75,7 @@ describe 'Managing password:', js: true do
|
|||
let(:weak_password) { '12345678' }
|
||||
let(:strong_password) { 'a new, long, and complicated password!' }
|
||||
|
||||
scenario 'a super-admin can reset their password', js: true do
|
||||
scenario 'a super-admin can reset their password' do
|
||||
visit manager_root_path
|
||||
click_on 'Mot de passe oublié'
|
||||
expect(page).to have_current_path(new_super_admin_password_path)
|
||||
|
|
Loading…
Reference in a new issue