Skip to content

Commit a71c97d

Browse files
Fix host pcloudy (#595)
* pick user provided cloud url * update readMe and bump version
1 parent dda0eec commit a71c97d

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "appium-device-farm",
3-
"version": "3.10.0",
3+
"version": "3.11.0",
44
"description": "An appium 2.0 plugin that manages and create driver session on available devices",
55
"main": "./lib/index.js",
66
"scripts": {
@@ -67,6 +67,7 @@
6767
"node-persist": "^3.1.0",
6868
"node-schedule": "^2.0.0",
6969
"node-simctl": "^7.0.0",
70+
"normalize-url": "6.1.0",
7071
"ora": "5.4.1",
7172
"ramda": "^0.28.0",
7273
"reflect-metadata": "^0.1.13",

src/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { IDevice } from './interfaces/IDevice';
77
import _ from 'lodash';
88
import log from './logger';
99
import Cloud from './enums/Cloud';
10+
import normalizeUrl from 'normalize-url';
1011

1112
const APPIUM_VENDOR_PREFIX = 'appium:';
1213
export async function asyncForEach(
@@ -35,12 +36,13 @@ export async function getFreePort() {
3536
}
3637

3738
export function hubUrl(device: IDevice) {
39+
const host = normalizeUrl(device.host, {removeTrailingSlash: false});
3840
if (device.hasOwnProperty('cloud') && device.cloud === 'browserstack') {
3941
return `https://${process.env.BS_USERNAME}:${process.env.BS_PASSWORD}@hub.browserstack.com/wd/hub/session`;
4042
} else if (device.hasOwnProperty('cloud') && device.cloud.toLowerCase() === Cloud.PCLOUDY) {
41-
return 'https://device.pcloudy.com/appiumcloud/wd/hub/session';
43+
return `${host}/session`;
4244
}
43-
return `${device.host}/wd/hub/session`;
45+
return `${host}/wd/hub/session`;
4446
}
4547
export async function isPortBusy(port: number) {
4648
try {

src/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class DevicePlugin extends BasePlugin {
163163
let session;
164164
if (!device.host.includes('127.0.0.1')) {
165165
const remoteUrl = hubUrl(device);
166+
logger.info(`Remote Host URL - ${remoteUrl}`)
166167
let sessionDetails: any;
167168
logger.info('Creating cloud session');
168169
var config = {

0 commit comments

Comments
 (0)