FormidableLabs / react-native-owl

Visual regression testing library for React Native that enables developers to introduce visual regression tests to their apps.
https://formidable.com/open-source/react-native-owl/
MIT License
639 stars 28 forks source link

[ios] Test hangs up #178

Open eilinwis opened 4 months ago

eilinwis commented 4 months ago

Is there an existing issue for this?

Code of Conduct

Code Sandbox link

No response

Bug report

Hey! I have an issue running owl tests test doesn't perform actions (like press or scroll) and hangs up if test contains one of those here is the test:

import { press, takeScreenshot } from 'react-native-owl'
import { homeScreen } from '../../testIdsProxy'

describe('App.tsx', () => {
  it('takes a screenshot of the first screen', async () => {
    await press(homeScreen.voteButton)
    const screen = await takeScreenshot('homescreen')

    expect(screen).toMatchBaseline()
  })

  it('presses a button, then takes a screenshot', async () => {
    const screen = await takeScreenshot('afterButtonPress')

    expect(screen).toMatchBaseline()
  })
})

Here is the log:

romankudravcev@MacBook-Pro-3 sweat-wallet % yarn owl test --platform ios    
[OWL - CLI] Starting websocket server.
[OWL - CLI] Running tests on ios.
[OWL - WebSocket] Listening on port 8123.
com.sweateconomy.wallet: 68963
[OWL - CLI] (Tests mode) Will compare latest images with the baseline.
[OWL - CLI] Will set the jest root to /Users/romankudravcev/Documents/Projects/sweat-wallet.
● Validation Warning:

  Unknown option "node" with value ">=18" was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "node" with value ">=18" was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

  console.info
    [OWL - CLI] Will run the screenshot command: xcrun simctl io iPhone\ 15 screenshot afterButtonPress.png.

      at Logger.Object.<anonymous>.Logger.info (node_modules/react-native-owl/dist/logger.js:25:26)

 RUNS  e2e/tests/screenshot/homeScreen.owl.ts
  console.info
    [OWL - CLI] Screenshot saved to /Users/romankudravcev/Documents/Projects/sweat-wallet/.owl/latest/ios/afterButtonPress.png.

      at Logger.Object.<anonymous>.Logger.info (node_modules/react-native-owl/dist/logger.js:25:26)

 FAIL  e2e/tests/screenshot/homeScreen.owl.ts (25.987 s)
  App.tsx
    ✕ takes a screenshot of the first screen (5003 ms)
    ✕ presses a button, then takes a screenshot (17653 ms)

  ● App.tsx › takes a screenshot of the first screen

    thrown: "Exceeded timeout of 5000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      3 |
      4 | describe('App.tsx', () => {
    > 5 |   it('takes a screenshot of the first screen', async () => {
        |   ^
      6 |     await press(homeScreen.voteButton)
      7 |     const screen = await takeScreenshot('homescreen')
      8 |

      at e2e/tests/screenshot/homeScreen.owl.ts:5:3
      at Object.<anonymous> (e2e/tests/screenshot/homeScreen.owl.ts:4:1)

  ● App.tsx › presses a button, then takes a screenshot

    Compared screenshot to match baseline. 891693 were different.

      13 |     const screen = await takeScreenshot('afterButtonPress')
      14 |
    > 15 |     expect(screen).toMatchBaseline()
         |                    ^
      16 |   })
      17 | })
      18 |

      at Object.<anonymous> (e2e/tests/screenshot/homeScreen.owl.ts:15:20)

Test Suites: 1 failed, 1 total
Tests:       2 failed, 2 total
Snapshots:   0 total
Time:        26.029 s, estimated 27 s
Ran all test suites.
Test results written to: .owl/report/jest-report.json
Jest did not exit one second after the test run has completed.

'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

And proccess in terminal doesn't stop after the end. i need to stop it myself (ctrl+c)

owl.config.ts

{
  "ios": {
    "workspace": "ios/SweatWallet.xcworkspace",
    "scheme": "SweatWallet",
    "configuration": "Debug",
    "device": "iPhone 15",
    "quiet": true
  },
  "android": {
    "packageName": "com.sweatwallet",
    "buildType": "Debug"
  },
  "debug": true,
  "report": true
}

"react-native": "0.73.6",