Skip to content

Commit 1a171c6

Browse files
committed
fix(e2e): seed phone before login to stabilize deadline gating tests
The missing-info-modal fires when the session JWT carries a null phone, and setting the phone in DB after login does not refresh the JWT. Move phone/hasCse seeding before login so the modal never opens during the Rémunération-button click.
1 parent 2ddaf44 commit 1a171c6

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/app/src/e2e/campaign-deadlines-gating.e2e.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,20 @@ test.describe("Campaign deadlines gating", () => {
4545
// shared auth.setup project handles.
4646
async function seedSubmittedCompliance() {
4747
await resetDeclarationToDraft();
48-
await setCompanyHasCse(true);
49-
await setUserPhone("0122334455");
5048
await setDeclarationComplianceState({
5149
status: "submitted",
5250
currentStep: 6,
5351
compliancePath: "corrective_action",
5452
});
5553
}
5654

55+
// Phone + CSE flags must be set before login so the JWT picks them up and
56+
// the missing-info-modal does not intercept clicks on /mon-espace.
57+
async function seedUserProfile() {
58+
await setUserPhone("0122334455");
59+
await setCompanyHasCse(true);
60+
}
61+
5762
test.afterAll(async () => {
5863
await deleteCampaignDeadlines(testDeclarationYear);
5964
await resetDeclarationToDraft();
@@ -68,6 +73,7 @@ test.describe("Campaign deadlines gating", () => {
6873
test("panel shows Modifier link and 'Modifiable jusqu'au' text", async ({
6974
page,
7075
}) => {
76+
await seedUserProfile();
7177
await page.context().clearCookies();
7278
await loginWithProConnect(page);
7379
// The declaration row is only created by getOrCreate() when visiting a
@@ -99,6 +105,7 @@ test.describe("Campaign deadlines gating", () => {
99105
test("submitted declaration can re-enter a non-recap step", async ({
100106
page,
101107
}) => {
108+
await seedUserProfile();
102109
await page.context().clearCookies();
103110
await loginWithProConnect(page);
104111
await page.goto("/declaration-remuneration");
@@ -117,6 +124,7 @@ test.describe("Campaign deadlines gating", () => {
117124
test("panel hides Modifier link and shows 'Modification close depuis'", async ({
118125
page,
119126
}) => {
127+
await seedUserProfile();
120128
await page.context().clearCookies();
121129
await loginWithProConnect(page);
122130
await page.goto("/declaration-remuneration");
@@ -143,6 +151,7 @@ test.describe("Campaign deadlines gating", () => {
143151
test("submitted declaration non-recap step redirects to recap", async ({
144152
page,
145153
}) => {
154+
await seedUserProfile();
146155
await page.context().clearCookies();
147156
await loginWithProConnect(page);
148157
await page.goto("/declaration-remuneration");

0 commit comments

Comments
 (0)