Skip to content

Commit da97010

Browse files
committed
iOS Travis CI build
1 parent f39d1d8 commit da97010

File tree

8 files changed

+381
-265
lines changed

8 files changed

+381
-265
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ coverage
6060

6161
# Snapshots
6262
__tests__/**/__snapshots__
63+
64+
# Fastline
65+
fastlane/test_output

.travis.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
os: linux
2-
language: android
3-
dist: trusty
4-
android:
5-
components:
6-
- build-tools-28.0.3
7-
- android-28
8-
before_install:
9-
- yes | sdkmanager "platforms;android-28"
10-
- yes | sdkmanager "build-tools;28.0.1"
1+
install:
112
- nvm install $(jq -r '.engines.node' package.json) && nvm use $(jq -r '.engines.node' package.json)
123
- npm install -g "npm@$(jq -r '.engines.npm' package.json)"
13-
install:
144
- npm ci
15-
script:
16-
- "./android/gradlew assembleRelease -p android/"
17-
after_success:
18-
- npm run coveralls
5+
matrix:
6+
include:
7+
- os: linux
8+
language: android
9+
dist: trusty
10+
android:
11+
components:
12+
- build-tools-28.0.3
13+
- android-28
14+
before_install:
15+
- yes | sdkmanager "platforms;android-28"
16+
- yes | sdkmanager "build-tools;28.0.1"
17+
script:
18+
- "./android/gradlew assembleRelease -p android/"
19+
- os: osx
20+
osx_image: xcode9.3
21+
before_install:
22+
- brew install jq
23+
- brew cask install fastlane
24+
script:
25+
- fastlane ios test

fastlane/Appfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# For more information about the Appfile, see:
2+
# https://docs.fastlane.tools/advanced/#appfile
3+
4+
app_identifier("org.reactjs.native.example.ecommerce")

fastlane/Fastfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file contains the fastlane.tools configuration
2+
# You can find the documentation at https://docs.fastlane.tools
3+
4+
platform :ios do
5+
desc "Runs all the tests"
6+
lane :test do
7+
# https://docs.fastlane.tools/actions/scan/
8+
scan(
9+
project: "ios/ecommerce.xcodeproj",
10+
scheme: "ecommerce"
11+
)
12+
end
13+
end

fastlane/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
fastlane documentation
2+
================
3+
# Installation
4+
5+
Make sure you have the latest version of the Xcode command line tools installed:
6+
7+
```
8+
xcode-select --install
9+
```
10+
11+
Install _fastlane_ using
12+
```
13+
[sudo] gem install fastlane -NV
14+
```
15+
or alternatively using `brew cask install fastlane`
16+
17+
# Available Actions
18+
## iOS
19+
### ios test
20+
```
21+
fastlane ios test
22+
```
23+
Runs all the tests
24+
25+
----
26+
27+
This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
28+
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
29+
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

fastlane/report.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites>
3+
<testsuite name="fastlane.lanes">
4+
5+
6+
7+
8+
<testcase classname="fastlane.lanes" name="0: scan" time="69.758607">
9+
10+
</testcase>
11+
12+
</testsuite>
13+
</testsuites>

ios/ecommerce.xcodeproj/project.pbxproj

Lines changed: 297 additions & 202 deletions
Large diffs are not rendered by default.

ios/ecommerceTests/ecommerceTests.m

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,10 @@
1111
#import <React/RCTLog.h>
1212
#import <React/RCTRootView.h>
1313

14-
#define TIMEOUT_SECONDS 600
15-
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
16-
1714
@interface ecommerceTests : XCTestCase
1815

1916
@end
2017

2118
@implementation ecommerceTests
2219

23-
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24-
{
25-
if (test(view)) {
26-
return YES;
27-
}
28-
for (UIView *subview in [view subviews]) {
29-
if ([self findSubviewInView:subview matching:test]) {
30-
return YES;
31-
}
32-
}
33-
return NO;
34-
}
35-
36-
- (void)testRendersWelcomeScreen
37-
{
38-
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
39-
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40-
BOOL foundElement = NO;
41-
42-
__block NSString *redboxError = nil;
43-
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
44-
if (level >= RCTLogLevelError) {
45-
redboxError = message;
46-
}
47-
});
48-
49-
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
50-
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
51-
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
52-
53-
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
54-
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
55-
return YES;
56-
}
57-
return NO;
58-
}];
59-
}
60-
61-
RCTSetLogFunction(RCTDefaultLogFunction);
62-
63-
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64-
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65-
}
66-
67-
6820
@end

0 commit comments

Comments
 (0)