diff --git a/e2e/freight/cypress/e2e/flows/onboarding_switch_back.cy.ts b/e2e/freight/cypress/e2e/flows/onboarding_switch_back.cy.ts index 4f16898d0..e6c903e89 100644 --- a/e2e/freight/cypress/e2e/flows/onboarding_switch_back.cy.ts +++ b/e2e/freight/cypress/e2e/flows/onboarding_switch_back.cy.ts @@ -100,7 +100,18 @@ describe("onboarding — switching back to eTrade registration", { retries: 0 }, // The typed registration section is gone: this is an ordinary company now. cy.contains("Nothing on file at eTrade for this TIN").should("not.exist"); + // Wait for the profile to rehydrate before typing. The company still holds + // the TIN it typed under the flag (the switch clears the registration, not + // the tax number), and RHF re-seeds the field when the refetch lands — so a + // TIN typed into an empty-looking field is silently replaced by the stored + // one, and the lookup then runs against the wrong number. + cy.get('.mantine-Modal-content [aria-label="VAT Number"]') + .should("not.have.value", ""); fillAria('[aria-label^="TIN Number"]', etradeTin(stamp)); + cy.get('.mantine-Modal-content [aria-label^="TIN Number"]').should( + "have.value", + etradeTin(stamp), + ); cy.contains("Verified with eTrade", { timeout: 20000 }).should("be.visible"); cy.wait(500); wizardClick("Continue");