0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore: update experience test since it will fail randomly when running ci (#4649)

This commit is contained in:
Xiao Yijun 2023-10-13 17:41:30 +08:00 committed by GitHub
parent e36493367e
commit dde18a4cac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -3,7 +3,7 @@ import { appendPath } from '@silverhand/essentials';
import { logtoUrl, mockSocialAuthPageUrl } from '#src/constants.js'; import { logtoUrl, mockSocialAuthPageUrl } from '#src/constants.js';
import { readVerificationCode } from '#src/helpers/index.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'; 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. * It will clear the ongoing experience if the experience is ended successfully.
*/ */
async verifyThenEnd() { 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) { if (this.#ongoing === undefined) {
return this.throwNoOngoingExperienceError(); return this.throwNoOngoingExperienceError();
} }

View file

@ -41,6 +41,8 @@ export default class ExpectTotpExperience extends ExpectExperience {
await this.toFillInput(`totpCode_${index}`, char); await this.toFillInput(`totpCode_${index}`, char);
} }
// Wait for the form to commit automatically
await waitFor(500);
if (signingInAfterBinding) { if (signingInAfterBinding) {
await this.page.waitForSelector('img[alt="Congrats"]'); await this.page.waitForSelector('img[alt="Congrats"]');
} }
@ -68,6 +70,8 @@ export default class ExpectTotpExperience extends ExpectExperience {
await this.toFillInput(`totpCode_${index}`, char); await this.toFillInput(`totpCode_${index}`, char);
} }
// Wait for the form to commit automatically
await waitFor(500);
if (signingInAfterVerification) { if (signingInAfterVerification) {
await this.page.waitForSelector('img[alt="Congrats"]'); await this.page.waitForSelector('img[alt="Congrats"]');
} }