-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: persist user when set on client
- Loading branch information
1 parent
9166ac7
commit 3f5d7b7
Showing
5 changed files
with
67 additions
and
7 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
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
#import "UserPersistenceScenarios.h" | ||
|
||
/** | ||
* Set a user and persist it | ||
* Set a user on the config and persist it | ||
*/ | ||
@implementation UserPersistencePersistUserScenario | ||
|
||
|
@@ -28,6 +28,25 @@ - (void)run { | |
|
||
@end | ||
|
||
/** | ||
* Set a user on the client and persist it | ||
*/ | ||
@implementation UserPersistencePersistUserClientScenario | ||
|
||
- (void)startBugsnag { | ||
self.config.persistUser = YES; | ||
[super startBugsnag]; | ||
} | ||
|
||
- (void)run { | ||
[Bugsnag setUser:@"foo" withEmail:@"[email protected]" andName:@"bar"]; | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
[Bugsnag notifyError:[NSError errorWithDomain:@"com.bugsnag" code:833 userInfo:nil]]; | ||
}); | ||
} | ||
|
||
@end | ||
|
||
/** | ||
* Set a user but don't persist it | ||
*/ | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ Feature: Persisting User Information | |
Background: | ||
Given I clear all UserDefaults data | ||
|
||
Scenario: User Info is persisted across app runs | ||
Scenario: User Info is persisted from config across app runs | ||
When I run "UserPersistencePersistUserScenario" | ||
|
||
# User is set and comes through | ||
|
@@ -33,6 +33,37 @@ Feature: Persisting User Information | |
And the payload field "events.0.user.email" equals "[email protected]" | ||
And the payload field "events.0.user.name" equals "bar" | ||
|
||
Scenario: User Info is persisted from client across app runs | ||
When I run "UserPersistencePersistUserClientScenario" | ||
|
||
# Session is captured before the user can be set on the Client | ||
And I wait to receive a request | ||
And I relaunch the app | ||
Then the request is valid for the session reporting API version "1.0" for the "iOS Bugsnag Notifier" notifier | ||
And the session "user.id" is not null | ||
And the session "user.email" is null | ||
And the session "user.name" is null | ||
And I discard the oldest request | ||
|
||
# Generate session and event | ||
Then I run "UserPersistenceNoUserScenario" | ||
And I wait to receive 2 requests | ||
And I relaunch the app | ||
|
||
# Session - User persisted | ||
Then the request is valid for the session reporting API version "1.0" for the "iOS Bugsnag Notifier" notifier | ||
And the session "user.id" equals "foo" | ||
And the session "user.email" equals "[email protected]" | ||
And the session "user.name" equals "bar" | ||
And I discard the oldest request | ||
|
||
# Event - User persisted | ||
Then the request is valid for the error reporting API version "4.0" for the "iOS Bugsnag Notifier" notifier | ||
And the payload field "events.0.user.id" equals "foo" | ||
And the payload field "events.0.user.email" equals "[email protected]" | ||
And the payload field "events.0.user.name" equals "bar" | ||
|
||
|
||
Scenario: User Info is not persisted across app runs | ||
When I run "UserPersistenceDontPersistUserScenario" | ||
|
||
|