diff --git a/buildspec/shared/common.sh b/buildspec/shared/common.sh index cce614e4406..a0dbc2e5837 100644 --- a/buildspec/shared/common.sh +++ b/buildspec/shared/common.sh @@ -8,7 +8,7 @@ # - "waiting for browser": from `ssoAccessTokenProvider.test.ts`, unclear how to fix it. # - "HTTPError: Response code …": caused by github rate-limiting. # - "npm WARN deprecated querystring": transitive dep of aws sdk v2 (check `npm ls querystring`), so that's blocked until we migrate to v3. -_ignore_pat='Timed-out waiting for browser login flow\|HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated' +_ignore_pat='HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated' # Do not print (noisy) lines matching these patterns. # - "ERROR:bus… Failed to connect to the bus": noise related to "xvfb". https://github.com/cypress-io/cypress/issues/19299 diff --git a/packages/core/src/test/credentials/sso/ssoAccessTokenProvider.test.ts b/packages/core/src/test/credentials/sso/ssoAccessTokenProvider.test.ts index 1bde91b26d8..b662556e0aa 100644 --- a/packages/core/src/test/credentials/sso/ssoAccessTokenProvider.test.ts +++ b/packages/core/src/test/credentials/sso/ssoAccessTokenProvider.test.ts @@ -310,13 +310,6 @@ describe('SsoAccessTokenProvider', function () { }) it('respects the device authorization expiration time', async function () { - // XXX: Don't know how to fix this "unhandled rejection" caused by this test: - // rejected promise not handled within 1 second: Error: Timed-out waiting for browser login flow to complete - // at poll (…/src/auth/sso/ssoAccessTokenProvider.ts:251:15) - // at async SsoAccessTokenProvider.authorize (…/src/auth/sso/ssoAccessTokenProvider.ts:188:23) - // at async SsoAccessTokenProvider.runFlow (…/src/auth/sso/ssoAccessTokenProvider.ts:113:20) - // at async SsoAccessTokenProvider.createToken (…/src/auth/sso/ssoAccessTokenProvider.ts:102:24) - setupFlow() stubOpen() const exception = new AuthorizationPendingException({ message: '', $metadata: {} }) @@ -324,13 +317,22 @@ describe('SsoAccessTokenProvider', function () { oidcClient.createToken.rejects(exception) oidcClient.startDeviceAuthorization.resolves(authorization) - const resp = sut.createToken() + const resp = sut + .createToken() + .then(() => assert.fail('Should not resolve')) + .catch((e) => { + assert.ok( + e instanceof ToolkitError && + e.message === 'Timed-out waiting for browser login flow to complete' + ) + }) + const progress = await getTestWindow().waitForMessage(/login page opened/i) await clock.tickAsync(750) assert.ok(progress.visible) await clock.tickAsync(750) assert.ok(!progress.visible) - await assert.rejects(resp, ToolkitError) + await resp assertTelemetry('aws_loginWithBrowser', { result: 'Failed', isReAuth: undefined,