Skip to content

Commit

Permalink
Merge pull request #5810 from flexion/devex-fix-flaky-cypress
Browse files Browse the repository at this point in the history
Fix Flaky Cypress test
  • Loading branch information
jimlerza authored Feb 27, 2025
2 parents 362f628 + 7c57307 commit d6258ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cypress/helpers/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export function retry(cb: () => Cypress.Chainable<boolean>, maxAttempts = 5) {
}

export function assertExists(selector: string) {
/*
This is a necessary wait as the below find command does not have built in cypress retries.
This makes the below command VERY flaky because if the browser does not have the selector the moment you look for it this fails.
This function should only ever be used with the retry() mechanism.
*/
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
return cy.get('body').then(body => {
return body.find(selector).length > 0;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import {
statusReportDocketEntryId,
} from '../../../support/statusReportOrder';
import { loginAsColvin } from '../../../../helpers/authentication/login-as-helpers';
import { goToCase } from 'cypress/helpers/caseDetail/go-to-case';

describe('edit status report order', () => {
beforeEach(() => {
loginAsColvin();
cy.visit(`/case-detail/${docketNumber}`);
goToCase(docketNumber)
});

describe('editing a status report order from drafts document view', () => {
Expand Down

0 comments on commit d6258ec

Please sign in to comment.