forked from github/cordova-android
Compare commits
6 Commits
master
...
ci/connect
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c9e7fc96a | ||
![]() |
5e52b7ee77 | ||
![]() |
f3e98c8651 | ||
![]() |
bbc9bcae14 | ||
![]() |
cd49902ca3 | ||
![]() |
f4a0e1ec78 |
@ -12,13 +12,13 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "cordova-js build > templates/project/assets/www/cordova.js",
|
"prepare": "cordova-js build > templates/project/assets/www/cordova.js",
|
||||||
"test": "npm run lint && npm run cover && npm run java-unit-tests",
|
"test": "npm run lint && npm run cover && npm run java-tests",
|
||||||
"lint": "eslint lib spec test \"templates/cordova/**/!(*.*)\"",
|
"lint": "eslint lib spec test \"templates/cordova/**/!(*.*)\"",
|
||||||
"unit-tests": "jasmine --config=spec/unit/jasmine.json",
|
"unit-tests": "jasmine --config=spec/unit/jasmine.json",
|
||||||
"cover": "nyc jasmine --config=spec/coverage.json",
|
"cover": "nyc jasmine --config=spec/coverage.json",
|
||||||
"e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
|
"e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
|
||||||
"java-unit-tests": "node test/run_java_unit_tests.js",
|
"java-tests": "node test/java_test_runner.js",
|
||||||
"clean:java-unit-tests": "node test/clean.js"
|
"clean:java-tests": "node test/clean.js"
|
||||||
},
|
},
|
||||||
"author": "Apache Software Foundation",
|
"author": "Apache Software Foundation",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
@ -56,6 +56,8 @@ dependencies {
|
|||||||
androidTestImplementation('androidx.test.espresso:espresso-web:3.1.1', {
|
androidTestImplementation('androidx.test.espresso:espresso-web:3.1.1', {
|
||||||
exclude group: 'androidx.test.espresso', module: 'androidx.annotation'
|
exclude group: 'androidx.test.espresso', module: 'androidx.annotation'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
androidTestImplementation 'androidx.test:rules:1.4.0'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
@ -158,7 +158,7 @@ public class BackButtonMultipageTest {
|
|||||||
assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
|
assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertPageSample(String url) {
|
private void assertPageSample(String url) throws Throwable {
|
||||||
assertEquals(url, mActivity.onPageFinishedUrl.take());
|
assertEquals(url, mActivity.onPageFinishedUrl.take());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ const fs = require('fs-extra');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This script is to be run manually (e.g. by npm run clean:java-unit-tests) if
|
* This script is to be run manually (e.g. by npm run clean:java-tests) if
|
||||||
* you want to upgrade gradlew or test its proper generation.
|
* you want to upgrade gradlew or test its proper generation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -46,9 +46,13 @@ class AndroidTestRunner {
|
|||||||
return new ProjectBuilder(this.projectDir).runGradleWrapper('gradle');
|
return new ProjectBuilder(this.projectDir).runGradleWrapper('gradle');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_log (...args) {
|
||||||
|
console.log(...[`[${this.testTitle}]`, ...args]);
|
||||||
|
}
|
||||||
|
|
||||||
run () {
|
run () {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(_ => console.log(`[${this.testTitle}] Preparing Gradle wrapper for Java unit tests.`))
|
.then(_ => this._log('Staging Project Files'))
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
// TODO we should probably not only copy these files, but instead create a new project from scratch
|
// TODO we should probably not only copy these files, but instead create a new project from scratch
|
||||||
fs.copyFileSync(path.resolve(this.projectDir, '../../framework/cdv-gradle-config-defaults.json'), path.resolve(this.projectDir, 'cdv-gradle-config.json'));
|
fs.copyFileSync(path.resolve(this.projectDir, '../../framework/cdv-gradle-config-defaults.json'), path.resolve(this.projectDir, 'cdv-gradle-config.json'));
|
||||||
@ -57,26 +61,35 @@ class AndroidTestRunner {
|
|||||||
path.join(this.projectDir, 'app/src/main/assets/www/cordova.js')
|
path.join(this.projectDir, 'app/src/main/assets/www/cordova.js')
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.then(_ => this._log('Creating Gradle Wrapper'))
|
||||||
.then(_ => this._createProjectBuilder())
|
.then(_ => this._createProjectBuilder())
|
||||||
|
|
||||||
|
.then(_ => this._log('Getting Gradle Wrapper Version Info'))
|
||||||
.then(_ => this._gradlew('--version'))
|
.then(_ => this._gradlew('--version'))
|
||||||
.then(_ => console.log(`[${this.testTitle}] Gradle wrapper is ready. Running tests now.`))
|
|
||||||
|
.then(_ => this._log('Running Java Unit Tests'))
|
||||||
.then(_ => this._gradlew('test'))
|
.then(_ => this._gradlew('test'))
|
||||||
.then(_ => console.log(`[${this.testTitle}] Java unit tests completed successfully`));
|
.then(_ => this._log('Finished Java Unit Test'))
|
||||||
|
|
||||||
|
.then(_ => this._log('Running Java Instrumentation Tests'))
|
||||||
|
.then(_ => this._gradlew('connectedAndroidTest'))
|
||||||
|
.then(_ => this._log('Finished Java Instrumentation Tests'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(_ => console.log('Starting to run all android platform tests'))
|
.then(_ => console.log('Starting Android Platform Java Tests'))
|
||||||
|
|
||||||
// AndroidX Test
|
// AndroidX Test
|
||||||
.then(_ => new AndroidTestRunner('AndroidX Project', path.resolve(__dirname, 'androidx')))
|
.then(_ => new AndroidTestRunner('AndroidX Project', path.resolve(__dirname, 'androidx')))
|
||||||
.then(test => test.run())
|
.then(test => test.run())
|
||||||
|
|
||||||
.then(_ => console.log('Finished running all android platform tests'));
|
.then(_ => console.log('Finished Running Android Platform Java Tests'));
|
||||||
|
|
||||||
process.on('unhandledRejection', err => {
|
process.on('unhandledRejection', err => {
|
||||||
// If err has a stderr property, we have seen the message already
|
// If err has a stderr property, we have seen the message already
|
||||||
if (!('stderr' in err)) console.error(err.message);
|
if (!('stderr' in err)) console.error(err.message);
|
||||||
console.error('JAVA UNIT TESTS FAILED!');
|
console.error('JAVA TESTS FAILED!');
|
||||||
process.exitCode = err.code || 1;
|
process.exitCode = err.code || 1;
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user