chore(attestation): card link to v2 if exist

This commit is contained in:
Colin Darie 2024-05-29 21:47:09 +02:00
parent 151b3f83ed
commit ffd8c5617a
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
3 changed files with 16 additions and 2 deletions

View file

@ -14,8 +14,14 @@ describe 'As an administrateur, I want to manage the procedures attestation',
before { login_as(administrateur.user, scope: :user) }
def find_attestation_card(with_nested_selector: nil)
attestation_path = if procedure.attestation_template&.version == 2 || procedure.feature_enabled?(:attestation_v2)
edit_admin_procedure_attestation_template_v2_path(procedure)
else
edit_admin_procedure_attestation_template_path(procedure)
end
full_selector = [
"a[href=\"#{edit_admin_procedure_attestation_template_path(procedure)}\"]",
"a[href=\"#{attestation_path}\"]",
with_nested_selector
].compact.join(" ")
page.find(full_selector)