Merge pull request #3912 from betagouv/improve-specs

Amélioration de la fiabilité des tests d'acceptance
This commit is contained in:
Pierre de La Morinerie 2019-06-03 14:07:44 +02:00 committed by GitHub
commit c7cde75b53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -69,6 +69,11 @@ jobs:
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test" DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"
name: Create DB name: Create DB
command: bundle exec rake db:create db:schema:load db:migrate RAILS_ENV=test command: bundle exec rake db:create db:schema:load db:migrate RAILS_ENV=test
- run:
environment:
RAILS_ENV: test
name: Precompile Webpack assets
command: bin/webpack
- run: - run:
environment: environment:
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test" DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"

View file

@ -121,14 +121,14 @@ feature 'As an administrateur I can edit types de champ', js: true do
it "Add carte champ" do it "Add carte champ" do
select('Carte', from: 'champ-0-type_champ') select('Carte', from: 'champ-0-type_champ')
fill_in 'champ-0-libelle', with: 'libellé de champ carte' fill_in 'champ-0-libelle', with: 'Libellé de champ carte', fill_options: { clear: :backspace }
blur blur
check 'Quartiers prioritaires' check 'Quartiers prioritaires'
expect(page).to have_content('Formulaire enregistré') expect(page).to have_content('Formulaire enregistré')
preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' } preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' }
within_window(preview_window) do within_window(preview_window) do
expect(page).to have_content('libellé de champ carte') expect(page).to have_content('Libellé de champ carte')
expect(page).to have_content('Quartiers prioritaires') expect(page).to have_content('Quartiers prioritaires')
expect(page).not_to have_content('Cadastres') expect(page).not_to have_content('Cadastres')
end end

View file

@ -40,7 +40,7 @@ end
Capybara.register_driver :headless_chrome do |app| Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: ['headless', 'disable-gpu', 'disable-dev-shm-usage', 'disable-software-rasterizer', 'mute-audio', 'window-size=1440,900'] } chromeOptions: { args: ['headless', 'disable-dev-shm-usage', 'disable-software-rasterizer', 'mute-audio', 'window-size=1440,900'] }
) )
Capybara::Selenium::Driver.new app, Capybara::Selenium::Driver.new app,