js_tgdevice
v0.1.4
Published
Helpers for launching Android and iOS Appium sessions on TestGrid
Maintainers
Readme
js_tgdevice
Helpers for launching Android and iOS Appium sessions on TestGrid using the Appium driver APIs.
Install
npm install js_tgdeviceUsage
Android
const { createAndroidDriver } = require('js_tgdevice');
(async () => {
const driver = await createAndroidDriver({
remoteUrl: 'https://poc8.testgrid.io/appium_38007/wd/hub',
capabilities: {
deviceName: 'Galaxy S22',
platformVersion: '14',
udid: 'R5CT712ZP7E',
'tg:userToken': 'ochskrxwei4ujverxb8w5jfxj1bgnlsw',
systemPort: '4007'
}
});
try {
await driver.get('https://testgrid.io/');
const title = await driver.getTitle();
console.log('Android page title:', title);
} finally {
await driver.quit();
}
})();iOS
const { createIosDriver } = require('js_tgdevice');
(async () => {
const driver = await createIosDriver({
remoteUrl: 'https://poc8.testgrid.io/appium_36005/wd/hub',
capabilities: {
deviceName: 'iPhone 14',
platformVersion: '17.5.1',
udid: '00008110-0008656E3AA3A01E',
'tg:userToken': 'ochskrxwei4ujverxb8w5jfxj1bgnlsw',
wdaLocalPort: '3005'
}
});
try {
await driver.get('https://playwright.dev/');
const title = await driver.getTitle();
console.log('iOS page title:', title);
} finally {
await driver.quit();
}
})();Environment Variables
TG_ANDROID_REMOTE_URL,TG_IOS_REMOTE_URL: defaults whenremoteUrlis omitted.TG_ANDROID_CAPABILITIES,TG_IOS_CAPABILITIES: JSON payloads merged into platform capabilities.TG_DEVICE_REMOTE_URL: shared fallback for both platforms.APPIUM_REMOTE_URL,APPIUM_REMOTE_CAPABILITIES: shared fallbacks used when platform-specific vars are not present (the helper still readsSELENIUM_REMOTE_URL/SELENIUM_REMOTE_CAPABILITIESfor backward compatibility).
Capability Templates
# Android
export APPIUM_REMOTE_URL="https://poc8.testgrid.io/appium_38007/wd/hub"
export APPIUM_REMOTE_CAPABILITIES='{"deviceName":"Galaxy S22","platformVersion":"14","platformName":"android","automationName":"UiAutomator2","udid":"R5CT712ZP7E","tg:userToken":"ochskrxwei4ujverxb8w5jfxj1bgnlsw","systemPort":"4007","uiautomator2ServerLaunchTimeout":"90000"}'
# iOS
export APPIUM_REMOTE_URL="https://poc8.testgrid.io/appium_36005/wd/hub"
export APPIUM_REMOTE_CAPABILITIES='{"deviceName":"iPhone 14","platformVersion":"17.5.1","automationName":"XCUITest","platformName":"iOS","udid":"00008110-0008656E3AA3A01E","tg:userToken":"ochskrxwei4ujverxb8w5jfxj1bgnlsw","wdaLocalPort":"3005"}'Adjust the device identifiers, ports, and tokens for your environment.
