mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2024-10-06 00:52:12 +08:00
chore: fix broken CI build / test
This commit is contained in:
parent
ea15617fae
commit
ed08534cf3
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
@ -3,7 +3,9 @@ name: Cordova HTTP Plugin CI
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
nodejs: '10.x'
|
||||
nodejs: "16.x"
|
||||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
||||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
test-www-interface:
|
||||
@ -17,7 +19,7 @@ jobs:
|
||||
- name: Install node modules
|
||||
run: npm ci
|
||||
- name: Run WWW interface tests
|
||||
run: npm run testjs
|
||||
run: npm run test:js
|
||||
|
||||
build-ios:
|
||||
runs-on: macOS-latest
|
||||
@ -30,15 +32,20 @@ jobs:
|
||||
- name: Install node modules
|
||||
run: npm ci
|
||||
- name: Update test cert for httpbin.org
|
||||
run: npm run updatecert
|
||||
run: npm run update:cert
|
||||
# need to find a solution for signing iOS App so we can build for device target instead simulator
|
||||
- name: Build test app
|
||||
run: scripts/build-test-app.sh --ios --emulator
|
||||
- name: Upload artifact to BrowserStack
|
||||
if: env.BROWSERSTACK_USERNAME != ''
|
||||
run: scripts/upload-browserstack.sh --ios
|
||||
# need to have an App for device target
|
||||
# - name: Run e2e tests
|
||||
# if: env.BROWSERSTACK_USERNAME != ''
|
||||
# run: scripts/test-app.sh --ios --device
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
||||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install Node.js ${{ env.nodejs }}
|
||||
@ -52,9 +59,9 @@ jobs:
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Update test cert for httpbin.org
|
||||
run: npm run updatecert
|
||||
- name: Add workaround for missing DX files in build-tools 31 (https://stackoverflow.com/a/68430992)
|
||||
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
|
||||
run: npm run update:cert
|
||||
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
|
||||
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
|
||||
- name: Build test app
|
||||
run: scripts/build-test-app.sh --android --device
|
||||
- name: Upload artifact to BrowserStack
|
||||
|
10
.travis.yml
10
.travis.yml
@ -21,8 +21,8 @@ matrix:
|
||||
- npm install
|
||||
|
||||
script:
|
||||
- npm run testjs &&
|
||||
npm run updatecert &&
|
||||
- npm run test:js &&
|
||||
npm run update:cert &&
|
||||
scripts/build-test-app.sh --ios --emulator &&
|
||||
scripts/upload-saucelabs.sh --ios &&
|
||||
scripts/test-app.sh --ios --emulator;
|
||||
@ -35,7 +35,7 @@ matrix:
|
||||
components:
|
||||
- tools
|
||||
- platform-tools
|
||||
- build-tools-28.0.3
|
||||
- build-tools-30.0.1
|
||||
- android-28
|
||||
- extra-android-support
|
||||
- extra-android-m2repository
|
||||
@ -51,8 +51,8 @@ matrix:
|
||||
- npm install
|
||||
|
||||
script:
|
||||
- npm run testjs &&
|
||||
npm run updatecert &&
|
||||
- npm run test:js &&
|
||||
npm run update:cert &&
|
||||
scripts/build-test-app.sh --android --emulator &&
|
||||
scripts/upload-saucelabs.sh --android &&
|
||||
scripts/test-app.sh --android --emulator;
|
||||
|
@ -526,7 +526,7 @@ First, install current package with `npm install` to fetch dev dependencies.
|
||||
|
||||
Then, to execute Javascript tests:
|
||||
```shell
|
||||
npm run testjs
|
||||
npm run test:js
|
||||
```
|
||||
|
||||
And, to execute E2E tests:
|
||||
@ -537,8 +537,8 @@ And, to execute E2E tests:
|
||||
- run
|
||||
- updating client and server certificates, building test app, and running e2e tests
|
||||
```shell
|
||||
npm run testandroid
|
||||
npm run testios
|
||||
npm run test:android
|
||||
npm run test:ios
|
||||
```
|
||||
|
||||
## Contribute & Develop
|
||||
|
15
package-lock.json
generated
15
package-lock.json
generated
@ -20,7 +20,7 @@
|
||||
"cordova": "10.0.0",
|
||||
"mocha": "8.2.0",
|
||||
"umd-tough-cookie": "2.4.3",
|
||||
"wd": "1.12.1",
|
||||
"wd": "1.14.0",
|
||||
"xml2js": "0.4.23"
|
||||
}
|
||||
},
|
||||
@ -6376,13 +6376,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/wd": {
|
||||
"version": "1.12.1",
|
||||
"resolved": "https://registry.npmjs.org/wd/-/wd-1.12.1.tgz",
|
||||
"integrity": "sha512-O99X8OnOgkqfmsPyLIRzG9LmZ+rjmdGFBCyhGpnsSL4MB4xzHoeWmSVcumDiQ5QqPZcwGkszTgeJvjk2VjtiNw==",
|
||||
"version": "1.14.0",
|
||||
"resolved": "https://registry.npmjs.org/wd/-/wd-1.14.0.tgz",
|
||||
"integrity": "sha512-X7ZfGHHYlQ5zYpRlgP16LUsvYti+Al/6fz3T/ClVyivVCpCZQpESTDdz6zbK910O5OIvujO23Ym2DBBo3XsQlA==",
|
||||
"dev": true,
|
||||
"engines": [
|
||||
"node"
|
||||
],
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"archiver": "^3.0.0",
|
||||
"async": "^2.0.0",
|
||||
@ -11815,9 +11816,9 @@
|
||||
}
|
||||
},
|
||||
"wd": {
|
||||
"version": "1.12.1",
|
||||
"resolved": "https://registry.npmjs.org/wd/-/wd-1.12.1.tgz",
|
||||
"integrity": "sha512-O99X8OnOgkqfmsPyLIRzG9LmZ+rjmdGFBCyhGpnsSL4MB4xzHoeWmSVcumDiQ5QqPZcwGkszTgeJvjk2VjtiNw==",
|
||||
"version": "1.14.0",
|
||||
"resolved": "https://registry.npmjs.org/wd/-/wd-1.14.0.tgz",
|
||||
"integrity": "sha512-X7ZfGHHYlQ5zYpRlgP16LUsvYti+Al/6fz3T/ClVyivVCpCZQpESTDdz6zbK910O5OIvujO23Ym2DBBo3XsQlA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"archiver": "^3.0.0",
|
||||
|
20
package.json
20
package.json
@ -3,15 +3,15 @@
|
||||
"version": "3.2.2",
|
||||
"description": "Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning",
|
||||
"scripts": {
|
||||
"updatecert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
|
||||
"buildbrowser": "./scripts/build-test-app.sh --browser",
|
||||
"buildandroid": "./scripts/build-test-app.sh --android --emulator",
|
||||
"buildios": "./scripts/build-test-app.sh --ios --emulator",
|
||||
"testandroid": "npm run updatecert && npm run buildandroid && ./scripts/test-app.sh --android --emulator",
|
||||
"testios": "npm run updatecert && npm run buildios && ./scripts/test-app.sh --ios --emulator",
|
||||
"testapp": "npm run testandroid && npm run testios",
|
||||
"testjs": "mocha ./test/js-specs.js",
|
||||
"test": "npm run testjs && npm run testapp",
|
||||
"update:cert": "node ./scripts/update-e2e-server-cert.js && node ./scripts/update-e2e-client-cert.js",
|
||||
"build:browser": "./scripts/build-test-app.sh --browser",
|
||||
"build:android": "./scripts/build-test-app.sh --android --emulator",
|
||||
"build:ios": "./scripts/build-test-app.sh --ios --emulator",
|
||||
"test:android": "npm run update:cert && npm run build:android && ./scripts/test-app.sh --android --emulator",
|
||||
"test:ios": "npm run update:cert && npm run build:ios && ./scripts/test-app.sh --ios --emulator",
|
||||
"test:app": "npm run test:android && npm run test:ios",
|
||||
"test:js": "mocha ./test/js-specs.js",
|
||||
"test": "npm run test:js && npm run test:app",
|
||||
"release": "npm run test && ./scripts/release.sh"
|
||||
},
|
||||
"cordova": {
|
||||
@ -63,7 +63,7 @@
|
||||
"cordova": "10.0.0",
|
||||
"mocha": "8.2.0",
|
||||
"umd-tough-cookie": "2.4.3",
|
||||
"wd": "1.12.1",
|
||||
"wd": "1.14.0",
|
||||
"xml2js": "0.4.23"
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"cordova": "10.0.0",
|
||||
"cordova-android": "9.0.0",
|
||||
"cordova-android": "10.1.1",
|
||||
"cordova-browser": "6.0.0",
|
||||
"cordova-ios": "6.2.0",
|
||||
"cordova-plugin-device": "2.0.3",
|
||||
|
@ -52,6 +52,19 @@ const helpers = {
|
||||
xhr.open('GET', url);
|
||||
xhr.send();
|
||||
},
|
||||
readFileEntryAsText: function(fileEntry, onSuccess, onFail) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onerror = onFail;
|
||||
|
||||
reader.onloadend = function() {
|
||||
onSuccess(reader.result);
|
||||
};
|
||||
|
||||
fileEntry.file(function(file) {
|
||||
reader.readAsText(file);
|
||||
}, onFail);
|
||||
},
|
||||
writeToFile: function (done, fileName, content) {
|
||||
window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function (directoryEntry) {
|
||||
directoryEntry.getFile(fileName, { create: true, exclusive: false }, function (fileEntry) {
|
||||
@ -342,7 +355,7 @@ const tests = [
|
||||
var targetPath = cordova.file.cacheDirectory + 'test.xml';
|
||||
|
||||
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
|
||||
helpers.getWithXhr(function (content) {
|
||||
helpers.readFileEntryAsText(entry, function(content) {
|
||||
resolve({
|
||||
sourceUrl: sourceUrl,
|
||||
targetPath: targetPath,
|
||||
@ -350,7 +363,7 @@ const tests = [
|
||||
name: entry.name,
|
||||
content: content
|
||||
});
|
||||
}, targetPath);
|
||||
}, reject);
|
||||
}, reject);
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
@ -520,7 +533,7 @@ const tests = [
|
||||
cordova.plugin.http.setCookie('http://httpbin.org/get', 'mySecondCookie=mySecondValue');
|
||||
|
||||
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
|
||||
helpers.getWithXhr(function (content) {
|
||||
helpers.readFileEntryAsText(entry, function (content) {
|
||||
resolve({
|
||||
sourceUrl: sourceUrl,
|
||||
targetPath: targetPath,
|
||||
@ -528,7 +541,7 @@ const tests = [
|
||||
name: entry.name,
|
||||
content: content
|
||||
});
|
||||
}, targetPath);
|
||||
}, reject);
|
||||
}, reject);
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
@ -697,7 +710,7 @@ const tests = [
|
||||
var targetPath = cordova.file.cacheDirectory + 'test.xml';
|
||||
|
||||
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
|
||||
helpers.getWithXhr(function (content) {
|
||||
helpers.readFileEntryAsText(entry, function (content) {
|
||||
resolve({
|
||||
sourceUrl: sourceUrl,
|
||||
targetPath: targetPath,
|
||||
@ -705,7 +718,7 @@ const tests = [
|
||||
name: entry.name,
|
||||
content: content
|
||||
});
|
||||
}, targetPath);
|
||||
}, reject);
|
||||
}, reject);
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
|
@ -64,7 +64,7 @@ const configs = {
|
||||
os_version: '14',
|
||||
project: 'HTTP Test App',
|
||||
autoWebview: true,
|
||||
app: 'HttpTestAppAndroid',
|
||||
app: 'HttpTestAppIos',
|
||||
'browserstack.networkLogs': false
|
||||
},
|
||||
browserstackAndroidDevice: {
|
||||
|
Loading…
Reference in New Issue
Block a user