Fixed tests to run on iOS.

This commit is contained in:
Nedyalko Nikolov
2016-11-23 17:50:39 +02:00
parent a8903564d9
commit 50acc3bdc0
2 changed files with 8 additions and 3 deletions

View File

@ -35,7 +35,7 @@ function onNavigatedTo(args) {
page.content = label;
args.object.off(Page.navigatedToEvent, onNavigatedTo);
if (parseInt(platform.device.sdkVersion) >= 23) {
if (platform.isAndroid && parseInt(platform.device.sdkVersion) >= 23) {
let handler = (args: application.AndroidActivityRequestPermissionsEventData) => {
application.android.off(application.AndroidApplication.activityRequestPermissionsEvent, handler);
if (args.requestCode === 1234 && args.grantResults.length > 0 && args.grantResults[0] === android.content.pm.PackageManager.PERMISSION_GRANTED) {

View File

@ -176,8 +176,13 @@ function printRunTestStats() {
testFileContent.push("</testsuite>");
testFileContent.push("</testsuites>");
let testFilePath = fs.path.join(android.os.Environment.getExternalStorageDirectory().getAbsolutePath(), "Documents", "test-results.xml");
console.log("testFilePath =====>>>>>>> " + testFilePath);
let testFilePath: string;
let testResultsFileName = "test-results.xml";
if (platform.isIOS) {
testFilePath = fs.path.join(fs.knownFolders.documents().path, testResultsFileName);
} else {
testFilePath = fs.path.join(android.os.Environment.getExternalStorageDirectory().getAbsolutePath(), "Documents", testResultsFileName);
}
let testFile = fs.File.fromPath(testFilePath);
testFile.writeTextSync(testFileContent.join(""));