-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove-obsolete-test
- Loading branch information
Showing
10 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/InForegroundScenario.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import java.lang.Thread | ||
import android.os.Handler | ||
import android.os.HandlerThread | ||
|
||
/** | ||
* Sends a handled exception to Bugsnag, which has a short delay to allow the app to remain | ||
* in the foreground for ~1 second | ||
*/ | ||
internal class InForegroundScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
init { | ||
config.setAutoCaptureSessions(false) | ||
} | ||
|
||
override fun run() { | ||
super.run() | ||
|
||
val thread = HandlerThread("HandlerThread") | ||
thread.start() | ||
Handler(thread.looper).post { | ||
Thread.sleep(5000) | ||
Bugsnag.notify(generateException()) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: In foreground field populates correctly | ||
|
||
Scenario: Test handled exception after delay | ||
When I run "InForegroundScenario" | ||
Then I should receive a request | ||
And the request is a valid for the error reporting API | ||
And the event "app.inForeground" is true | ||
|
||
# Duration in foreground should be a non-zero integer | ||
And the payload field "events.0.app.durationInForeground" is greater than 0 | ||
|
||
Scenario: Test handled exception in background | ||
When I run "InForegroundScenario" and press the home button | ||
And I press the home button | ||
Then I should receive a request | ||
And the request is a valid for the error reporting API | ||
And the event "app.inForeground" is false | ||
And the payload field "events.0.app.durationInForeground" equals 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ apply plugin: 'kotlin-android' | |
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters