Skip to content

Commit 7c06620

Browse files
author
Ali Abdelfattah
authored
Merge pull request #344 from Instabug/e2e/setup
e2e/ios setup
2 parents 018081b + ebd3e4c commit 7c06620

File tree

21 files changed

+1647
-1518
lines changed

21 files changed

+1647
-1518
lines changed

.circleci/config.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ jobs:
115115
command: cd android && ./gradlew androidDependencies
116116
- run:
117117
name: Run UnitTest
118-
command: cd android && ./gradlew test
118+
command: cd android && ./gradlew test
119119

120-
121-
ios_test:
120+
test_ios:
122121
macos:
123122
xcode: "10.2.0"
124123
working_directory: ~/project/InstabugSample/ios
@@ -140,6 +139,40 @@ jobs:
140139
name: Build and run tests
141140
command: xcodebuild -workspace InstabugSample.xcworkspace -scheme InstabugSample -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X,OS=12.2' test | xcpretty
142141

142+
e2e_ios:
143+
macos:
144+
xcode: "10.2.0"
145+
working_directory: ~/project/InstabugSample
146+
environment:
147+
FL_OUTPUT_DIR: output
148+
steps:
149+
- checkout:
150+
path: ~/project
151+
- run:
152+
name: Install React Native CLI
153+
command: npm install -g react-native-cli
154+
- run:
155+
name: Install Detox CLI
156+
command: npm install -g detox-cli
157+
- run:
158+
name: Install Detox Utils
159+
command: brew tap wix/brew && brew install applesimutils
160+
- run:
161+
name: Install node_modules
162+
command: yarn
163+
- run:
164+
name: Fetch CocoaPods Specs
165+
command: cd ios && curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
166+
- run:
167+
name: Install CocoaPods
168+
command: cd ios && pod install
169+
- run:
170+
name: Detox - Build Release App
171+
command: detox build --configuration ios.sim.release
172+
- run:
173+
name: Detox - Run E2E Tests
174+
command: detox test --configuration ios.sim.release --cleanup
175+
143176
publish:
144177
macos:
145178
xcode: "10.1.0"
@@ -150,7 +183,6 @@ jobs:
150183
- run: cd Escape/.build/release; cp -f Escape /usr/local/bin/escape
151184
- run: Escape react-native publish
152185

153-
154186
workflows:
155187
version: 2
156188
publish:
@@ -159,13 +191,13 @@ workflows:
159191
- test_module
160192
- test_sample
161193
- test_android
162-
- ios_test
194+
- test_ios
163195
- hold:
164196
requires:
165197
- test_module
166198
- test_sample
167199
- test_android
168-
- ios_test
200+
- test_ios
169201
type: approval
170202
filters:
171203
branches:

InstabugSample/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class App extends Component<{}> {
4040

4141
render() {
4242
return (
43-
<View style={styles.container}>
43+
<View testID='welcome' style={styles.container}>
4444
<ScrollView contentContainerStyle={styles.contentContainer} >
4545
<Text style={styles.details}>
4646
Hello {"Instabug's"} awesome user! The purpose of this application is to show you the different

InstabugSample/__e2e__/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"setupFilesAfterEnv": ["./init.js"],
3+
"testEnvironment": "node",
4+
"reporters": ["detox/runners/jest/streamlineReporter"],
5+
"verbose": true
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Example', () => {
2+
beforeEach(async () => {
3+
await device.reloadReactNative();
4+
});
5+
6+
it('should have welcome screen', async () => {
7+
await expect(element(by.id('welcome'))).toBeVisible();
8+
});
9+
});

InstabugSample/__e2e__/init.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const detox = require('detox');
2+
const config = require('../package.json').detox;
3+
const adapter = require('detox/runners/jest/adapter');
4+
const specReporter = require('detox/runners/jest/specReporter');
5+
6+
// Set the default timeout
7+
jest.setTimeout(120000);
8+
jasmine.getEnv().addReporter(adapter);
9+
10+
// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
11+
// This is strictly optional.
12+
jasmine.getEnv().addReporter(specReporter);
13+
14+
beforeAll(async () => {
15+
await detox.init(config);
16+
});
17+
18+
beforeEach(async () => {
19+
await adapter.beforeEach();
20+
});
21+
22+
afterAll(async () => {
23+
await adapter.afterAll();
24+
await detox.cleanup();
25+
});

InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
BAD36E2F22F19788007F5E74 /* InstabugFeatureRequestsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BAD36E2E22F19788007F5E74 /* InstabugFeatureRequestsTests.m */; };
2121
BAD36E3122F19973007F5E74 /* InstabugRepliesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BAD36E3022F19973007F5E74 /* InstabugRepliesTests.m */; };
2222
BAD36E3322F19B1B007F5E74 /* InstabugSurveysTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BAD36E3222F19B1B007F5E74 /* InstabugSurveysTests.m */; };
23+
C006102922E9EBCA00EDC852 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C006102822E9EBCA00EDC852 /* libOCMock.a */; };
2324
/* End PBXBuildFile section */
2425

2526
/* Begin PBXContainerItemProxy section */
@@ -61,6 +62,7 @@
6162
BAD36E2E22F19788007F5E74 /* InstabugFeatureRequestsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugFeatureRequestsTests.m; sourceTree = "<group>"; };
6263
BAD36E3022F19973007F5E74 /* InstabugRepliesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugRepliesTests.m; sourceTree = "<group>"; };
6364
BAD36E3222F19B1B007F5E74 /* InstabugSurveysTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstabugSurveysTests.m; sourceTree = "<group>"; };
65+
C006102822E9EBCA00EDC852 /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libOCMock.a; path = usr/lib/libOCMock.a; sourceTree = "<group>"; };
6466
C74E4010ABE7AFC7DB5E79DC /* Pods-InstabugSampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugSampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InstabugSampleTests/Pods-InstabugSampleTests.debug.xcconfig"; sourceTree = "<group>"; };
6567
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
6668
/* End PBXFileReference section */
@@ -70,6 +72,7 @@
7072
isa = PBXFrameworksBuildPhase;
7173
buildActionMask = 2147483647;
7274
files = (
75+
C006102922E9EBCA00EDC852 /* libOCMock.a in Frameworks */,
7376
39B75062AA5F42B6E4C8E3C7 /* libPods-InstabugSampleTests.a in Frameworks */,
7477
);
7578
runOnlyForDeploymentPostprocessing = 0;
@@ -126,6 +129,7 @@
126129
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
127130
isa = PBXGroup;
128131
children = (
132+
C006102822E9EBCA00EDC852 /* libOCMock.a */,
129133
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
130134
A0EF1FBF0176E13B30EA2D29 /* libPods-InstabugSample.a */,
131135
7A03A15E2685C1231729CA8B /* libPods-InstabugSampleTests.a */,
@@ -342,7 +346,7 @@
342346
files = (
343347
);
344348
inputPaths = (
345-
"${SRCROOT}/Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample-frameworks.sh",
349+
"${PODS_ROOT}/Target Support Files/Pods-InstabugSample/Pods-InstabugSample-frameworks.sh",
346350
"${PODS_ROOT}/../../node_modules/instabug-reactnative/ios/Instabug.framework",
347351
);
348352
name = "[CP] Embed Pods Frameworks";
@@ -351,7 +355,7 @@
351355
);
352356
runOnlyForDeploymentPostprocessing = 0;
353357
shellPath = /bin/sh;
354-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample-frameworks.sh\"\n";
358+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InstabugSample/Pods-InstabugSample-frameworks.sh\"\n";
355359
showEnvVarsInLog = 0;
356360
};
357361
D495E6145A3927C0CCE13073 /* [CP] Check Pods Manifest.lock */ = {
@@ -453,9 +457,39 @@
453457
"DEBUG=1",
454458
"$(inherited)",
455459
);
460+
HEADER_SEARCH_PATHS = (
461+
"$(inherited)",
462+
"\"${PODS_ROOT}/Headers/Public\"",
463+
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
464+
"\"${PODS_ROOT}/Headers/Public/React-Core\"",
465+
"\"${PODS_ROOT}/Headers/Public/React-DevSupport\"",
466+
"\"${PODS_ROOT}/Headers/Public/React-RCTActionSheet\"",
467+
"\"${PODS_ROOT}/Headers/Public/React-RCTAnimation\"",
468+
"\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"",
469+
"\"${PODS_ROOT}/Headers/Public/React-RCTImage\"",
470+
"\"${PODS_ROOT}/Headers/Public/React-RCTLinking\"",
471+
"\"${PODS_ROOT}/Headers/Public/React-RCTNetwork\"",
472+
"\"${PODS_ROOT}/Headers/Public/React-RCTSettings\"",
473+
"\"${PODS_ROOT}/Headers/Public/React-RCTText\"",
474+
"\"${PODS_ROOT}/Headers/Public/React-RCTVibration\"",
475+
"\"${PODS_ROOT}/Headers/Public/React-RCTWebSocket\"",
476+
"\"${PODS_ROOT}/Headers/Public/React-cxxreact\"",
477+
"\"${PODS_ROOT}/Headers/Public/React-fishhook\"",
478+
"\"${PODS_ROOT}/Headers/Public/React-jsi\"",
479+
"\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"",
480+
"\"${PODS_ROOT}/Headers/Public/React-jsinspector\"",
481+
"\"${PODS_ROOT}/Headers/Public/glog\"",
482+
"\"${PODS_ROOT}/Headers/Public/instabug-reactnative\"",
483+
"\"${PODS_ROOT}/Headers/Public/yoga\"",
484+
"$(PROJECT_DIR)/usr/include",
485+
);
456486
INFOPLIST_FILE = InstabugSampleTests/Info.plist;
457487
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
458488
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
489+
LIBRARY_SEARCH_PATHS = (
490+
"$(inherited)",
491+
"$(PROJECT_DIR)/usr/lib",
492+
);
459493
OTHER_LDFLAGS = (
460494
"-ObjC",
461495
"-lc++",
@@ -469,13 +503,43 @@
469503
};
470504
00E356F71AD99517003FC87E /* Release */ = {
471505
isa = XCBuildConfiguration;
472-
baseConfigurationReference = 62941153FBCA702BE7DDD700 /* Pods-InstabugSampleTests.release.xcconfig */;
506+
baseConfigurationReference = 6AADF551224449E100BEC5F2 /* Pods-InstabugSampleTests.release.xcconfig */;
473507
buildSettings = {
474508
BUNDLE_LOADER = "$(TEST_HOST)";
475509
COPY_PHASE_STRIP = NO;
510+
HEADER_SEARCH_PATHS = (
511+
"$(inherited)",
512+
"\"${PODS_ROOT}/Headers/Public\"",
513+
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
514+
"\"${PODS_ROOT}/Headers/Public/React-Core\"",
515+
"\"${PODS_ROOT}/Headers/Public/React-DevSupport\"",
516+
"\"${PODS_ROOT}/Headers/Public/React-RCTActionSheet\"",
517+
"\"${PODS_ROOT}/Headers/Public/React-RCTAnimation\"",
518+
"\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"",
519+
"\"${PODS_ROOT}/Headers/Public/React-RCTImage\"",
520+
"\"${PODS_ROOT}/Headers/Public/React-RCTLinking\"",
521+
"\"${PODS_ROOT}/Headers/Public/React-RCTNetwork\"",
522+
"\"${PODS_ROOT}/Headers/Public/React-RCTSettings\"",
523+
"\"${PODS_ROOT}/Headers/Public/React-RCTText\"",
524+
"\"${PODS_ROOT}/Headers/Public/React-RCTVibration\"",
525+
"\"${PODS_ROOT}/Headers/Public/React-RCTWebSocket\"",
526+
"\"${PODS_ROOT}/Headers/Public/React-cxxreact\"",
527+
"\"${PODS_ROOT}/Headers/Public/React-fishhook\"",
528+
"\"${PODS_ROOT}/Headers/Public/React-jsi\"",
529+
"\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"",
530+
"\"${PODS_ROOT}/Headers/Public/React-jsinspector\"",
531+
"\"${PODS_ROOT}/Headers/Public/glog\"",
532+
"\"${PODS_ROOT}/Headers/Public/instabug-reactnative\"",
533+
"\"${PODS_ROOT}/Headers/Public/yoga\"",
534+
"$(PROJECT_DIR)/usr/include",
535+
);
476536
INFOPLIST_FILE = InstabugSampleTests/Info.plist;
477537
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
478538
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
539+
LIBRARY_SEARCH_PATHS = (
540+
"$(inherited)",
541+
"$(PROJECT_DIR)/usr/lib",
542+
);
479543
OTHER_LDFLAGS = (
480544
"-ObjC",
481545
"-lc++",
@@ -510,7 +574,7 @@
510574
};
511575
13B07F951A680F5B00A75B9A /* Release */ = {
512576
isa = XCBuildConfiguration;
513-
baseConfigurationReference = 6520812BE77D6515D82803F8 /* Pods-InstabugSample.release.xcconfig */;
577+
baseConfigurationReference = 499132AD8910CB4D10684C0B /* Pods-InstabugSample.release.xcconfig */;
514578
buildSettings = {
515579
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
516580
CURRENT_PROJECT_VERSION = 1;

InstabugSample/ios/InstabugSample/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"idiom" : "iphone",
515
"size" : "29x29",
@@ -29,6 +39,11 @@
2939
"idiom" : "iphone",
3040
"size" : "60x60",
3141
"scale" : "3x"
42+
},
43+
{
44+
"idiom" : "ios-marketing",
45+
"size" : "1024x1024",
46+
"scale" : "1x"
3247
}
3348
],
3449
"info" : {

InstabugSample/ios/Podfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ target 'InstabugSample' do
2323
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
2424
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
2525
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
26-
27-
pod 'OCMock', '~> 3.4'
2826

2927
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
3028
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2009-2018 Erik Doernenburg and contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
* not use these files except in compliance with the License. You may obtain
6+
* a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
#import <Foundation/Foundation.h>
18+
19+
@class OCObserverMockObject;
20+
21+
22+
@interface NSNotificationCenter(OCMAdditions)
23+
24+
- (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender;
25+
26+
@end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2009-2018 Erik Doernenburg and contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
* not use these files except in compliance with the License. You may obtain
6+
* a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
#import <Foundation/Foundation.h>
18+
19+
@interface OCMArg : NSObject
20+
21+
// constraining arguments
22+
23+
+ (id)any;
24+
+ (SEL)anySelector;
25+
+ (void *)anyPointer;
26+
+ (id __autoreleasing *)anyObjectRef;
27+
+ (id)isNil;
28+
+ (id)isNotNil;
29+
+ (id)isEqual:(id)value;
30+
+ (id)isNotEqual:(id)value;
31+
+ (id)isKindOfClass:(Class)cls;
32+
+ (id)checkWithSelector:(SEL)selector onObject:(id)anObject;
33+
+ (id)checkWithBlock:(BOOL (^)(id obj))block;
34+
35+
// manipulating arguments
36+
37+
+ (id *)setTo:(id)value;
38+
+ (void *)setToValue:(NSValue *)value;
39+
+ (id)invokeBlock;
40+
+ (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION;
41+
42+
+ (id)defaultValue;
43+
44+
// internal use only
45+
46+
+ (id)resolveSpecialValues:(NSValue *)value;
47+
48+
@end
49+
50+
#define OCMOCK_ANY [OCMArg any]
51+
52+
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
53+
#define OCMOCK_VALUE(variable) \
54+
({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; })
55+
#else
56+
#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))]
57+
#endif
58+

0 commit comments

Comments
 (0)