From 567cea8464d474d377c6d682b5e16cafcf83f850 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Fri, 13 Jul 2018 15:29:42 +0100 Subject: [PATCH] tests: Use default value for auto-capturing sessions by default Updated individual scenarios to reflect that session tracking is not accounted for in the request count. Updated AppDelegate scenario loading logic to always use the same configuration --- .../iOSTestApp/AppDelegate.swift | 22 +++++++++---------- .../iOSTestApp/scenarios/AbortScenario.m | 5 +++++ .../scenarios/AccessNonObjectScenario.m | 5 +++++ .../scenarios/AsyncSafeThreadScenario.m | 5 +++++ .../scenarios/BuiltinTrapScenario.m | 7 +++++- .../scenarios/CorruptMallocScenario.m | 5 +++++ .../scenarios/CxxExceptionScenario.mm | 5 +++++ .../HandledErrorOverrideScenario.swift | 5 +++++ .../scenarios/HandledErrorScenario.swift | 5 +++++ .../scenarios/HandledExceptionScenario.swift | 7 +++++- .../scenarios/NonExistentMethodScenario.m | 5 +++++ .../scenarios/NullPointerScenario.m | 5 +++++ .../scenarios/ObjCExceptionScenario.m | 5 +++++ .../scenarios/ObjCMsgSendScenario.m | 5 +++++ .../scenarios/OverwriteLinkRegisterScenario.m | 5 +++++ .../scenarios/PrivilegedInstructionScenario.m | 5 +++++ .../scenarios/ReadGarbagePointerScenario.m | 5 +++++ .../scenarios/ReadOnlyPageScenario.m | 5 +++++ .../scenarios/ReleasedObjectScenario.m | 5 +++++ .../iOSTestApp/scenarios/Scenario.h | 6 ----- .../iOSTestApp/scenarios/Scenario.m | 6 ----- .../scenarios/StackOverflowScenario.m | 5 +++++ .../iOSTestApp/scenarios/SwiftCrash.swift | 5 +++++ .../scenarios/UndefinedInstructionScenario.m | 5 +++++ .../scenarios/UserDisabledScenario.swift | 6 ++++- .../scenarios/UserEmailScenario.swift | 6 ++++- .../scenarios/UserEnabledScenario.swift | 5 +++++ .../iOSTestApp/scenarios/UserIdScenario.swift | 5 +++++ features/scripts/launch_ios_app.sh | 1 + features/steps/ios_steps.rb | 2 +- 30 files changed, 140 insertions(+), 28 deletions(-) diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/AppDelegate.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/AppDelegate.swift index e6db619c5..d21dabcad 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/AppDelegate.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/AppDelegate.swift @@ -15,6 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let arguments = ProcessInfo.processInfo.arguments var delay: TimeInterval = 0 var eventType = "none" + var eventMode = "regular" var bugsnagAPIKey = "" var mockAPIPath = "" @@ -30,20 +31,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate { mockAPIPath = String(argument.split(separator: "=").last!) } else if argument.contains("BUGSNAG_API_KEY") { bugsnagAPIKey = String(argument.split(separator: "=").last!) + } else if argument.contains("EVENT_MODE") { + eventMode = String(argument.split(separator: "=").last!) } } - assert(mockAPIPath.count > 0, "The mock API path must be set prior to triggering events") + assert(mockAPIPath.count > 0, "The mock API path must be set prior to triggering events. Event Type: '" + eventType + "'") if eventType == "preheat" { assert(false) } let config = prepareConfig(apiKey: bugsnagAPIKey, mockAPIPath: mockAPIPath) - if eventType == "none" { - Bugsnag.start(with: config) - } else { - let scenario = Scenario.createScenarioNamed(eventType, withConfig: config) - triggerEvent(scenario: scenario, delay: delay) - } + let scenario = Scenario.createScenarioNamed(eventType, withConfig: config) + triggerEvent(scenario: scenario, delay: delay, mode: eventMode) } internal func prepareConfig(apiKey: String, mockAPIPath: String) -> BugsnagConfiguration { @@ -53,12 +52,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return config } - func triggerEvent(scenario: Scenario, delay: TimeInterval) { + func triggerEvent(scenario: Scenario, delay: TimeInterval, mode: String) { let when = DispatchTime.now() + delay scenario.startBugsnag() - - DispatchQueue.main.asyncAfter(deadline: when) { - scenario.run() + if mode != "noevent" { + DispatchQueue.main.asyncAfter(deadline: when) { + scenario.run() + } } } } diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AbortScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AbortScenario.m index 0be000c81..0a595ae22 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AbortScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AbortScenario.m @@ -28,6 +28,11 @@ @implementation AbortScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { abort(); } diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AccessNonObjectScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AccessNonObjectScenario.m index db6523281..5bafeab27 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AccessNonObjectScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AccessNonObjectScenario.m @@ -31,6 +31,11 @@ */ @implementation AccessNonObjectScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { #if __i386__ && !TARGET_IPHONE_SIMULATOR #define __bridge diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AsyncSafeThreadScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AsyncSafeThreadScenario.m index d0731988c..84bf94d53 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AsyncSafeThreadScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/AsyncSafeThreadScenario.m @@ -33,6 +33,11 @@ */ @implementation AsyncSafeThreadScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { pthread_getname_np(pthread_self(), ((char *) 0x1), 1); diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/BuiltinTrapScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/BuiltinTrapScenario.m index a6e23cb4f..ac24057ca 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/BuiltinTrapScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/BuiltinTrapScenario.m @@ -10,9 +10,14 @@ */ @implementation BuiltinTrapScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { __builtin_trap(); } -@end \ No newline at end of file +@end diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CorruptMallocScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CorruptMallocScenario.m index 0fcaf88fc..e8b9a4819 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CorruptMallocScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CorruptMallocScenario.m @@ -35,6 +35,11 @@ */ @implementation CorruptMallocScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { /* Smash the heap, and keep smashing it until we eventually hit something non-writable, or trigger * a malloc error (e.g., in NSLog). */ diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CxxExceptionScenario.mm b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CxxExceptionScenario.mm index 6f16a3db9..1dcb77113 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CxxExceptionScenario.mm +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/CxxExceptionScenario.mm @@ -41,6 +41,11 @@ */ @implementation CxxExceptionScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { [self crash]; } diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorOverrideScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorOverrideScenario.swift index ec4936652..4faaa982e 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorOverrideScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorOverrideScenario.swift @@ -11,6 +11,11 @@ import Bugsnag */ class HandledErrorOverrideScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { let error = NSError(domain: "HandledErrorOverrideScenario", code: 100, userInfo: nil) Bugsnag.notifyError(error, block: { report in diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorScenario.swift index 18a0922bb..067ed9dca 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledErrorScenario.swift @@ -11,6 +11,11 @@ import Bugsnag */ class HandledErrorScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { let error = NSError(domain: "HandledErrorScenario", code: 100, userInfo: nil) Bugsnag.notifyError(error) diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledExceptionScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledExceptionScenario.swift index 2a3ff198d..7cab06718 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledExceptionScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/HandledExceptionScenario.swift @@ -11,10 +11,15 @@ import Bugsnag */ class HandledExceptionScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { Bugsnag.notify(NSException(name: NSExceptionName("HandledExceptionScenario"), reason: "Message: HandledExceptionScenario", userInfo: nil)) } -} \ No newline at end of file +} diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NonExistentMethodScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NonExistentMethodScenario.m index 5aa6e6ba3..1af5959c8 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NonExistentMethodScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NonExistentMethodScenario.m @@ -8,6 +8,11 @@ @implementation NonExistentMethodScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NullPointerScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NullPointerScenario.m index 822c4d1b6..917980cfd 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NullPointerScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/NullPointerScenario.m @@ -30,6 +30,11 @@ */ @implementation NullPointerScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { volatile char *ptr = NULL; (void) *ptr; diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCExceptionScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCExceptionScenario.m index 346861652..8cf91258a 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCExceptionScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCExceptionScenario.m @@ -33,6 +33,11 @@ */ @implementation ObjCExceptionScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run __attribute__((noreturn)) { @throw [NSException exceptionWithName:NSGenericException reason:@"An uncaught exception! SCREAM." userInfo:@{NSLocalizedDescriptionKey: @"I'm in your program, catching your exceptions!"}]; diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCMsgSendScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCMsgSendScenario.m index e2f216e87..56533bcd4 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCMsgSendScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ObjCMsgSendScenario.m @@ -32,6 +32,11 @@ */ @implementation ObjCMsgSendScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { struct { void *isa; diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/OverwriteLinkRegisterScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/OverwriteLinkRegisterScenario.m index bb5062ad4..9217379c8 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/OverwriteLinkRegisterScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/OverwriteLinkRegisterScenario.m @@ -37,6 +37,11 @@ - (NSString *)desc { return @""; } +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { /* Call a method to trigger modification of LR. We use the result below to * convince the compiler to order this function the way we want it. */ diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/PrivilegedInstructionScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/PrivilegedInstructionScenario.m index 545efc945..7e04d80b2 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/PrivilegedInstructionScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/PrivilegedInstructionScenario.m @@ -31,6 +31,11 @@ */ @implementation PrivilegedInstructionScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { #if __i386__ asm volatile ( "hlt" : : : ); diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadGarbagePointerScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadGarbagePointerScenario.m index 370f0d97d..5b9c25f1a 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadGarbagePointerScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadGarbagePointerScenario.m @@ -32,6 +32,11 @@ */ @implementation ReadGarbagePointerScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { void *ptr = mmap(NULL, (size_t) getpagesize(), PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadOnlyPageScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadOnlyPageScenario.m index 93d490124..e2e102632 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadOnlyPageScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReadOnlyPageScenario.m @@ -31,6 +31,11 @@ */ @implementation ReadOnlyPageScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + static void __attribute__((used)) dummyfunc(void) { } diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReleasedObjectScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReleasedObjectScenario.m index f24b851cd..0275729de 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReleasedObjectScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/ReleasedObjectScenario.m @@ -35,6 +35,11 @@ @implementation ReleasedObjectScenario - (NSString *)category { return @"Objective-C"; } - (NSString *)title { return @"Message a released object"; } - (NSString *)desc { return @""; } +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.h b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.h index d5adcad60..58a05ae81 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.h +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.h @@ -6,10 +6,6 @@ #import #import -@interface Bugsnag() -+ (id) notifier; -@end - @interface Scenario : NSObject @property (strong, nonatomic, nonnull) BugsnagConfiguration *config; @@ -26,6 +22,4 @@ - (void)startBugsnag; -- (void)flushAllSessions; - @end diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.m index 5d98afa6f..0eb67b3a5 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/Scenario.m @@ -44,10 +44,4 @@ - (void)startBugsnag { [Bugsnag startBugsnagWithConfiguration:self.config]; } -- (void)flushAllSessions { - id notifier = [Bugsnag notifier]; - id sessionTracker = [notifier valueForKey:@"sessionTracker"]; - [sessionTracker performSelector:@selector(send)]; -} - @end diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/StackOverflowScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/StackOverflowScenario.m index 092b5bc38..66cbc6b92 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/StackOverflowScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/StackOverflowScenario.m @@ -32,6 +32,11 @@ */ @implementation StackOverflowScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { [self run]; diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/SwiftCrash.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/SwiftCrash.swift index b868d089d..04d191836 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/SwiftCrash.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/SwiftCrash.swift @@ -30,6 +30,11 @@ import Foundation * Trigger a crash from inside a Swift method. */ class SwiftCrash: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { let buf: UnsafeMutablePointer? = nil; buf![1] = 1; diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UndefinedInstructionScenario.m b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UndefinedInstructionScenario.m index 8ee2d9f75..8734474a6 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UndefinedInstructionScenario.m +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UndefinedInstructionScenario.m @@ -31,6 +31,11 @@ */ @implementation UndefinedInstructionScenario +- (void)startBugsnag { + self.config.shouldAutoCaptureSessions = NO; + [super startBugsnag]; +} + - (void)run { #if __i386__ asm volatile ( "ud2" : : : ); diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserDisabledScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserDisabledScenario.swift index a444c0bd6..eafadf954 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserDisabledScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserDisabledScenario.swift @@ -10,6 +10,10 @@ import Bugsnag * Sends a handled error to Bugsnag, which does not include user data. */ internal class UserDisabledScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } override func run() { Bugsnag.configuration()?.setUser(nil, withName: nil, andEmail: nil) @@ -17,4 +21,4 @@ internal class UserDisabledScenario: Scenario { Bugsnag.notifyError(error) } -} \ No newline at end of file +} diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEmailScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEmailScenario.swift index 23399db53..303ef7dbe 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEmailScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEmailScenario.swift @@ -10,6 +10,10 @@ import Bugsnag * Sends a handled error to Bugsnag, which only includes a user's email */ internal class UserEmailScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } override func run() { Bugsnag.configuration()?.setUser(nil, withName: nil, andEmail: "user@example.com") @@ -17,4 +21,4 @@ internal class UserEmailScenario: Scenario { Bugsnag.notifyError(error) } -} \ No newline at end of file +} diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEnabledScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEnabledScenario.swift index fb61a0c97..70ce67cd6 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEnabledScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserEnabledScenario.swift @@ -11,6 +11,11 @@ import Bugsnag */ internal class UserEnabledScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { Bugsnag.configuration()?.setUser("123", withName: "Joe Bloggs", andEmail: "user@example.com") let error = NSError(domain: "UserEnabledScenario", code: 100, userInfo: nil) diff --git a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserIdScenario.swift b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserIdScenario.swift index 09725ae29..e350889e0 100644 --- a/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserIdScenario.swift +++ b/features/fixtures/ios-swift-cocoapods/iOSTestApp/scenarios/UserIdScenario.swift @@ -11,6 +11,11 @@ import Bugsnag */ internal class UserIdScenario: Scenario { + override func startBugsnag() { + self.config.shouldAutoCaptureSessions = false; + super.startBugsnag() + } + override func run() { Bugsnag.configuration()?.setUser("abc", withName: nil, andEmail: nil) let error = NSError(domain: "UserIdScenario", code: 100, userInfo: nil) diff --git a/features/scripts/launch_ios_app.sh b/features/scripts/launch_ios_app.sh index e85ea90c5..570ddc171 100755 --- a/features/scripts/launch_ios_app.sh +++ b/features/scripts/launch_ios_app.sh @@ -3,6 +3,7 @@ xcrun simctl terminate "$iOS_Simulator" com.bugsnag.iOSTestApp xcrun simctl launch "$iOS_Simulator" com.bugsnag.iOSTestApp \ "EVENT_TYPE=$EVENT_TYPE" \ + "EVENT_MODE=$EVENT_MODE" \ "EVENT_DELAY=$EVENT_DELAY" \ "BUGSNAG_API_KEY=$BUGSNAG_API_KEY" \ "MOCK_API_PATH=http://localhost:$MOCK_API_PORT" diff --git a/features/steps/ios_steps.rb b/features/steps/ios_steps.rb index 2726c4265..0d8ae5d17 100644 --- a/features/steps/ios_steps.rb +++ b/features/steps/ios_steps.rb @@ -32,6 +32,6 @@ steps %Q{ When I set environment variable "EVENT_TYPE" to "#{event}" And I launch the app - And I set environment variable "EVENT_TYPE" to "none" + And I set environment variable "EVENT_MODE" to "noevent" } end