Skip to content

Commit a0f67e3

Browse files
authored
Merge branch 'master' into fix/remove-http-yaml
2 parents 0f17889 + fbabf4c commit a0f67e3

19 files changed

Lines changed: 88 additions & 51 deletions

.github/workflows/api-tests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ jobs:
4141
- name: Up for tests API
4242
run: docker compose up --build -d api db test_db
4343

44-
- name: Check types
45-
run: pnpm check-all
44+
- name: Tests API
45+
run: pnpm test:api
4646

4747
- name: Down for tests API
48+
if: always()
4849
run: docker compose down

.github/workflows/e2e.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: 🧪 E2E Tests
33
on:
44
deployment_status:
55

6+
concurrency:
7+
group: e2e-${{ github.event.deployment.environment }}
8+
cancel-in-progress: true
9+
610
permissions:
711
contents: read
812

@@ -38,6 +42,16 @@ jobs:
3842
echo "SITE_URL=https://egapro-preprod.ovh.fabrique.social.gouv.fr" >> $GITHUB_ENV
3943
echo "KEYCLOAK_URL=https://keycloak.undercloud.fabrique.social.gouv.fr" >> $GITHUB_ENV
4044
45+
- name: Wait for app and Keycloak to be ready
46+
run: |
47+
echo "Waiting for app at $SITE_URL ..."
48+
timeout 180 bash -c 'until curl -sf -o /dev/null "$SITE_URL"; do sleep 5; done'
49+
echo "✓ App is ready"
50+
51+
echo "Waiting for Keycloak realm egapro at $KEYCLOAK_URL ..."
52+
timeout 180 bash -c 'until curl -sf -o /dev/null "$KEYCLOAK_URL/realms/egapro"; do sleep 5; done'
53+
echo "✓ Keycloak is ready"
54+
4155
- name: Run test e2e
4256
run: |
4357
pnpm test:e2e:app -- --browser chrome

packages/api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tmp/
66
htmlcov/
77
site/
88
venv/
9+
.venv/
910
.env
1011
.history/
1112
settings.json

packages/api/egapro/schema/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44

55
def regions():
6-
return {"type": "string", "enum": constants.REGIONS.keys()}
6+
return {"type": "string", "enum": list(constants.REGIONS.keys())}
77

88

99
def departements():
10-
return {"type": "string", "enum": constants.DEPARTEMENTS.keys()}
10+
return {"type": "string", "enum": list(constants.DEPARTEMENTS.keys())}
1111

1212

1313
def naf():
14-
return {"type": "string", "enum": NAF.keys()}
14+
return {"type": "string", "enum": list(NAF.keys())}
1515

1616

1717
def code_pays():
18-
return {"type": "string", "enum": constants.PAYS_ISO_TO_LIB.keys()}
18+
return {"type": "string", "enum": list(constants.PAYS_ISO_TO_LIB.keys())}
1919

2020

2121
def years():

packages/app/cypress/e2e/declaration_1000_employees_firm.cy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -28,7 +29,7 @@ describe("Declaration", () => {
2829
cy.contains("a", "Suivant").click();
2930

3031
// Check if we're on the expected page
31-
cy.url().should("include", "/index-egapro/declaration/commencer");
32+
cy.checkUrl("/index-egapro/declaration/commencer");
3233
cy.selectByLabel(
3334
"Numéro Siren de l’entreprise ou de l’entreprise déclarant pour le compte de l'unité économique et sociale (UES) *",
3435
).select("384964508");
@@ -140,18 +141,18 @@ describe("Declaration", () => {
140141
cy.get("#content").click();
141142
cy.contains("button", "Suivant").click();
142143

143-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
144+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
144145
cy.get("#content").within(() => {
145146
cy.contains("span", "94").should("exist");
146147
});
147148
cy.contains("button", "Valider et transmettre les résultats").click();
148-
cy.contains("Votre déclaration a été transmise");
149+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
149150
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
150151
cy.contains("a", "Mes déclarations").click();
151152

152153
cy.checkUrl("/mon-espace/mes-declarations");
153154
cy.selectByLabel("Numéro Siren de l'entreprise").select("384964508");
154-
cy.contains("a", "384964508");
155+
cy.contains("a", "384964508", { timeout: 30000 });
155156
cy.contains("De 1000 à plus");
156157
});
157158
});

packages/app/cypress/e2e/declaration_1000_employees_firm_2.cy.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -28,7 +29,7 @@ describe("Declaration", () => {
2829
cy.contains("a", "Suivant").click();
2930

3031
// Check if we're on the expected page
31-
cy.url().should("include", "/index-egapro/declaration/commencer");
32+
cy.checkUrl("/index-egapro/declaration/commencer");
3233
cy.selectByLabel(
3334
"Numéro Siren de l’entreprise ou de l’entreprise déclarant pour le compte de l'unité économique et sociale (UES) *",
3435
).select("820709046");
@@ -151,18 +152,18 @@ describe("Declaration", () => {
151152
cy.get("#content").click();
152153
cy.contains("button", "Suivant").click();
153154

154-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
155+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
155156
cy.get("#content").within(() => {
156157
cy.contains("span", "69").should("exist");
157158
});
158159
cy.contains("button", "Valider et transmettre les résultats").click();
159-
cy.contains("Votre déclaration a été transmise");
160+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
160161
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
161162
cy.contains("a", "Mes déclarations").click();
162163

163164
cy.checkUrl("/mon-espace/mes-declarations");
164165
cy.selectByLabel("Numéro Siren de l'entreprise").select("820709046");
165-
cy.contains("a", "820709046");
166+
cy.contains("a", "820709046", { timeout: 30000 });
166167
cy.contains("De 1000 à plus");
167168

168169
// Déclaration progression
@@ -197,7 +198,7 @@ describe("Declaration", () => {
197198
"Note de service envoyé aux salariés",
198199
);
199200
cy.contains("button", "Valider et transmettre les informations").click();
200-
cy.contains("Votre déclaration a été validée et transmise");
201+
cy.contains("Votre déclaration a été validée et transmise", { timeout: 60000 });
201202
cy.contains("button", "Retour").click();
202203

203204
cy.checkUrl("/mon-espace/mes-declarations");

packages/app/cypress/e2e/declaration_251-999_employees_firm_1.cy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -141,18 +142,18 @@ describe("Declaration", () => {
141142
cy.get("#content").click();
142143
cy.contains("button", "Suivant").click();
143144

144-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
145+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
145146
cy.get("#content").within(() => {
146147
cy.contains("span", "78").should("exist");
147148
});
148149
cy.contains("button", "Valider et transmettre les résultats").click();
149-
cy.contains("Votre déclaration a été transmise");
150+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
150151
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
151152
cy.contains("a", "Mes déclarations").click();
152153

153154
cy.checkUrl("/mon-espace/mes-declarations");
154155
cy.selectByLabel("Numéro Siren de l'entreprise").select("384964508");
155-
cy.contains("a", "384964508");
156+
cy.contains("a", "384964508", { timeout: 30000 });
156157
cy.contains("De 251 à 999 inclus");
157158

158159
// Déclaration progression
@@ -181,7 +182,7 @@ describe("Declaration", () => {
181182
});
182183
cy.selectByLabel("Date de publication des objectifs de progression").clear().type("2026-01-15");
183184
cy.contains("button", "Valider et transmettre les informations").click();
184-
cy.contains("Votre déclaration a été validée et transmise");
185+
cy.contains("Votre déclaration a été validée et transmise", { timeout: 60000 });
185186
cy.contains("button", "Retour").click();
186187

187188
cy.checkUrl("/mon-espace/mes-declarations");

packages/app/cypress/e2e/declaration_251-999_employees_firm_2.cy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -110,18 +111,18 @@ describe("Declaration", () => {
110111
);
111112
cy.contains("button", "Suivant").click();
112113

113-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
114+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
114115
cy.get("#content").within(() => {
115116
cy.contains("span", "NC").should("exist");
116117
});
117118
cy.contains("button", "Valider et transmettre les résultats").click();
118-
cy.contains("Votre déclaration a été transmise");
119+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
119120
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
120121
cy.contains("a", "Mes déclarations").click();
121122

122123
cy.checkUrl("/mon-espace/mes-declarations");
123124
cy.selectByLabel("Numéro Siren de l'entreprise").select("384964508");
124-
cy.contains("a", "384964508");
125+
cy.contains("a", "384964508", { timeout: 30000 });
125126
cy.contains("De 251 à 999 inclus");
126127
});
127128
});

packages/app/cypress/e2e/declaration_50-250_employees_firm_1.cy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -122,12 +123,12 @@ describe("Declaration", () => {
122123
cy.get("#content").click();
123124
cy.contains("button", "Suivant").click();
124125

125-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
126+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
126127
cy.get("#content").within(() => {
127128
cy.contains("span", "85").should("exist");
128129
});
129130
cy.contains("button", "Valider et transmettre les résultats").click();
130-
cy.contains("Votre déclaration a été transmise");
131+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
131132
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
132133
cy.contains("a", "Mes déclarations").click();
133134

packages/app/cypress/e2e/declaration_50-250_employees_firm_2.cy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("Declaration", () => {
1616

1717
// Visiter la page de démarrage du simulateur
1818
cy.visit("/");
19+
cy.checkUrl("/");
1920

2021
cy.contains("a", "Calculer - Déclarer mon Index").click();
2122

@@ -130,12 +131,12 @@ describe("Declaration", () => {
130131
cy.get("#content").click();
131132
cy.contains("button", "Suivant").click();
132133

133-
cy.url().should("include", "/index-egapro/declaration/validation-transmission");
134+
cy.checkUrl("/index-egapro/declaration/validation-transmission");
134135
cy.get("#content").within(() => {
135136
cy.contains("span", "75").should("exist");
136137
});
137138
cy.contains("button", "Valider et transmettre les résultats").click();
138-
cy.contains("Votre déclaration a été transmise");
139+
cy.contains("Votre déclaration a été transmise", { timeout: 60000 });
139140
cy.contains("button", Cypress.env("E2E_USERNAME")).click();
140141
cy.contains("a", "Mes déclarations").click();
141142

@@ -165,7 +166,7 @@ describe("Declaration", () => {
165166
.clear()
166167
.type("Affichage au sein de l'entreprise");
167168
cy.contains("button", "Valider et transmettre les informations").click();
168-
cy.contains("Votre déclaration a été validée et transmise");
169+
cy.contains("Votre déclaration a été validée et transmise", { timeout: 60000 });
169170
cy.contains("button", "Retour").click();
170171

171172
cy.checkUrl("/mon-espace/mes-declarations");

0 commit comments

Comments
 (0)