Skip to content

Commit

Permalink
Merge pull request #1177 from bugsnag/tms/code-bundle-id-flake
Browse files Browse the repository at this point in the history
Allow notifier time to synch state with native layer
  • Loading branch information
twometresteve authored Dec 7, 2020
2 parents e9d730c + 434bb3b commit e925af8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ npm run test:build-react-native-ios

Fnd Android:
```shell script
npm run test:build-react-native-ios
npm run test:build-react-native-android
```
These will build a `.ipa` or `.apk` file respectively and copy into `./build`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default class App extends Component {
this.setState({ sessionsEndpoint: 'https://sessions.bugsnag.com' })
}

timeout (ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}

startScenario = async () => {
console.log(`Running scenario: ${this.state.currentScenario}`)
console.log(` with MetaData: ${this.state.scenarioMetaData}`)
Expand All @@ -69,6 +73,10 @@ export default class App extends Component {
console.log(` with config: ${JSON.stringify(configuration)} (native) and ${JSON.stringify(jsConfig)} (js)`)
await NativeModules.BugsnagTestInterface.startBugsnag(configuration)
Bugsnag.start(jsConfig)
// The notifier needs a little time to synch to the native layer, otherwise flakes occur - however it's also
// important that the scenario waits longer than this period before relaunching the app (see the Cucumber step
// 'I relaunch the app').
await this.timeout(2000)
scenario.run()
}

Expand Down
4 changes: 2 additions & 2 deletions test/react-native/features/steps/react-native-steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

When("I relaunch the app") do
# This step should only be used when the app has crashed, but the notifier needs a little
# time to write the crash report before being forced to reopen. From trials, 1s was not enough.
sleep(2)
# time to write the crash report before being forced to reopen. From trials, 2s was not enough.
sleep(5)
MazeRunner.driver.launch_app
end

Expand Down

0 comments on commit e925af8

Please sign in to comment.