Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech: retry system tests JS seulement sur CI pour avoir les erreurs rapidement en local #9669

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true

config.retry_count_condition = proc do |ex|
if ENV["CI"] == "true" && ex.metadata[:js]
3
else # in dev we want to have real error fast
1
end
end

# callback to be run between retries
config.retry_callback = proc do |ex|
# run some additional clean up task - can be filtered by example metadata
Expand Down
2 changes: 1 addition & 1 deletion spec/system/accessibilite/wcag_usager_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'wcag rules for usager', js: true, retry: 3 do
describe 'wcag rules for usager', js: true do
let(:procedure) { create(:procedure, :published, :with_all_champs, :with_service, :for_individual) }
let(:password) { 'a very complicated password' }
let(:litteraire_user) { create(:user, password: password) }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/administrateurs/admin_creation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an administrateur', js: true, retry: 3 do
describe 'As an administrateur', js: true do
let(:super_admin) { create(:super_admin) }
let(:admin_email) { '[email protected]' }
let(:new_admin) { Administrateur.by_email(admin_email) }
Expand All @@ -15,7 +15,7 @@
end
end

scenario 'I can register', js: true, retry: 3 do
scenario 'I can register', js: true do
expect(new_admin.reload.user.active?).to be(false)

confirmation_email = open_email(admin_email)
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/annotations_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an administrateur I can edit annotation', js: true, retry: 3 do
describe 'As an administrateur I can edit annotation', js: true do
let(:administrateur) { procedure.administrateurs.first }
let(:procedure) { create(:procedure) }

Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/condition_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an administrateur I can edit types de champ condition', js: true, retry: 3 do
describe 'As an administrateur I can edit types de champ condition', js: true do
include Logic

let(:administrateur) { procedure.administrateurs.first }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Administrateurs can manage administrateurs', js: true, retry: 3 do
describe 'Administrateurs can manage administrateurs', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Creating a new procedure', js: true, retry: 3 do
describe 'Creating a new procedure', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'As an administrateur, I want to manage the procedure’s attestation', js: true, retry: 3 do
describe 'As an administrateur, I want to manage the procedure’s attestation', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/procedure_cloning_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'As an administrateur I wanna clone a procedure', js: true, retry: 3 do
describe 'As an administrateur I wanna clone a procedure', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/procedure_creation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Creating a new procedure', js: true, retry: 3 do
describe 'Creating a new procedure', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Manage procedure instructeurs', js: true, retry: 3 do
describe 'Manage procedure instructeurs', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/procedure_publish_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Publishing a procedure', js: true, retry: 3 do
describe 'Publishing a procedure', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/procedure_update_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'system/administrateurs/procedure_spec_helper'

describe 'Administrateurs can edit procedures', js: true, retry: 3 do
describe 'Administrateurs can edit procedures', js: true do
include ProcedureSpecHelper

let(:administrateur) { create(:administrateur) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/administrateurs/types_de_champ_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an administrateur I can edit types de champ', js: true, retry: 3 do
describe 'As an administrateur I can edit types de champ', js: true do
include ActionView::RecordIdentifier

let(:administrateur) { procedure.administrateurs.first }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/api_particulier/api_particulier_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'fetch API Particulier Data', js: true, retry: 3 do
describe 'fetch API Particulier Data', js: true do
let(:administrateur) { create(:administrateur) }

let(:expected_token) { 'd7e9c9f4c3ca00caadde31f50fd4521a' }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/experts/expert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
# scenario 'I can invite other experts' do
# end

context 'with dossiers having attached files', js: true, retry: 3 do
context 'with dossiers having attached files', js: true do
let(:path) { 'spec/fixtures/files/piece_justificative_0.pdf' }
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
expect(page).to have_content('Dossiers')
end

context 'and the user wants an email that belongs to another account', js: true, retry: 3 do
context 'and the user wants an email that belongs to another account', js: true do
let!(:another_user) { create(:user, email: '[email protected]', password: SECURE_PASSWORD) }

scenario 'it uses another email that belongs to another account' do
Expand Down
2 changes: 1 addition & 1 deletion spec/system/instructeurs/batch_operation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'BatchOperation a dossier:', js: true, retry: 3 do
describe 'BatchOperation a dossier:', js: true do
include ActionView::RecordIdentifier
include ActiveJob::TestHelper

Expand Down
2 changes: 1 addition & 1 deletion spec/system/instructeurs/expert_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'Inviting an expert:', js: true, retry: 3 do
describe 'Inviting an expert:', js: true do
include ActiveJob::TestHelper
include ActionView::Helpers

Expand Down
2 changes: 1 addition & 1 deletion spec/system/instructeurs/instructeur_creation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an instructeur', js: true, retry: 3 do
describe 'As an instructeur', js: true do
let(:administrateur) { create(:administrateur, :with_procedure) }
let(:procedure) { administrateur.procedures.first }
let(:instructeur_email) { '[email protected]' }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/instructeurs/instruction_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'Instructing a dossier:', js: true, retry: 3 do
describe 'Instructing a dossier:', js: true do
include ActiveJob::TestHelper
include Logic

Expand Down Expand Up @@ -211,7 +211,7 @@
expect(Archive.first.month).not_to be_nil
end
end
context 'with dossiers having attached files', js: true, retry: 3 do
context 'with dossiers having attached files', js: true do
let(:procedure) { create(:procedure, :published, :with_piece_justificative, instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:champ) { dossier.champs_public.first }
Expand Down
14 changes: 7 additions & 7 deletions spec/system/instructeurs/procedure_filters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
end
end

scenario "should add be able to add created_at column", js: true, retry: 3 do
scenario "should add be able to add created_at column", js: true do
add_column("Créé le")
within ".dossiers-table" do
expect(page).to have_link("Créé le")
expect(page).to have_link(new_unfollow_dossier.created_at.strftime('%d/%m/%Y'))
end
end

scenario "should add be able to add and remove custom type_de_champ column", js: true, retry: 3 do
scenario "should add be able to add and remove custom type_de_champ column", js: true do
add_column(type_de_champ.libelle)
within ".dossiers-table" do
expect(page).to have_link(type_de_champ.libelle)
Expand All @@ -62,7 +62,7 @@
end
end

scenario "should be able to add and remove filter", js: true, retry: 3 do
scenario "should be able to add and remove filter", js: true do
add_filter(type_de_champ.libelle, champ.value)

expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
Expand All @@ -86,7 +86,7 @@
end
end

scenario "should be able to user custom fiters", js: true, retry: 3 do
scenario "should be able to user custom fiters", js: true do
# use date filter
click_on 'Sélectionner un filtre'
select "En construction le", from: "Colonne"
Expand All @@ -112,7 +112,7 @@
end

describe 'with a vcr cached cassette' do
scenario "should be able to find by departements with custom enum lookup", js: true, retry: 3 do
scenario "should be able to find by departements with custom enum lookup", js: true do
departement_champ = new_unfollow_dossier.champs.find(&:departement?)
departement_champ.update!(value: 'Oise', external_id: '60')
departement_champ.reload
Expand All @@ -127,7 +127,7 @@
expect(page).to have_link(new_unfollow_dossier.id.to_s)
end

scenario "should be able to find by region with custom enum lookup", js: true, retry: 3 do
scenario "should be able to find by region with custom enum lookup", js: true do
region_champ = new_unfollow_dossier.champs.find(&:region?)
region_champ.update!(value: 'Bretagne', external_id: '53')
region_champ.reload
Expand All @@ -142,7 +142,7 @@
end
end

scenario "should be able to add and remove two filters for the same field", js: true, retry: 3 do
scenario "should be able to add and remove two filters for the same field", js: true do
add_filter(type_de_champ.libelle, champ.value)
add_filter(type_de_champ.libelle, champ_2.value)
add_enum_filter('Groupe instructeur', procedure.groupe_instructeurs.first.label)
Expand Down
2 changes: 1 addition & 1 deletion spec/system/instructeurs/procedure_sort_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe "procedure sort", js: true, retry: 3 do
describe "procedure sort", js: true do
let(:instructeur) { create(:instructeur) }
let(:procedure) { create(:procedure, :published, :with_type_de_champ, instructeurs: [instructeur]) }
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) }
Expand Down
2 changes: 1 addition & 1 deletion spec/system/integrateurs/procedure_prefilling_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'As an integrator:', js: true, retry: 3 do
describe 'As an integrator:', js: true do
let(:procedure) { create(:procedure, :for_individual, :published, opendata: true) }
let!(:type_de_champ) { create(:type_de_champ_text, procedure: procedure) }

Expand Down
2 changes: 1 addition & 1 deletion spec/system/routing/rules_full_scenario_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe 'The routing with rules', js: true, retry: 3 do
describe 'The routing with rules', js: true do
let(:password) { 'a very complicated password' }

let(:procedure) do
Expand Down
Loading