Skip to content

Commit 1a1c9e0

Browse files
committed
chore: fix broken CI build / test
1 parent ea15617 commit 1a1c9e0

File tree

7 files changed

+131
-112
lines changed

7 files changed

+131
-112
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,68 @@ name: Cordova HTTP Plugin CI
33
on: [push]
44

55
env:
6-
nodejs: '10.x'
6+
nodejs: "16.x"
7+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
8+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
79

810
jobs:
911
test-www-interface:
1012
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v1
13-
- name: Install Node.js ${{ env.nodejs }}
14-
uses: actions/setup-node@v1
15-
with:
16-
node-version: ${{ env.nodejs }}
17-
- name: Install node modules
18-
run: npm ci
19-
- name: Run WWW interface tests
20-
run: npm run testjs
14+
- uses: actions/checkout@v1
15+
- name: Install Node.js ${{ env.nodejs }}
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ env.nodejs }}
19+
- name: Install node modules
20+
run: npm ci
21+
- name: Run WWW interface tests
22+
run: npm run testjs
2123

2224
build-ios:
2325
runs-on: macOS-latest
2426
steps:
25-
- uses: actions/checkout@v1
26-
- name: Install Node.js ${{ env.nodejs }}
27-
uses: actions/setup-node@v1
28-
with:
29-
node-version: ${{ env.nodejs }}
30-
- name: Install node modules
31-
run: npm ci
32-
- name: Update test cert for httpbin.org
33-
run: npm run updatecert
34-
- name: Build test app
35-
run: scripts/build-test-app.sh --ios --emulator
27+
- uses: actions/checkout@v1
28+
- name: Install Node.js ${{ env.nodejs }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ env.nodejs }}
32+
- name: Install node modules
33+
run: npm ci
34+
- name: Update test cert for httpbin.org
35+
run: npm run updatecert
36+
- name: Build test app
37+
run: scripts/build-test-app.sh --ios --emulator
38+
- name: Upload artifact to BrowserStack
39+
if: env.BROWSERSTACK_USERNAME != ''
40+
run: scripts/upload-browserstack.sh --ios
41+
- name: Run e2e tests
42+
if: env.BROWSERSTACK_USERNAME != ''
43+
run: scripts/test-app.sh --ios --device
3644

3745
build-android:
3846
runs-on: ubuntu-latest
39-
env:
40-
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
41-
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
4247
steps:
43-
- uses: actions/checkout@v1
44-
- name: Install Node.js ${{ env.nodejs }}
45-
uses: actions/setup-node@v1
46-
with:
47-
node-version: ${{ env.nodejs }}
48-
- name: Install node modules
49-
run: npm ci
50-
- name: Install JDK 1.8
51-
uses: actions/setup-java@v1
52-
with:
53-
java-version: 1.8
54-
- name: Update test cert for httpbin.org
55-
run: npm run updatecert
56-
- name: Add workaround for missing DX files in build-tools 31 (https://stackoverflow.com/a/68430992)
57-
run: ln -s $ANDROID_HOME/build-tools/31.0.0/d8 $ANDROID_HOME/build-tools/31.0.0/dx && ln -s $ANDROID_HOME/build-tools/31.0.0/lib/d8.jar $ANDROID_HOME/build-tools/31.0.0/lib/dx.jar
58-
- name: Build test app
59-
run: scripts/build-test-app.sh --android --device
60-
- name: Upload artifact to BrowserStack
61-
if: env.BROWSERSTACK_USERNAME != ''
62-
run: scripts/upload-browserstack.sh --android
63-
- name: Run e2e tests
64-
if: env.BROWSERSTACK_USERNAME != ''
65-
run: scripts/test-app.sh --android --device
48+
- uses: actions/checkout@v1
49+
- name: Install Node.js ${{ env.nodejs }}
50+
uses: actions/setup-node@v1
51+
with:
52+
node-version: ${{ env.nodejs }}
53+
- name: Install node modules
54+
run: npm ci
55+
- name: Install JDK 1.8
56+
uses: actions/setup-java@v1
57+
with:
58+
java-version: 1.8
59+
- name: Update test cert for httpbin.org
60+
run: npm run updatecert
61+
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
62+
run: ln -s $ANDROID_HOME/build-tools/32.0.0/d8 $ANDROID_HOME/build-tools/32.0.0/dx && ln -s $ANDROID_HOME/build-tools/32.0.0/lib/d8.jar $ANDROID_HOME/build-tools/32.0.0/lib/dx.jar
63+
- name: Build test app
64+
run: scripts/build-test-app.sh --android --device
65+
- name: Upload artifact to BrowserStack
66+
if: env.BROWSERSTACK_USERNAME != ''
67+
run: scripts/upload-browserstack.sh --android
68+
- name: Run e2e tests
69+
if: env.BROWSERSTACK_USERNAME != ''
70+
run: scripts/test-app.sh --android --device

.travis.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,52 @@ addons:
77

88
matrix:
99
include:
10-
- name: "iOS Build & Test"
11-
language: objective-c
12-
sudo: false
13-
os: osx
14-
osx_image: xcode12.5
15-
16-
before_install:
17-
- export LANG=en_US.UTF-8 &&
18-
nvm use 14
19-
20-
install:
21-
- npm install
22-
23-
script:
24-
- npm run testjs &&
25-
npm run updatecert &&
26-
scripts/build-test-app.sh --ios --emulator &&
27-
scripts/upload-saucelabs.sh --ios &&
28-
scripts/test-app.sh --ios --emulator;
29-
30-
- name: "Android Build & Test"
31-
language: android
32-
sudo : required
33-
34-
android:
35-
components:
36-
- tools
37-
- platform-tools
38-
- build-tools-28.0.3
39-
- android-28
40-
- extra-android-support
41-
- extra-android-m2repository
42-
- extra-google-m2repository
43-
44-
before_install:
45-
- export LANG=en_US.UTF-8 &&
46-
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
47-
sudo apt-get install -y nodejs
48-
- yes | sdkmanager --update
49-
50-
install:
51-
- npm install
52-
53-
script:
54-
- npm run testjs &&
55-
npm run updatecert &&
56-
scripts/build-test-app.sh --android --emulator &&
57-
scripts/upload-saucelabs.sh --android &&
58-
scripts/test-app.sh --android --emulator;
10+
- name: "iOS Build & Test"
11+
language: objective-c
12+
sudo: false
13+
os: osx
14+
osx_image: xcode12.5
15+
16+
before_install:
17+
- export LANG=en_US.UTF-8 &&
18+
nvm use 14
19+
20+
install:
21+
- npm install
22+
23+
script:
24+
- npm run testjs &&
25+
npm run updatecert &&
26+
scripts/build-test-app.sh --ios --emulator &&
27+
scripts/upload-saucelabs.sh --ios &&
28+
scripts/test-app.sh --ios --emulator;
29+
30+
- name: "Android Build & Test"
31+
language: android
32+
sudo: required
33+
34+
android:
35+
components:
36+
- tools
37+
- platform-tools
38+
- build-tools-30.0.1
39+
- android-28
40+
- extra-android-support
41+
- extra-android-m2repository
42+
- extra-google-m2repository
43+
44+
before_install:
45+
- export LANG=en_US.UTF-8 &&
46+
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&
47+
sudo apt-get install -y nodejs
48+
- yes | sdkmanager --update
49+
50+
install:
51+
- npm install
52+
53+
script:
54+
- npm run testjs &&
55+
npm run updatecert &&
56+
scripts/build-test-app.sh --android --emulator &&
57+
scripts/upload-saucelabs.sh --android &&
58+
scripts/test-app.sh --android --emulator;

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"cordova": "10.0.0",
6464
"mocha": "8.2.0",
6565
"umd-tough-cookie": "2.4.3",
66-
"wd": "1.12.1",
66+
"wd": "1.14.0",
6767
"xml2js": "0.4.23"
6868
}
6969
}

test/e2e-app-template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": "Apache-2.0",
1313
"dependencies": {
1414
"cordova": "10.0.0",
15-
"cordova-android": "9.0.0",
15+
"cordova-android": "10.1.1",
1616
"cordova-browser": "6.0.0",
1717
"cordova-ios": "6.2.0",
1818
"cordova-plugin-device": "2.0.3",

test/e2e-specs.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ const helpers = {
5252
xhr.open('GET', url);
5353
xhr.send();
5454
},
55+
readFileEntryAsText: function(fileEntry, onSuccess, onFail) {
56+
var reader = new FileReader();
57+
58+
reader.onerror = onFail;
59+
60+
reader.onloadend = function() {
61+
onSuccess(reader.result);
62+
};
63+
64+
fileEntry.file(function(file) {
65+
reader.readAsText(file);
66+
}, onFail);
67+
},
5568
writeToFile: function (done, fileName, content) {
5669
window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function (directoryEntry) {
5770
directoryEntry.getFile(fileName, { create: true, exclusive: false }, function (fileEntry) {
@@ -342,15 +355,15 @@ const tests = [
342355
var targetPath = cordova.file.cacheDirectory + 'test.xml';
343356

344357
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
345-
helpers.getWithXhr(function (content) {
358+
helpers.readFileEntryAsText(entry, function(content) {
346359
resolve({
347360
sourceUrl: sourceUrl,
348361
targetPath: targetPath,
349362
fullPath: entry.fullPath,
350363
name: entry.name,
351364
content: content
352365
});
353-
}, targetPath);
366+
}, reject);
354367
}, reject);
355368
},
356369
validationFunc: function (driver, result) {
@@ -520,15 +533,15 @@ const tests = [
520533
cordova.plugin.http.setCookie('http://httpbin.org/get', 'mySecondCookie=mySecondValue');
521534

522535
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
523-
helpers.getWithXhr(function (content) {
536+
helpers.readFileEntryAsText(entry, function (content) {
524537
resolve({
525538
sourceUrl: sourceUrl,
526539
targetPath: targetPath,
527540
fullPath: entry.fullPath,
528541
name: entry.name,
529542
content: content
530543
});
531-
}, targetPath);
544+
}, reject);
532545
}, reject);
533546
},
534547
validationFunc: function (driver, result) {
@@ -697,15 +710,15 @@ const tests = [
697710
var targetPath = cordova.file.cacheDirectory + 'test.xml';
698711

699712
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
700-
helpers.getWithXhr(function (content) {
713+
helpers.readFileEntryAsText(entry, function (content) {
701714
resolve({
702715
sourceUrl: sourceUrl,
703716
targetPath: targetPath,
704717
fullPath: entry.fullPath,
705718
name: entry.name,
706719
content: content
707720
});
708-
}, targetPath);
721+
}, reject);
709722
}, reject);
710723
},
711724
validationFunc: function (driver, result) {

test/e2e-tooling/caps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const configs = {
6464
os_version: '14',
6565
project: 'HTTP Test App',
6666
autoWebview: true,
67-
app: 'HttpTestAppAndroid',
67+
app: 'HttpTestAppIos',
6868
'browserstack.networkLogs': false
6969
},
7070
browserstackAndroidDevice: {

0 commit comments

Comments
 (0)