diff --git a/packages/integration-tests/src/ui-helpers/expect-experience.ts b/packages/integration-tests/src/ui-helpers/expect-experience.ts index 9f1f3541347..d207b84fdf3 100644 --- a/packages/integration-tests/src/ui-helpers/expect-experience.ts +++ b/packages/integration-tests/src/ui-helpers/expect-experience.ts @@ -3,7 +3,7 @@ import { appendPath } from '@silverhand/essentials'; import { logtoUrl, mockSocialAuthPageUrl } from '#src/constants.js'; import { readVerificationCode } from '#src/helpers/index.js'; -import { dcls } from '#src/utils.js'; +import { dcls, waitFor } from '#src/utils.js'; import ExpectPage from './expect-page.js'; @@ -95,6 +95,8 @@ export default class ExpectExperience extends ExpectPage { * It will clear the ongoing experience if the experience is ended successfully. */ async verifyThenEnd() { + // Wait for 500ms since some times the sign-in success callback haven't been handled yet + await waitFor(500); if (this.#ongoing === undefined) { return this.throwNoOngoingExperienceError(); } diff --git a/packages/integration-tests/src/ui-helpers/expect-totp-experience.ts b/packages/integration-tests/src/ui-helpers/expect-totp-experience.ts index 194ba5fdfbf..c5da11bea67 100644 --- a/packages/integration-tests/src/ui-helpers/expect-totp-experience.ts +++ b/packages/integration-tests/src/ui-helpers/expect-totp-experience.ts @@ -41,6 +41,8 @@ export default class ExpectTotpExperience extends ExpectExperience { await this.toFillInput(`totpCode_${index}`, char); } + // Wait for the form to commit automatically + await waitFor(500); if (signingInAfterBinding) { await this.page.waitForSelector('img[alt="Congrats"]'); } @@ -68,6 +70,8 @@ export default class ExpectTotpExperience extends ExpectExperience { await this.toFillInput(`totpCode_${index}`, char); } + // Wait for the form to commit automatically + await waitFor(500); if (signingInAfterVerification) { await this.page.waitForSelector('img[alt="Congrats"]'); }