Skip to content

Commit ef270c9

Browse files
feat: resolve symlinked storages (#235)
1 parent 65c6aa3 commit ef270c9

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Diff for: lib/appium-driver.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export class AppiumDriver {
239239
prepareApp(args);
240240
if (!args.device) {
241241
if (args.isAndroid) {
242-
args.device = DeviceManager.getDefaultDevice(args, sessionInfo.capabilities.avd, sessionInfo.capabilities.deviceUDID.replace("emulator-", ""), sessionInfo.capabilities.deviceUDID.includes("emulator") ? DeviceType.EMULATOR : DeviceType.SIMULATOR, sessionInfo.capabilities.desired.platformVersion || sessionInfo.capabilities.platformVersion);
242+
args.device = DeviceManager.getDefaultDevice(args, sessionInfo.capabilities.deviceName, sessionInfo.capabilities.deviceUDID.replace("emulator-", ""), sessionInfo.capabilities.deviceUDID.includes("emulator") ? DeviceType.EMULATOR : DeviceType.SIMULATOR, sessionInfo.capabilities.desired.platformVersion || sessionInfo.capabilities.platformVersion);
243243
} else {
244244
args.device = DeviceManager.getDefaultDevice(args);
245245
}
@@ -605,7 +605,6 @@ export class AppiumDriver {
605605
console.log("Remove the 'actual' suffix to continue using the image as expected one ", pathExpectedImage);
606606
this._args.testReporterLog(basename(pathActualImage).replace(/\.\w{3,3}$/ig, ""));
607607
this._args.testReporterLog(join(this._logPath, basename(pathActualImage)));
608-
609608
return false;
610609
}
611610

Diff for: lib/enums/log-image-type.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export declare enum LogImageType {
22
/**
3-
* Setting this property to add each image
3+
* Set this property to add each image
44
* during the image comparison into the report.
55
* If not set, it will be logged only the last image comparison.
66
*/
77
everyImage = "everyImage",
88
/**
9-
* Setting this property to take screenshot on each hook
9+
* Set this property to take screenshot on each hook
1010
* and add the images into the report.
1111
*/
1212
screenshots = "screenshots"

Diff for: lib/utils.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
mkdirSync,
1414
readdirSync,
1515
writeFileSync,
16-
readFileSync
16+
readFileSync,
17+
readlinkSync,
18+
lstatSync,
19+
realpathSync
1720
} from "fs";
1821
import {
1922
extname,
@@ -440,6 +443,12 @@ export async function scroll(wd, driver, direction: Direction, isIOS: boolean, y
440443

441444
function createStorageFolder(storage, directory) {
442445
storage = resolvePath(storage, directory);
446+
try {
447+
storage = readlinkSync(storage);
448+
} catch (error) { }
449+
try {
450+
storage = realpathSync(storage);
451+
} catch (error) { }
443452
if (!existsSync(storage)) {
444453
mkdirSync(storage);
445454
}

0 commit comments

Comments
 (0)