Skip to content

feat: resolve symlinked storages #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/appium-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class AppiumDriver {
prepareApp(args);
if (!args.device) {
if (args.isAndroid) {
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);
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);
} else {
args.device = DeviceManager.getDefaultDevice(args);
}
Expand Down Expand Up @@ -605,7 +605,6 @@ export class AppiumDriver {
console.log("Remove the 'actual' suffix to continue using the image as expected one ", pathExpectedImage);
this._args.testReporterLog(basename(pathActualImage).replace(/\.\w{3,3}$/ig, ""));
this._args.testReporterLog(join(this._logPath, basename(pathActualImage)));

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/enums/log-image-type.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export declare enum LogImageType {
/**
* Setting this property to add each image
* Set this property to add each image
* during the image comparison into the report.
* If not set, it will be logged only the last image comparison.
*/
everyImage = "everyImage",
/**
* Setting this property to take screenshot on each hook
* Set this property to take screenshot on each hook
* and add the images into the report.
*/
screenshots = "screenshots"
Expand Down
11 changes: 10 additions & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
mkdirSync,
readdirSync,
writeFileSync,
readFileSync
readFileSync,
readlinkSync,
lstatSync,
realpathSync
} from "fs";
import {
extname,
Expand Down Expand Up @@ -440,6 +443,12 @@ export async function scroll(wd, driver, direction: Direction, isIOS: boolean, y

function createStorageFolder(storage, directory) {
storage = resolvePath(storage, directory);
try {
storage = readlinkSync(storage);
} catch (error) { }
try {
storage = realpathSync(storage);
} catch (error) { }
if (!existsSync(storage)) {
mkdirSync(storage);
}
Expand Down