Skip to content

Commit d8796f0

Browse files
committed
test: ajoute les scénarios cucumber du choix de mode par lot (FAS-561)
Couvre l'affichage des options selon le mode candidat, le blocage du bouton Continuer tant qu'au moins un lot seul et un lot groupement (ou un lot groupement en mode groupement pur) ne sont pas choisis, le pré-positionnement par défaut, le regroupement par typologie, l'action de masse et la navigation avant/arrière dans le wizard.
1 parent a612dfc commit d8796f0

2 files changed

Lines changed: 148 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Feature: Mandataire selects lots and their response mode
2+
3+
As a mandataire candidate
4+
I want to choose, for each lot, whether I apply alone, as part of the groupement, or not at all
5+
So that mixed scenarios are covered
6+
7+
Background:
8+
Given the groupement feature flag is enabled
9+
And a multi-type public market with lots exists
10+
And a candidate starts a new application for the multi-type market
11+
12+
@javascript
13+
Scenario: Mandataire in mixte mode sees the three options per lot
14+
When I choose the candidacy mode "mixte"
15+
Then I should see "Sélectionnez les lots pour la candidature"
16+
And each lot should offer the options "Seul", "En groupement" and "Ne pas répondre"
17+
18+
@javascript
19+
Scenario: Mandataire in groupement-only mode sees only two options per lot
20+
When I choose the candidacy mode "groupement"
21+
Then each lot should offer the options "En groupement" and "Ne pas répondre"
22+
And the lot option "Seul" should not be visible
23+
24+
@javascript
25+
Scenario: All lots are pre-selected on En groupement by default
26+
When I choose the candidacy mode "groupement"
27+
Then every lot should be set to "En groupement"
28+
29+
@javascript
30+
Scenario: Continue button is disabled until at least one solo and one groupement lot are set in mixte mode
31+
When I choose the candidacy mode "mixte"
32+
And I set lot "Lot 1 - Gros œuvre" to "solo"
33+
And I set lot "Lot 2 - Charpente" to "solo"
34+
And I set lot "Lot 3 - Prestations SI" to "solo"
35+
Then the "Continuer" button should be disabled
36+
When I set lot "Lot 3 - Prestations SI" to "groupement"
37+
Then the "Continuer" button should be enabled
38+
39+
@javascript
40+
Scenario: Continue button is disabled until at least one lot is set to groupement in groupement-only mode
41+
When I choose the candidacy mode "groupement"
42+
And I set lot "Lot 1 - Gros œuvre" to "none"
43+
And I set lot "Lot 2 - Charpente" to "none"
44+
And I set lot "Lot 3 - Prestations SI" to "none"
45+
Then the "Continuer" button should be disabled
46+
When I set lot "Lot 3 - Prestations SI" to "groupement"
47+
Then the "Continuer" button should be enabled
48+
49+
@javascript
50+
Scenario: The mixed mode banner is shown in mixte mode
51+
When I choose the candidacy mode "mixte"
52+
Then I should see "Vous devez sélectionner au moins un lot"
53+
54+
@javascript
55+
Scenario: The mixed mode banner is not shown in groupement-only mode
56+
When I choose the candidacy mode "groupement"
57+
Then I should not see "Vous devez sélectionner au moins un lot"
58+
59+
@javascript
60+
Scenario: Lots are grouped by typology
61+
When I choose the candidacy mode "groupement"
62+
Then I should see a section for the lot typology "works"
63+
And I should see a section for the lot typology "services"
64+
65+
@javascript
66+
Scenario: Applying a mode to a whole typology updates every lot of that section
67+
When I choose the candidacy mode "groupement"
68+
And I apply "Ne pas répondre" to the typology "works"
69+
Then every lot of the typology "works" should be set to "Ne pas répondre"
70+
And every lot of the typology "services" should be set to "En groupement"
71+
72+
@javascript
73+
Scenario: A lot can be adjusted individually after a bulk action without affecting the others
74+
When I choose the candidacy mode "groupement"
75+
And I apply "Ne pas répondre" to the typology "works"
76+
And I set lot "Lot 1 - Gros œuvre" to "groupement"
77+
Then lot "Lot 1 - Gros œuvre" should be set to "En groupement"
78+
And lot "Lot 2 - Charpente" should be set to "Ne pas répondre"
79+
80+
@javascript
81+
Scenario: Mandataire submits the lot selection and reaches the grouping legal type step
82+
When I choose the candidacy mode "groupement"
83+
And I set lot "Lot 1 - Gros œuvre" to "groupement"
84+
And I click on "Continuer"
85+
Then I should be on the grouping legal type step
86+
87+
@javascript
88+
Scenario: Mandataire goes back from the grouping legal type step to review the lot selection
89+
When I choose the candidacy mode "groupement"
90+
And I set lot "Lot 1 - Gros œuvre" to "groupement"
91+
And I click on "Continuer"
92+
And I should be on the grouping legal type step
93+
And I click on "Précédent"
94+
Then I should see "Sélectionnez les lots pour la candidature"
95+
And lot "Lot 1 - Gros œuvre" should be set to "En groupement"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# frozen_string_literal: true
2+
3+
When('I set lot {string} to {string}') do |lot_name, mode|
4+
lot = Lot.find_by!(name: lot_name)
5+
find("label[for='lot_mode_#{lot.id}_#{mode}']").click
6+
end
7+
8+
When('I apply {string} to the typology {string}') do |label, market_type_code|
9+
section = find('.lot-selection-mode-group', text: I18n.t("market_types.#{market_type_code}"))
10+
within(section) { find('option', text: label).select_option }
11+
end
12+
13+
Then('each lot should offer the options {string}, {string} and {string}') do |*labels|
14+
labels.each { |label| expect(page).to have_css('.lot-mode-choice__label', text: label) }
15+
end
16+
17+
Then('each lot should offer the options {string} and {string}') do |first_label, second_label|
18+
expect(page).to have_css('.lot-mode-choice__label', text: first_label)
19+
expect(page).to have_css('.lot-mode-choice__label', text: second_label)
20+
end
21+
22+
Then('the lot option {string} should not be visible') do |label|
23+
expect(page).not_to have_css('.lot-mode-choice__label', text: label)
24+
end
25+
26+
Then('every lot should be set to {string}') do |label|
27+
mode = mode_key_for_label(label)
28+
page.all("input[name^='lot_modes'][value='#{mode}']").each do |radio|
29+
expect(radio).to be_checked
30+
end
31+
end
32+
33+
Then('lot {string} should be set to {string}') do |lot_name, label|
34+
lot = Lot.find_by!(name: lot_name)
35+
mode = mode_key_for_label(label)
36+
expect(page).to have_css("#lot_mode_#{lot.id}_#{mode}:checked", visible: :all)
37+
end
38+
39+
Then('every lot of the typology {string} should be set to {string}') do |market_type_code, label|
40+
mode = mode_key_for_label(label)
41+
market_type = MarketType.find_by!(code: market_type_code)
42+
Lot.where(market_type:).or(Lot.where(platform_market_type: market_type)).each do |lot|
43+
expect(page).to have_css("#lot_mode_#{lot.id}_#{mode}:checked", visible: :all)
44+
end
45+
end
46+
47+
Then('I should see a section for the lot typology {string}') do |market_type_code|
48+
expect(page).to have_css('.lot-selection-mode-group', text: I18n.t("market_types.#{market_type_code}"))
49+
end
50+
51+
def mode_key_for_label(label)
52+
%w[solo groupement none].find { |mode| I18n.t("candidate.lot_selection_modes.#{mode}") == label }
53+
end

0 commit comments

Comments
 (0)