hospitalrun-frontend icon indicating copy to clipboard operation
hospitalrun-frontend copied to clipboard

NewLabRequest.test.tsx is flaky

Open DrewGregory opened this issue 3 years ago • 4 comments

Please read this entire template before posting any issue. If you ignore these instructions and post an issue here that does not follow the instructions, your issue might be closed, locked, and assigned the missing discussion label.

🐛 Bug Report

The NewLabRequest form layout › should clear visit when patient is changed test spuriously times out. In addition, on save › should save the lab request and navigate to "/labs/:id" spuriously has visitsInput assume a display value of [""] instead of the desired string. The test output is included below.

To Reproduce

Steps to reproduce the behavior:

Run npm run test:ci src/__tests__/labs/requests/NewLabRequest.test.tsx several times until you encounter the error.

Paste your code here:

New Lab Request › on save › should save the lab request and navigate to "/labs/:id"

    expect(element).toHaveDisplayValue()

    Expected element to have display value:
      visit_type at 2021-04-18 01:58 PM
    Received:
      [""]

      157 |         }),
      158 |       )
    > 159 |       expect(visitsInput).toHaveDisplayValue(
          |                           ^
      160 |         `${expectedVisits[0].type} at ${format(
      161 |           new Date(expectedVisits[0].startDateTime),
      162 |           'yyyy-MM-dd hh:mm a',

Expected behavior

All the tests should pass.

Your Environment

  • node version: v12.18.4
  • os: Mac

DrewGregory avatar Apr 18 '21 21:04 DrewGregory

@DrewGregory Are you going to be working on this?

morrme avatar May 25 '21 02:05 morrme

I have not taken this on yet. If someone would like to take this on, feel free to add a comment to this task, and we can assign the issue to you. Otherwise, I might take this on once we wrap up some other HR GitHub issues.

DrewGregory avatar May 25 '21 23:05 DrewGregory

I ran the test 6 times but didn't encounter the bug

ezhoureal avatar Nov 16 '21 21:11 ezhoureal

I'll try to fix this issue if that's ok

ezhoureal avatar Nov 19 '21 19:11 ezhoureal