From 86d8011af8ebe00df23fc002a35d5f7634fbe145 Mon Sep 17 00:00:00 2001 From: Ahmed Mahmoud Date: Sun, 7 Jul 2024 11:06:39 +0300 Subject: [PATCH 1/3] test(ios): remove native e2e tests in favor of captain --- .../ios/InstabugUITests/BugReportingUITests.m | 96 ------- .../InstabugUITests/FeatureRequestsUITests.m | 25 -- example/ios/InstabugUITests/Info.plist | 22 -- example/ios/InstabugUITests/InstabugUITests.m | 36 --- example/ios/InstabugUITests/SurveysUITests.m | 25 -- .../Util/InstabugUITestsUtils.h | 9 - .../Util/InstabugUITestsUtils.m | 28 -- .../Util/XCUIElement+Instabug.h | 12 - .../Util/XCUIElement+Instabug.m | 50 ---- example/ios/Podfile.lock | 4 +- example/ios/Runner.xcodeproj/project.pbxproj | 246 ------------------ 11 files changed, 2 insertions(+), 551 deletions(-) delete mode 100644 example/ios/InstabugUITests/BugReportingUITests.m delete mode 100644 example/ios/InstabugUITests/FeatureRequestsUITests.m delete mode 100644 example/ios/InstabugUITests/Info.plist delete mode 100644 example/ios/InstabugUITests/InstabugUITests.m delete mode 100644 example/ios/InstabugUITests/SurveysUITests.m delete mode 100644 example/ios/InstabugUITests/Util/InstabugUITestsUtils.h delete mode 100644 example/ios/InstabugUITests/Util/InstabugUITestsUtils.m delete mode 100644 example/ios/InstabugUITests/Util/XCUIElement+Instabug.h delete mode 100644 example/ios/InstabugUITests/Util/XCUIElement+Instabug.m diff --git a/example/ios/InstabugUITests/BugReportingUITests.m b/example/ios/InstabugUITests/BugReportingUITests.m deleted file mode 100644 index 2698fc031..000000000 --- a/example/ios/InstabugUITests/BugReportingUITests.m +++ /dev/null @@ -1,96 +0,0 @@ -#import -#import "Util/XCUIElement+Instabug.h" - -@interface BugReportingUITests : XCTestCase - -@property (nonatomic, strong) XCUIApplication *app; - -@end - -@implementation BugReportingUITests - -- (void)setUp { - self.continueAfterFailure = NO; - self.app = [[XCUIApplication alloc] init]; - [self.app launch]; -} - -- (void)testMultipleScreenshotsInReproSteps { - NSString *screen = @"My Screen"; - - XCUIElement *screenField = self.app.textFields[@"Enter screen name"]; - [screenField tap]; - [screenField typeText:screen]; - [screenField closeKeyboard]; - [self.app.buttons[@"Report Screen Change"] tapWithNumberOfTaps:2 numberOfTouches:1]; - - [self.app.buttons[@"Send Bug Report"] tap]; - [self.app.staticTexts[@"IBGBugVCReproStepsDisclaimerAccessibilityIdentifier"] tap]; - - NSPredicate *screensPredicate = [NSPredicate predicateWithFormat:@"label == %@", screen]; - XCUIElementQuery *screensQuery = [self.app.staticTexts matchingPredicate:screensPredicate]; - - XCTAssertEqual(2, screensQuery.count); -} - -- (void)testFloatingButtonInvocationEvent { - // Grabbing the "Floating Button" invocation event button - // inside the "Change Invocation Events" section as it - // conflicts with Instabug's floating button. - XCUIElement *invocationEvents = [[self.app.otherElements containingPredicate:[NSPredicate predicateWithFormat:@"label == 'Change Invocation Event'"]] element]; - [invocationEvents.buttons[@"Floating Button"] forceTap]; - [self.app.buttons[@"IBGFloatingButtonAccessibilityIdentifier"] tap]; - - [self assertOptionsPromptIsVisible]; -} - -- (void)testNoneInvocationEvent { - [self.app.buttons[@"None"] tap]; - - [self.app.buttons[@"IBGFloatingButtonAccessibilityIdentifier"] assertDoesNotExist]; -} - -- (void)testManualInvocation { - [self.app.buttons[@"Invoke"] tap]; - - [self assertOptionsPromptIsVisible]; -} - -- (void)testOnDismissCallbackIsCalled { - [self.app.buttons[@"Set On Dismiss Callback"] scrollDownAndTap]; - [self.app.buttons[@"Invoke"] scrollUpAndTap]; - [self.app.buttons[@"Cancel"] tap]; - - [self.app.staticTexts[@"onDismiss callback called with DismissType.cancel and ReportType.other"] assertExistsWithTimeout:2]; -} - -- (void)testChangeReportTypes { - [self.app.buttons[@"Bug"] scrollDownAndTap]; - [self.app.buttons[@"Feedback"] scrollDownAndTap]; - [self.app.buttons[@"Invoke"] scrollUpAndTap]; - - [self assertOptionsPromptIsVisible]; - [self.app.staticTexts[@"Report a bug"] assertExistsWithTimeout:2000]; - [self.app.staticTexts[@"Suggest an improvement"] assertExistsWithTimeout:2000]; - [self.app.staticTexts[@"Ask a question"] assertDoesNotExist]; -} - -- (void)testChangeFloatingButtonEdge { - // Grabbing the "Floating Button" invocation event button - // inside the "Change Invocation Events" section as it - // conflicts with Instabug's floating button. - XCUIElement *invocationEvents = [[self.app.otherElements containingPredicate:[NSPredicate predicateWithFormat:@"label == 'Change Invocation Event'"]] element]; - [invocationEvents.buttons[@"Floating Button"] forceTap]; - [self.app.buttons[@"Move Floating Button to Left"] scrollDownAndTap]; - - XCUIElement *floatingButton = self.app.buttons[@"IBGFloatingButtonAccessibilityIdentifier"]; - CGFloat floatingButtonLeft = floatingButton.frame.origin.x; - CGFloat screenMiddle = self.app.frame.size.width / 2.0f; - XCTAssertLessThan(floatingButtonLeft, screenMiddle, @"Floating button isn't to the left of the screen"); -} - -- (void)assertOptionsPromptIsVisible { - [self.app.cells[@"IBGReportBugPromptOptionAccessibilityIdentifier"] assertExistsWithTimeout:2]; -} - -@end diff --git a/example/ios/InstabugUITests/FeatureRequestsUITests.m b/example/ios/InstabugUITests/FeatureRequestsUITests.m deleted file mode 100644 index 95ac389dc..000000000 --- a/example/ios/InstabugUITests/FeatureRequestsUITests.m +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "Util/XCUIElement+Instabug.h" -#import "Util/InstabugUITestsUtils.h" - -@interface FeatureRequestsUITests : XCTestCase - -@property (nonatomic, strong) XCUIApplication *app; - -@end - -@implementation FeatureRequestsUITests - -- (void)setUp { - self.continueAfterFailure = NO; - self.app = [[XCUIApplication alloc] init]; - [self.app launch]; -} - -- (void)testShowFeatureRequestsScreen { - [self.app.buttons[@"Show Feature Requests"] scrollDownAndTap]; - - [self.app.staticTexts[@"Feature Requests"] assertExistsWithTimeout:2]; -} - -@end diff --git a/example/ios/InstabugUITests/Info.plist b/example/ios/InstabugUITests/Info.plist deleted file mode 100644 index 64d65ca49..000000000 --- a/example/ios/InstabugUITests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/example/ios/InstabugUITests/InstabugUITests.m b/example/ios/InstabugUITests/InstabugUITests.m deleted file mode 100644 index f0590be98..000000000 --- a/example/ios/InstabugUITests/InstabugUITests.m +++ /dev/null @@ -1,36 +0,0 @@ -#import -#import "Util/XCUIElement+Instabug.h" -#import "Util/InstabugUITestsUtils.h" - -@interface InstabugUITests : XCTestCase - -@property (nonatomic, strong) XCUIApplication *app; - -@end - -@implementation InstabugUITests - -- (void)setUp { - self.continueAfterFailure = NO; - self.app = [[XCUIApplication alloc] init]; - [self.app launch]; -} - -- (void)testChangePrimaryColor { - NSString *color = @"#FF0000"; - UIColor *expected = [UIColor redColor]; - XCUIElement *colorField = self.app.textFields[@"Enter primary color"]; - [colorField tap]; - [colorField typeText:color]; - [colorField closeKeyboard]; - [self.app.buttons[@"Change Primary Color"] tap]; - - XCUIElement *floatingButton = self.app.buttons[@"IBGFloatingButtonAccessibilityIdentifier"]; - UIImage *image = [[floatingButton screenshot] image]; - int x = image.size.width / 2; - int y = 5; - UIColor *actual = [InstabugUITestsUtils getPixelColorWithImage:image x:x y:y]; - XCTAssertTrue([actual isEqual:expected]); -} - -@end diff --git a/example/ios/InstabugUITests/SurveysUITests.m b/example/ios/InstabugUITests/SurveysUITests.m deleted file mode 100644 index a020064c9..000000000 --- a/example/ios/InstabugUITests/SurveysUITests.m +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "Util/XCUIElement+Instabug.h" -#import "Util/InstabugUITestsUtils.h" - -@interface SurveysUITests : XCTestCase - -@property (nonatomic, strong) XCUIApplication *app; - -@end - -@implementation SurveysUITests - -- (void)setUp { - self.continueAfterFailure = NO; - self.app = [[XCUIApplication alloc] init]; - [self.app launch]; -} - -- (void)testShowManualSurvey { - [self.app.buttons[@"Show Manual Survey"] scrollDownAndTap]; - - [self.app.otherElements[@"SurveyNavigationVC"] assertExistsWithTimeout:2]; -} - -@end diff --git a/example/ios/InstabugUITests/Util/InstabugUITestsUtils.h b/example/ios/InstabugUITests/Util/InstabugUITestsUtils.h deleted file mode 100644 index 6bbb6b372..000000000 --- a/example/ios/InstabugUITests/Util/InstabugUITestsUtils.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import - -@interface InstabugUITestsUtils : NSObject - -+ (UIColor *)getPixelColorWithImage:(UIImage *)image x:(NSInteger)x y:(NSInteger)y; - -@end - diff --git a/example/ios/InstabugUITests/Util/InstabugUITestsUtils.m b/example/ios/InstabugUITests/Util/InstabugUITestsUtils.m deleted file mode 100644 index 108b4f2dc..000000000 --- a/example/ios/InstabugUITests/Util/InstabugUITestsUtils.m +++ /dev/null @@ -1,28 +0,0 @@ -#import "InstabugUITestsUtils.h" - -@implementation InstabugUITestsUtils - -+ (UIColor *)getPixelColorWithImage:(UIImage *)image x:(NSInteger)x y:(NSInteger)y { - CGImageRef cgImage = image.CGImage; - CGFloat width = image.size.width; - CGFloat height = image.size.height; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - int bytesPerPixel = 4; - NSUInteger bitsPerComponent = 8; - UInt8 pixelData[4] = {0, 0, 0, 0}; - CGContextRef context = CGBitmapContextCreate(pixelData, 1, 1, bitsPerComponent, bytesPerPixel, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); - CGColorSpaceRelease(colorSpace); - CGContextSetBlendMode(context, kCGBlendModeCopy); - - CGContextTranslateCTM(context, -x, y - height); - CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), cgImage); - CGContextRelease(context); - - CGFloat red = pixelData[0] / 255.0f; - CGFloat green = pixelData[1] / 255.0f; - CGFloat blue = pixelData[2] / 255.0f; - CGFloat alpha = pixelData[3] / 255.0f; - return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -} - -@end diff --git a/example/ios/InstabugUITests/Util/XCUIElement+Instabug.h b/example/ios/InstabugUITests/Util/XCUIElement+Instabug.h deleted file mode 100644 index 3f45c93be..000000000 --- a/example/ios/InstabugUITests/Util/XCUIElement+Instabug.h +++ /dev/null @@ -1,12 +0,0 @@ -#import - -@interface XCUIElement (Instabug) - -- (void)scrollDownAndTap; -- (void)scrollUpAndTap; -- (void)closeKeyboard; -- (void)forceTap; -- (void)assertExistsWithTimeout:(NSTimeInterval)timeout; -- (void)assertDoesNotExist; - -@end diff --git a/example/ios/InstabugUITests/Util/XCUIElement+Instabug.m b/example/ios/InstabugUITests/Util/XCUIElement+Instabug.m deleted file mode 100644 index c7880ec36..000000000 --- a/example/ios/InstabugUITests/Util/XCUIElement+Instabug.m +++ /dev/null @@ -1,50 +0,0 @@ -#import "XCUIElement+Instabug.h" - -@implementation XCUIElement (Instabug) - -- (void)scrollDownAndTap { - [self scrollDownAndTapWithBlock:^(XCUIApplication *app) { - [app swipeUp]; - }]; -} - -- (void)scrollUpAndTap { - [self scrollDownAndTapWithBlock:^(XCUIApplication *app) { - [app swipeDown]; - }]; -} - -- (void)scrollDownAndTapWithBlock:(void (^)(XCUIApplication *app))block { - XCUIApplication *app = [[XCUIApplication alloc] init]; - - int count = 0; - while (!self.isHittable && count < 10) { - block(app); - count++; - } - - sleep(1); - [self tap]; -} - -- (void)closeKeyboard { - [self typeText:@"\n"]; -} - -/// Taps on the button's coordinates without checking if it's visible. -/// This is useful as XCUITest fails to scroll to Flutter widgets even though they might be visible -/// on the screen. -- (void)forceTap { - XCUICoordinate *coordinate = [self coordinateWithNormalizedOffset:CGVectorMake(0.0f, 0.0f)]; - [coordinate tap]; -} - -- (void)assertExistsWithTimeout:(NSTimeInterval)timeout { - XCTAssertTrue([self waitForExistenceWithTimeout:timeout], "Element described by: %@ doesn't exist, expected to exist", self.description); -} - -- (void)assertDoesNotExist { - XCTAssertFalse([self waitForExistenceWithTimeout:2], "Element described by: %@ exists, expected to not exist", self.description); -} - -@end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index e5ea812c4..b8c70e45b 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -23,11 +23,11 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/instabug_flutter/ios" SPEC CHECKSUMS: - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Instabug: 3d55eff7ea55adf22df404908a2b954b8b585c29 instabug_flutter: b9e34b14992d267f676f925de884da7eeae5e0ce OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 -PODFILE CHECKSUM: a8bb1cf031fc5abb4046443c6fa65330087bf638 +PODFILE CHECKSUM: 85507f53c31d3e834227ea88986033537c7c78b9 COCOAPODS: 1.13.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index ebd99c58a..f40f40e79 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -11,23 +11,16 @@ 2001D1442B8F501000885261 /* InstabugExampleMethodCallHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 2001D1432B8F501000885261 /* InstabugExampleMethodCallHandler.m */; }; 206286ED2ABD0A1F00925509 /* SessionReplayApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 206286EC2ABD0A1F00925509 /* SessionReplayApiTests.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3EA1F5233E85A5C4F9EF3957 /* Pods_InstabugUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5446C0D3B2623D9BCC7CCE3 /* Pods_InstabugUITests.framework */; }; 65C88E6E8EAE049E32FF2F52 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 853739F5879F6E4272829F47 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 9D381ECFBB01BD0E978EBDF2 /* Pods_InstabugTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71679BEC094CFF3474195C2E /* Pods_InstabugTests.framework */; }; - C09001B425D9A3C5006F3DAE /* BugReportingUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = C09001B325D9A3C5006F3DAE /* BugReportingUITests.m */; }; CC080E112937B7DB0041170A /* InstabugApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC080E102937B7DB0041170A /* InstabugApiTests.m */; }; CC198C61293E1A21007077C8 /* SurveysApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC198C60293E1A21007077C8 /* SurveysApiTests.m */; }; CC359DB92937720C0067A924 /* ApmApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC359DB82937720C0067A924 /* ApmApiTests.m */; }; CC3D69E7293F47FC000DCE54 /* ArgsRegistryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3D69E6293F47FC000DCE54 /* ArgsRegistryTests.m */; }; - CC6018BE2948C371003A845D /* InstabugUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6018BD2948C371003A845D /* InstabugUITests.m */; }; - CC77911C294B6E9B00296485 /* FeatureRequestsUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC77911B294B6E9B00296485 /* FeatureRequestsUITests.m */; }; - CC77911E294B707900296485 /* SurveysUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC77911D294B707900296485 /* SurveysUITests.m */; }; - CC7B6B4D2949D43D00C6274F /* XCUIElement+Instabug.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7B6B4C2949D43D00C6274F /* XCUIElement+Instabug.m */; }; - CC7B6B512949F9B700C6274F /* InstabugUITestsUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7B6B502949F9B700C6274F /* InstabugUITestsUtils.m */; }; CC9925D2293DEB0B001FD3EE /* CrashReportingApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC9925D1293DEB0B001FD3EE /* CrashReportingApiTests.m */; }; CC9925D5293DF534001FD3EE /* FeatureRequestsApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC9925D4293DF534001FD3EE /* FeatureRequestsApiTests.m */; }; CC9925D7293DFB03001FD3EE /* InstabugLogApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC9925D6293DFB03001FD3EE /* InstabugLogApiTests.m */; }; @@ -43,13 +36,6 @@ remoteGlobalIDString = 97C146ED1CF9000F007C117D; remoteInfo = Runner; }; - C09001B625D9A3C5006F3DAE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 97C146E61CF9000F007C117D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 97C146ED1CF9000F007C117D; - remoteInfo = Runner; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -71,7 +57,6 @@ 2001D1432B8F501000885261 /* InstabugExampleMethodCallHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugExampleMethodCallHandler.m; sourceTree = ""; }; 2001D1452B8F504C00885261 /* InstabugExampleMethodCallHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InstabugExampleMethodCallHandler.h; sourceTree = ""; }; 206286EC2ABD0A1F00925509 /* SessionReplayApiTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SessionReplayApiTests.m; sourceTree = ""; }; - 20CE6BF92BC6DCA400105F88 /* Apm+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Apm+Test.h"; sourceTree = ""; }; 243EF14638ECA64074771B11 /* Pods-InstabugTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugTests.release.xcconfig"; path = "Target Support Files/Pods-InstabugTests/Pods-InstabugTests.release.xcconfig"; sourceTree = ""; }; 354EA318B622513FE3FD25E4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; @@ -96,23 +81,13 @@ BF9025BBD0A6FD7B193E903A /* Pods-InstabugTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugTests.debug.xcconfig"; path = "Target Support Files/Pods-InstabugTests/Pods-InstabugTests.debug.xcconfig"; sourceTree = ""; }; C090017925D9A030006F3DAE /* InstabugTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InstabugTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C090017D25D9A031006F3DAE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C09001B125D9A3C5006F3DAE /* InstabugUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InstabugUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - C09001B325D9A3C5006F3DAE /* BugReportingUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BugReportingUITests.m; sourceTree = ""; }; - C09001B525D9A3C5006F3DAE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CC080E102937B7DB0041170A /* InstabugApiTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugApiTests.m; sourceTree = ""; }; CC198C60293E1A21007077C8 /* SurveysApiTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveysApiTests.m; sourceTree = ""; }; CC198C62293E2392007077C8 /* IBGSurvey+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "IBGSurvey+Test.h"; sourceTree = ""; }; CC359DB82937720C0067A924 /* ApmApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ApmApiTests.m; sourceTree = ""; }; CC3D69E6293F47FC000DCE54 /* ArgsRegistryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArgsRegistryTests.m; sourceTree = ""; }; - CC6018BD2948C371003A845D /* InstabugUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugUITests.m; sourceTree = ""; }; - CC77911B294B6E9B00296485 /* FeatureRequestsUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeatureRequestsUITests.m; sourceTree = ""; }; - CC77911D294B707900296485 /* SurveysUITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveysUITests.m; sourceTree = ""; }; CC78720E293CA8EE008CB2A5 /* Instabug+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Instabug+Test.h"; sourceTree = ""; }; CC787211293CAB28008CB2A5 /* IBGNetworkLogger+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "IBGNetworkLogger+Test.h"; sourceTree = ""; }; - CC7B6B4C2949D43D00C6274F /* XCUIElement+Instabug.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "XCUIElement+Instabug.m"; sourceTree = ""; }; - CC7B6B4E2949D52800C6274F /* XCUIElement+Instabug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCUIElement+Instabug.h"; sourceTree = ""; }; - CC7B6B4F2949F95600C6274F /* InstabugUITestsUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InstabugUITestsUtils.h; sourceTree = ""; }; - CC7B6B502949F9B700C6274F /* InstabugUITestsUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugUITestsUtils.m; sourceTree = ""; }; CC9925D1293DEB0B001FD3EE /* CrashReportingApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CrashReportingApiTests.m; sourceTree = ""; }; CC9925D4293DF534001FD3EE /* FeatureRequestsApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeatureRequestsApiTests.m; sourceTree = ""; }; CC9925D6293DFB03001FD3EE /* InstabugLogApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugLogApiTests.m; sourceTree = ""; }; @@ -139,14 +114,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - C09001AE25D9A3C5006F3DAE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 3EA1F5233E85A5C4F9EF3957 /* Pods_InstabugUITests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -193,7 +160,6 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, C090017A25D9A031006F3DAE /* InstabugTests */, - C09001B225D9A3C5006F3DAE /* InstabugUITests */, 97C146EF1CF9000F007C117D /* Products */, 263CD21F80996ACC7964A383 /* Pods */, 54C1C903B090526284242B67 /* Frameworks */, @@ -205,7 +171,6 @@ children = ( 97C146EE1CF9000F007C117D /* Runner.app */, C090017925D9A030006F3DAE /* InstabugTests.xctest */, - C09001B125D9A3C5006F3DAE /* InstabugUITests.xctest */, ); name = Products; sourceTree = ""; @@ -246,19 +211,6 @@ path = InstabugTests; sourceTree = ""; }; - C09001B225D9A3C5006F3DAE /* InstabugUITests */ = { - isa = PBXGroup; - children = ( - CC77911D294B707900296485 /* SurveysUITests.m */, - CC7B6B442949D0E700C6274F /* Util */, - C09001B325D9A3C5006F3DAE /* BugReportingUITests.m */, - C09001B525D9A3C5006F3DAE /* Info.plist */, - CC6018BD2948C371003A845D /* InstabugUITests.m */, - CC77911B294B6E9B00296485 /* FeatureRequestsUITests.m */, - ); - path = InstabugUITests; - sourceTree = ""; - }; CC78720A2938D1C5008CB2A5 /* Util */ = { isa = PBXGroup; children = ( @@ -270,17 +222,6 @@ path = Util; sourceTree = ""; }; - CC7B6B442949D0E700C6274F /* Util */ = { - isa = PBXGroup; - children = ( - CC7B6B4E2949D52800C6274F /* XCUIElement+Instabug.h */, - CC7B6B4C2949D43D00C6274F /* XCUIElement+Instabug.m */, - CC7B6B4F2949F95600C6274F /* InstabugUITestsUtils.h */, - CC7B6B502949F9B700C6274F /* InstabugUITestsUtils.m */, - ); - path = Util; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -326,26 +267,6 @@ productReference = C090017925D9A030006F3DAE /* InstabugTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - C09001B025D9A3C5006F3DAE /* InstabugUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = C09001BB25D9A3C5006F3DAE /* Build configuration list for PBXNativeTarget "InstabugUITests" */; - buildPhases = ( - CADA44F7640ED1F5D8ED0572 /* [CP] Check Pods Manifest.lock */, - C09001AD25D9A3C5006F3DAE /* Sources */, - C09001AE25D9A3C5006F3DAE /* Frameworks */, - C09001AF25D9A3C5006F3DAE /* Resources */, - 24075D24972065C24C6CD84D /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - C09001B725D9A3C5006F3DAE /* PBXTargetDependency */, - ); - name = InstabugUITests; - productName = InstabugUITests; - productReference = C09001B125D9A3C5006F3DAE /* InstabugUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -364,10 +285,6 @@ LastSwiftMigration = 1340; TestTargetID = 97C146ED1CF9000F007C117D; }; - C09001B025D9A3C5006F3DAE = { - CreatedOnToolsVersion = 12.3; - TestTargetID = 97C146ED1CF9000F007C117D; - }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -385,7 +302,6 @@ targets = ( 97C146ED1CF9000F007C117D /* Runner */, C090017825D9A030006F3DAE /* InstabugTests */, - C09001B025D9A3C5006F3DAE /* InstabugUITests */, ); }; /* End PBXProject section */ @@ -409,33 +325,9 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - C09001AF25D9A3C5006F3DAE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 24075D24972065C24C6CD84D /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InstabugUITests/Pods-InstabugUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InstabugUITests/Pods-InstabugUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InstabugUITests/Pods-InstabugUITests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 27D8E26CCAF4064D58654530 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -523,28 +415,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - CADA44F7640ED1F5D8ED0572 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-InstabugUITests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; F3392DEBC1FBE1A1719AA7BD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -597,19 +467,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - C09001AD25D9A3C5006F3DAE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CC7B6B512949F9B700C6274F /* InstabugUITestsUtils.m in Sources */, - CC6018BE2948C371003A845D /* InstabugUITests.m in Sources */, - CC77911C294B6E9B00296485 /* FeatureRequestsUITests.m in Sources */, - CC77911E294B707900296485 /* SurveysUITests.m in Sources */, - C09001B425D9A3C5006F3DAE /* BugReportingUITests.m in Sources */, - CC7B6B4D2949D43D00C6274F /* XCUIElement+Instabug.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -618,11 +475,6 @@ target = 97C146ED1CF9000F007C117D /* Runner */; targetProxy = C090017E25D9A031006F3DAE /* PBXContainerItemProxy */; }; - C09001B725D9A3C5006F3DAE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 97C146ED1CF9000F007C117D /* Runner */; - targetProxy = C09001B625D9A3C5006F3DAE /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -994,94 +846,6 @@ }; name = Profile; }; - C09001B825D9A3C5006F3DAE /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B03C8370EEFE061BDDDA1DA1 /* Pods-InstabugUITests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 56S6Q9SA8U; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = InstabugUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.3; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = Runner; - }; - name = Debug; - }; - C09001B925D9A3C5006F3DAE /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 671EF4FEC6834993651EBC4D /* Pods-InstabugUITests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 56S6Q9SA8U; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = InstabugUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.3; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = Runner; - }; - name = Release; - }; - C09001BA25D9A3C5006F3DAE /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A964F0D42132F93F7E4DEB73 /* Pods-InstabugUITests.profile.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 56S6Q9SA8U; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = InstabugUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.3; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = Runner; - }; - name = Profile; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1115,16 +879,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C09001BB25D9A3C5006F3DAE /* Build configuration list for PBXNativeTarget "InstabugUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C09001B825D9A3C5006F3DAE /* Debug */, - C09001B925D9A3C5006F3DAE /* Release */, - C09001BA25D9A3C5006F3DAE /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; From 23ed7cc3582bbaf0d1b76fcfaf24f958bf62a386 Mon Sep 17 00:00:00 2001 From: Ahmed Mahmoud Date: Sun, 7 Jul 2024 11:16:25 +0300 Subject: [PATCH 2/3] fix(ios): remove InstabugUITests target in Podfile --- example/ios/Podfile | 7 ------- example/ios/Podfile.lock | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/example/ios/Podfile b/example/ios/Podfile index 287784283..da39bfe98 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -42,13 +42,6 @@ target 'InstabugTests' do flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end -target 'InstabugUITests' do - use_frameworks! - use_modular_headers! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) -end - post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index b8c70e45b..5e62f7fbc 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -28,6 +28,6 @@ SPEC CHECKSUMS: instabug_flutter: b9e34b14992d267f676f925de884da7eeae5e0ce OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 -PODFILE CHECKSUM: 85507f53c31d3e834227ea88986033537c7c78b9 +PODFILE CHECKSUM: 8231e33156f35cebaa9094db274874933be79de7 COCOAPODS: 1.13.0 From 1d642fe6b227a0eb2e337df64589a22d3d277ae1 Mon Sep 17 00:00:00 2001 From: Ahmed Mahmoud Date: Sun, 7 Jul 2024 11:16:57 +0300 Subject: [PATCH 3/3] test(android): remove native e2e tests in favor of captain --- example/android/app/build.gradle | 4 - .../flutter/example/BugReportingUITest.java | 176 ------------------ .../example/FeatureRequestsUITest.java | 32 ---- .../flutter/example/InstabugUITest.java | 46 ----- .../flutter/example/SurveysUITest.java | 30 --- .../util/HasBackgroundColorMatcher.java | 33 ---- .../example/util/InstabugAssertions.java | 19 -- .../example/util/InstabugViewMatchers.java | 16 -- .../example/util/IsToTheLeftMatcher.java | 18 -- .../flutter/example/util/Keyboard.java | 28 --- 10 files changed, 402 deletions(-) delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/BugReportingUITest.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/FeatureRequestsUITest.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/InstabugUITest.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/SurveysUITest.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/util/HasBackgroundColorMatcher.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugAssertions.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugViewMatchers.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/util/IsToTheLeftMatcher.java delete mode 100644 example/android/app/src/androidTest/java/com/instabug/flutter/example/util/Keyboard.java diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 04f99d12a..13ed775e2 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -70,10 +70,6 @@ flutter { } dependencies { - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test:rules:1.1.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' - androidTestImplementation 'com.android.support.test.uiautomator:uiautomator:2.1.3' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:multidex:1.0.3' implementation 'org.mockito:mockito-core:1.10.19' diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/BugReportingUITest.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/BugReportingUITest.java deleted file mode 100644 index aed7d7014..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/BugReportingUITest.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.instabug.flutter.example; - -import androidx.test.espresso.action.ViewActions; -import androidx.test.espresso.flutter.action.FlutterActions; -import androidx.test.espresso.flutter.assertion.FlutterAssertions; -import androidx.test.espresso.flutter.matcher.FlutterMatchers; -import androidx.test.espresso.matcher.ViewMatchers; -import androidx.test.rule.ActivityTestRule; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.uiautomator.UiDevice; -import androidx.test.uiautomator.UiObject; -import androidx.test.uiautomator.UiObjectNotFoundException; -import androidx.test.uiautomator.UiSelector; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static androidx.test.espresso.Espresso.onView; -import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; -import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget; -import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; - -import static com.instabug.flutter.example.util.InstabugAssertions.assertViewWillBeVisible; -import static com.instabug.flutter.example.util.InstabugViewMatchers.isToTheLeft; - -import static org.junit.Assert.assertTrue; - -import android.app.Instrumentation; -import android.graphics.Point; - -import com.instabug.flutter.example.util.Keyboard; - -@RunWith(AndroidJUnit4.class) -public class BugReportingUITest { - Instrumentation instrumentation = getInstrumentation(); - UiDevice device = UiDevice.getInstance(instrumentation); - - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule<>(MainActivity.class); - - @Before - public void setUp() { - onFlutterWidget(FlutterMatchers.withText("Restart Instabug")) - .perform(FlutterActions.click()); - } - - private void assertOptionsPromptIsVisible() { - assertViewWillBeVisible("instabug_main_prompt_container", 2000); - } - - @Test - public void floatingButtonInvocationEvent() { - onFlutterWidget(FlutterMatchers.withText("Floating Button")).perform(FlutterActions.click()); - onView(ViewMatchers.withResourceName("instabug_floating_button")).perform(ViewActions.click()); - - assertOptionsPromptIsVisible(); - } - - @Test - public void twoFingersSwipeLeftInvocationEvent() throws InterruptedException { - onFlutterWidget(FlutterMatchers.withText("Two Fingers Swipe Left")) - .perform(FlutterActions.click()); - - // Two-fingers swipe left - UiObject text = device.findObject(new UiSelector().textContains("Hello")); - int width = device.getDisplayWidth(); - text.performTwoPointerGesture( - new Point(width - 50, 100), - new Point(width - 50, 130), - new Point(50, 100), - new Point(50, 130), - // Small steps number for fast swiping - 20 - ); - - Thread.sleep(1000); - - assertOptionsPromptIsVisible(); - } - - @Test - public void noneInvocationEvent() { - onFlutterWidget(FlutterMatchers.withText("None")).perform(FlutterActions.click()); - - onView(ViewMatchers.withResourceName("instabug_floating_button")).check(doesNotExist()); - } - - @Test - public void manualInvocation() { - onFlutterWidget(FlutterMatchers.withText("Invoke")).perform(FlutterActions.click()); - - assertOptionsPromptIsVisible(); - } - - @Test - public void multipleScreenshotsInReproSteps() throws InterruptedException, UiObjectNotFoundException { - String screen = "My Screen"; - - onFlutterWidget(FlutterMatchers.withText("Enter screen name")) - .perform(FlutterActions.scrollTo(), FlutterActions.typeText(screen)); - Thread.sleep(1000); - Keyboard.closeKeyboard(); - onFlutterWidget(FlutterMatchers.withText("Report Screen Change")) - .perform(FlutterActions.scrollTo(), FlutterActions.click(), FlutterActions.click()); - onFlutterWidget(FlutterMatchers.withText("Send Bug Report")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - UiObject reproStepsDisclaimer = assertViewWillBeVisible("instabug_text_view_repro_steps_disclaimer", 2000); - reproStepsDisclaimer.click(); - - String screenshotsListId = "instabug_vus_list"; - assertViewWillBeVisible(screenshotsListId, 5000); - onView(ViewMatchers.withResourceName(screenshotsListId)) - .check(matches(ViewMatchers.hasChildCount(2))); - } - - @Test - public void onDismissCallbackIsCalled() throws InterruptedException { - onFlutterWidget(FlutterMatchers.withText("Set On Dismiss Callback")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - onFlutterWidget(FlutterMatchers.withText("Invoke")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - Thread.sleep(1000); - device.pressBack(); - - Thread.sleep(1000); - - onFlutterWidget(FlutterMatchers.withText("onDismiss callback called with DismissType.cancel and ReportType.other")) - .check(FlutterAssertions.matches(FlutterMatchers.isExisting())); - } - - @Test - public void changeReportTypes() throws UiObjectNotFoundException { - onFlutterWidget(FlutterMatchers.withText("Bug")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - onFlutterWidget(FlutterMatchers.withText("Invoke")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - // Shows bug reporting screen - assertViewWillBeVisible("instabug_edit_text_message", 2000); - - // Close bug reporting screen - device.pressBack(); - device.findObject(new UiSelector().text("DISCARD")).click(); - - // Enable feedback reports - onFlutterWidget(FlutterMatchers.withText("Feedback")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - onFlutterWidget(FlutterMatchers.withText("Invoke")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - // Shows both bug reporting and feature requests in prompt options - assertOptionsPromptIsVisible(); - onView(ViewMatchers.withText("Report a bug")) - .check(matches(ViewMatchers.isDisplayed())); - onView(ViewMatchers.withText("Suggest an improvement")) - .check(matches(ViewMatchers.isDisplayed())); - onView(ViewMatchers.withText("Ask a question")) - .check(doesNotExist()); - } - - @Test - public void changeFloatingButtonEdge() { - onFlutterWidget(FlutterMatchers.withText("Floating Button")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - onFlutterWidget(FlutterMatchers.withText("Move Floating Button to Left")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - onView(ViewMatchers.withResourceName("instabug_floating_button")) - .check(matches(isToTheLeft())); - } -} - diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/FeatureRequestsUITest.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/FeatureRequestsUITest.java deleted file mode 100644 index 1c1eb25bc..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/FeatureRequestsUITest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.instabug.flutter.example; - -import static androidx.test.espresso.Espresso.onView; -import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget; - -import androidx.test.espresso.flutter.action.FlutterActions; -import androidx.test.espresso.flutter.matcher.FlutterMatchers; -import androidx.test.espresso.matcher.ViewMatchers; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.rule.ActivityTestRule; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(AndroidJUnit4.class) -public class FeatureRequestsUITest { - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule<>(MainActivity.class); - - @Test - public void showFeatureRequestsScreen() { - onFlutterWidget(FlutterMatchers.withText("Show Feature Requests")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - onView(ViewMatchers.withText("Feature Requests")) - .check(matches(ViewMatchers.isDisplayed())); - } -} diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/InstabugUITest.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/InstabugUITest.java deleted file mode 100644 index a2d0d4a4f..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/InstabugUITest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.instabug.flutter.example; - -import static androidx.test.espresso.Espresso.onView; -import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget; - -import static com.instabug.flutter.example.util.InstabugViewMatchers.hasBackgroundColor; - -import android.graphics.Color; - -import androidx.test.espresso.flutter.action.FlutterActions; -import androidx.test.espresso.flutter.matcher.FlutterMatchers; -import androidx.test.espresso.matcher.ViewMatchers; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.rule.ActivityTestRule; - -import com.instabug.flutter.example.util.Keyboard; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(AndroidJUnit4.class) -public class InstabugUITest { - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule<>(MainActivity.class); - - @Test - public void changePrimaryColor() { - String color = "#FF0000"; - Color expected = Color.valueOf(0xFFFF0000); - - onFlutterWidget(FlutterMatchers.withText("Enter primary color")) - .perform(FlutterActions.typeText(color)); - Keyboard.closeKeyboard(); - onFlutterWidget(FlutterMatchers.withText("Change Primary Color")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - onFlutterWidget(FlutterMatchers.withText("Floating Button")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - onView(ViewMatchers.withResourceName("instabug_floating_button")) - .check(matches(hasBackgroundColor(expected))); - } -} diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/SurveysUITest.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/SurveysUITest.java deleted file mode 100644 index b5f47386c..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/SurveysUITest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.instabug.flutter.example; - -import static androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget; - -import static com.instabug.flutter.example.util.InstabugAssertions.assertViewWillBeVisible; - -import androidx.test.espresso.flutter.action.FlutterActions; -import androidx.test.espresso.flutter.matcher.FlutterMatchers; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.rule.ActivityTestRule; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(AndroidJUnit4.class) -public class SurveysUITest { - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule<>(MainActivity.class); - - @Test - public void showManualSurvey() { - onFlutterWidget(FlutterMatchers.withText("Show Manual Survey")) - .perform(FlutterActions.scrollTo(), FlutterActions.click()); - - assertViewWillBeVisible("instabug_survey_dialog_container", 2000); - } -} diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/HasBackgroundColorMatcher.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/HasBackgroundColorMatcher.java deleted file mode 100644 index bcf419670..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/HasBackgroundColorMatcher.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.instabug.flutter.example.util; - -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.view.View; - -import org.hamcrest.Description; -import org.hamcrest.TypeSafeMatcher; - -public final class HasBackgroundColorMatcher extends TypeSafeMatcher { - - private final Color color; - - public HasBackgroundColorMatcher(Color color) { - this.color = color; - } - - @Override - protected boolean matchesSafely(View view) { - int width = view.getWidth(); - int height = view.getHeight(); - Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(bitmap); - view.getBackground().draw(canvas); - return bitmap.getColor(width / 2, height / 2).equals(color); - } - - @Override - public void describeTo(Description description) { - description.appendText("has background with color: " + color); - } -} \ No newline at end of file diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugAssertions.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugAssertions.java deleted file mode 100644 index 31c62c344..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugAssertions.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.instabug.flutter.example.util; - -import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; -import static org.junit.Assert.assertTrue; - -import androidx.test.uiautomator.UiDevice; -import androidx.test.uiautomator.UiObject; -import androidx.test.uiautomator.UiSelector; - -public class InstabugAssertions { - private static final UiDevice device = UiDevice.getInstance(getInstrumentation()); - - public static UiObject assertViewWillBeVisible(String resourceId, long timeout) { - UiObject view = device.findObject(new UiSelector().resourceIdMatches(".*:id/" + resourceId)); - boolean isDisplayed = view.waitForExists(timeout); - assertTrue("View with ID " + resourceId + "didn't show up", isDisplayed); - return view; - } -} diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugViewMatchers.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugViewMatchers.java deleted file mode 100644 index 67ec0c570..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/InstabugViewMatchers.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.instabug.flutter.example.util; - -import android.graphics.Color; -import android.view.View; - -import org.hamcrest.Matcher; - -public class InstabugViewMatchers { - public static Matcher hasBackgroundColor(Color color) { - return new HasBackgroundColorMatcher(color); - } - - public static Matcher isToTheLeft() { - return new IsToTheLeftMatcher(); - } -} diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/IsToTheLeftMatcher.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/IsToTheLeftMatcher.java deleted file mode 100644 index d49edb2f4..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/IsToTheLeftMatcher.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.instabug.flutter.example.util; - -import android.view.View; - -import org.hamcrest.Description; -import org.hamcrest.TypeSafeMatcher; - -public final class IsToTheLeftMatcher extends TypeSafeMatcher { - @Override - protected boolean matchesSafely(View view) { - return view.getRight() > view.getLeft(); - } - - @Override - public void describeTo(Description description) { - description.appendText("is to the left"); - } -} \ No newline at end of file diff --git a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/Keyboard.java b/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/Keyboard.java deleted file mode 100644 index a279fb834..000000000 --- a/example/android/app/src/androidTest/java/com/instabug/flutter/example/util/Keyboard.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.instabug.flutter.example.util; - -import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; - -import android.app.Instrumentation; -import android.view.accessibility.AccessibilityWindowInfo; - -import androidx.test.uiautomator.UiDevice; - -public class Keyboard { - private static final Instrumentation instrumentation = getInstrumentation(); - private static final UiDevice device = UiDevice.getInstance(instrumentation); - - public static void closeKeyboard() { - if (isKeyboardOpened()) { - device.pressBack(); - } - } - - private static boolean isKeyboardOpened() { - for (AccessibilityWindowInfo window : instrumentation.getUiAutomation().getWindows()) { - if (window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { - return true; - } - } - return false; - } -}