Skip to content

Commit 50acc3b

Browse files
Nedyalko NikolovNedyalko Nikolov
authored andcommitted
Fixed tests to run on iOS.
1 parent a890356 commit 50acc3b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tests/app/app/mainPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function onNavigatedTo(args) {
3535
page.content = label;
3636
args.object.off(Page.navigatedToEvent, onNavigatedTo);
3737

38-
if (parseInt(platform.device.sdkVersion) >= 23) {
38+
if (platform.isAndroid && parseInt(platform.device.sdkVersion) >= 23) {
3939
let handler = (args: application.AndroidActivityRequestPermissionsEventData) => {
4040
application.android.off(application.AndroidApplication.activityRequestPermissionsEvent, handler);
4141
if (args.requestCode === 1234 && args.grantResults.length > 0 && args.grantResults[0] === android.content.pm.PackageManager.PERMISSION_GRANTED) {

tests/app/testRunner.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,13 @@ function printRunTestStats() {
176176
testFileContent.push("</testsuite>");
177177
testFileContent.push("</testsuites>");
178178

179-
let testFilePath = fs.path.join(android.os.Environment.getExternalStorageDirectory().getAbsolutePath(), "Documents", "test-results.xml");
180-
console.log("testFilePath =====>>>>>>> " + testFilePath);
179+
let testFilePath: string;
180+
let testResultsFileName = "test-results.xml";
181+
if (platform.isIOS) {
182+
testFilePath = fs.path.join(fs.knownFolders.documents().path, testResultsFileName);
183+
} else {
184+
testFilePath = fs.path.join(android.os.Environment.getExternalStorageDirectory().getAbsolutePath(), "Documents", testResultsFileName);
185+
}
181186

182187
let testFile = fs.File.fromPath(testFilePath);
183188
testFile.writeTextSync(testFileContent.join(""));

0 commit comments

Comments
 (0)