Skip to content

Commit

Permalink
chore: add retry to flaky tests (#4175)
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker authored Oct 23, 2024
1 parent cce3762 commit e6d3dce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { isCI } from 'repo-utils'
import { wait, axeComponent } from '../../../../../core/jest/jestSetup'
import { fireEvent, render, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
Expand All @@ -9,6 +10,10 @@ import locales from '../../../constants/locales'
const nbNO = locales['nb-NO']
const enGB = locales['en-GB']

if (isCI) {
jest.retryTimes(5) // because of an flaky async tests
}

describe('Field.PhoneNumber', () => {
it('should default to 47', () => {
render(<Field.PhoneNumber />)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { spyOnEufemiaWarn } from '../../../../../core/jest/jestSetup'
import { isCI } from 'repo-utils'
import {
act,
createEvent,
Expand All @@ -14,6 +15,10 @@ import setData from '../../data-context/setData'
import nbNO from '../../../constants/locales/nb-NO'
const nb = nbNO['nb-NO']

if (isCI) {
jest.retryTimes(5) // because of an flaky async tests
}

describe('Form.Isolation', () => {
let log = null
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react'
import { act, fireEvent, render, waitFor } from '@testing-library/react'
import { isCI } from 'repo-utils'
import { Form, Wizard } from '../../..'
import { Button, Dialog } from '../../../../../components'
import { ConfirmParams } from '../SubmitConfirmation'
import userEvent from '@testing-library/user-event'

if (isCI) {
jest.retryTimes(5) // because of an flaky async tests
}

describe('Form.SubmitConfirmation', () => {
describe('with preventSubmitWhen', () => {
it('should keep pending state when confirmationState is "readyToBeSubmitted"', async () => {
Expand Down

0 comments on commit e6d3dce

Please sign in to comment.