Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky TestCafe OV polling test in DeviceChallengePollView_spec #3654

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ const Body = BaseFormWithPolling.extend({

const onFailure = () => {
Logger.error(`Something unexpected happened while we were checking port ${currentPort}.`);
return $.Deferred().reject();
};

const doProbing = (domainUrl) => {
return checkPort(getAuthenticatorUrl('probe', domainUrl))
.done(() => {
.then(() => {
return onPortFound(getAuthenticatorUrl('challenge', domainUrl))
.done(() => {
.then(() => {
foundPort = true;
if (deviceChallenge.enhancedPollingEnabled !== false) {
// this way we can gurantee that
Expand All @@ -131,7 +132,7 @@ const Body = BaseFormWithPolling.extend({
// to make the authentication flow goes faster
return this.trigger('save', this.model);
})
.fail((xhr) => {
.catch((xhr) => {
countFailedPorts++;
// Windows and MacOS return status code 503 when
// there are multiple profiles on the device and
Expand Down Expand Up @@ -160,7 +161,7 @@ const Body = BaseFormWithPolling.extend({
}
});
})
.fail(onFailure);
.catch(onFailure);
};

let probeChain = Promise.resolve();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import smsPollingResponse from '../../src/mocks/response/idp/idx/challenge/send/
import emailChannelSelectionMockResponse from '../../src/mocks/response/idp/idx/credential/enroll/enroll-ov-email-channel.json';
import smsChannelSelectionMockResponse from '../../src/mocks/response/idp/idx/credential/enroll/enroll-ov-sms-channel.json';

jest.retryTimes(2);

const createTestContext = async () => {
const mockRequestClient: HttpRequestClient = jest.fn().mockImplementation((_, url, options) => {
updateStateHandleInMock(qrPollingResponse);
Expand Down
13 changes: 9 additions & 4 deletions test/testcafe/spec/DeviceChallengePollView_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,14 @@ async function setupLoopbackFallback(t, widgetOptions) {
return deviceChallengeFalllbackPage;
}

const skipTest = () => {
return null;
// return test.skip;
};
lesterchoi-okta marked this conversation as resolved.
Show resolved Hide resolved

// TODO: fix quarantined test - OKTA-645716
test.skip
.requestHooks(loopbackSuccessLogger, loopbackSuccessMock)('in loopback server approach, probing and polling requests are sent and responded', async t => {
skipTest()
?.requestHooks(loopbackSuccessLogger, loopbackSuccessMock)?.('in loopback server approach, probing and polling requests are sent and responded', async t => {
const deviceChallengePollPageObject = await setup(t);
await checkA11y(t);
await t.expect(deviceChallengePollPageObject.getBeaconSelector()).contains(BEACON_CLASS);
Expand Down Expand Up @@ -518,8 +523,8 @@ test
});

// FIXME quarantined test OKTA-796308
test.skip
.requestHooks(loopbackPollTimeoutLogger, loopbackPollTimeoutMock)('new poll does not starts until last one is ended', async t => {
skipTest()
?.requestHooks?.(loopbackPollTimeoutLogger, loopbackPollTimeoutMock)?.('new poll does not starts until last one is ended', async t => {
await setup(t);
await checkA11y(t);
// This test verify if new /poll calls are made only if the previous one was finished instead of polling with fixed interval.
Expand Down
2 changes: 2 additions & 0 deletions test/unit/spec/v1/EnrollSms_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import $sandbox from 'sandbox';
import LoginUtil from 'util/Util';
const itp = Expect.itp;

jest.retryTimes(2);

Expect.describe('EnrollSms', function() {
function setup(resp, startRouter, routerOptions = {}) {
const setNextResponse = Util.mockAjax();
Expand Down