Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
feat: Add rest of device interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham committed Mar 6, 2019
1 parent 2417beb commit 7245fb6
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 33 deletions.
37 changes: 25 additions & 12 deletions app/renderer/components/Inspector/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ export const actionDefinitions = {
'Execute Mobile': {
'Execute': {methodName: 'execute', args: [['command', STRING], ['jsonArgument', STRING]]}
},
'Android Activity': {
'Start Activity': {methodName: 'startActivity', args: [
['appPackage', STRING], ['appActivity', STRING], ['appWaitPackage', STRING],
['intentAction', STRING], ['intentCategory', STRING], ['intentFlags', STRING],
['optionalIntentArguments', STRING], ['dontStopAppOnReset', STRING],
], refresh: true},
'Current Activity': {methodName: 'getCurrentActivity'},
'Current Package': {methodName: 'getCurrentPackage'},
},
'App': {
'Install App': {methodName: 'installAppOnDevice', args: [['appPathOrUrl', STRING]]},
'Is App Installed': {methodName: 'isAppInstalledOnDevice', args: [['appId', STRING]]},
Expand All @@ -75,15 +84,6 @@ export const actionDefinitions = {
'Remove App': {methodName: 'removeAppFromDevice', args: [['bundleId', STRING]]},
'Get App Strings': {methodName: 'getAppStrings', args: [['language', STRING], ['stringFile', STRING]], refresh: true},
},
'Android Activity': {
'Start Activity': {methodName: 'startActivity', args: [
['appPackage', STRING], ['appActivity', STRING], ['appWaitPackage', STRING],
['intentAction', STRING], ['intentCategory', STRING], ['intentFlags', STRING],
['optionalIntentArguments', STRING], ['dontStopAppOnReset', STRING],
], refresh: true},
'Current Activity': {methodName: 'getCurrentActivity'},
'Current Package': {methodName: 'getCurrentPackage'},
},
'Clipboard': {
'Get Clipboard': {methodName: 'getClipboard'},
'Set Clipboard': {methodName: 'setClipboard', args: [['clipboardText', STRING]]},
Expand All @@ -95,12 +95,12 @@ export const actionDefinitions = {
},
'Interaction': {
'Shake': {methodName: 'shake'},
'Lock': {methodName: 'lock', args: [['seconds', NUMBER]]},
'Unlock': {methodName: 'unlock'},
'Lock': {methodName: 'lock', args: [['seconds', NUMBER]], refresh: true},
'Unlock': {methodName: 'unlock', refresh: true},
'Is Device Locked': {methodName: 'isLocked'},
'Rotate Device': {methodName: 'rotateDevice', args: [
['x', NUMBER], ['y', NUMBER], ['radius', NUMBER], ['rotatation', NUMBER], ['touchCount', NUMBER], ['duration', NUMBER]
]},
], refresh: true},
},
'Keys': {
'Press Key': {methodName: 'pressKeycode', args: [['keyCode', NUMBER], ['metaState', NUMBER], ['flags', NUMBER]], refresh: true},
Expand All @@ -118,6 +118,19 @@ export const actionDefinitions = {
'GSM Signal': {methodName: 'gsmSignal', args: [['signalStrengh', NUMBER]]},
'GSM Voice': {methodName: 'gsmVoice', args: [['state', STRING]]},
},
'Performance Data': {
'Get Data': {methodName: 'getPerformanceData', args: [['packageName', STRING], ['dataType', STRING], ['dataReadTimeout', NUMBER]]},
'Get Data Types': {methodName: 'getSupportedPerformanceDataTypes'},
},
'iOS Simulator': {
'Perform Touch Id': {methodName: 'performTouchId', args: [['match', STRING]], refresh: true},
'Toggle Touch Id Enrollment': {methodName: 'toggleTouchIdEnrollment', args: [['enroll', STRING]]},
},
'System': {
'Open Notifications': {methodName: 'openNotifications', refresh: true},
'Get System Time': {methodName: 'getDeviceTime'},
'Fingerprint (Android)': {methodName: 'fingerprint', args: [['fingerPrintId', NUMBER]], refresh: true}
},
}
};

Expand Down
30 changes: 29 additions & 1 deletion app/renderer/lib/client-frameworks/java.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,37 @@ ${this.indent(code, 4)}
return `driver.rotate(new DeviceRotation(${x}, ${y}, ${radius}, ${rotation}, ${touchCount}, ${duration}));`;
}

codeFor_getPerformanceData (varNameIgnore, varIndexIgnore, packageName, dataType, dataReadTimeout) {
return `List<List<Object>> performanceData = driver.getPerformanceData("${packageName}", "${dataType}", ${dataReadTimeout});`;
}

codeFor_getSupportedPerformanceDataTypes () {
return `List<String> performanceTypes = driver.getSupportedPerformanceDataTypes();`;
}

codeFor_performTouchId (varNameIgnore, varIndexIgnore, match) {
return `driver.performTouchID(${match});`;
}

codeFor_toggleTouchIdEnrollment (varNameIgnore, varIndexIgnore, enroll) {
return `driver.toggleTouchIDEnrollment(${enroll});`;
}

codeFor_openNotifications () {
return `driver.openNotifications();`;
}

codeFor_getDeviceTime () {
return `String time = driver.getDeviceTime();`;
}

codeFor_fingerprint (varNameIgnore, varIndexIgnore, fingerprintId) {
return `driver.fingerPrint(${fingerprintId});`;
}

/*
codeFor_ REPLACE_ME (varNameIgnore, varIndexIgnore) {
codeFor_REPLACE_ME (varNameIgnore, varIndexIgnore) {
return `REPLACE_ME`;
}
Expand Down
28 changes: 28 additions & 0 deletions app/renderer/lib/client-frameworks/js-wd.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,34 @@ main().catch(console.log);
return `driver.rotateDevice({x: ${x}, y: ${y}, duration: ${duration}, radius: ${radius}, rotation: ${rotation}, touchCount: ${touchCount}});`;
}

codeFor_getPerformanceData (varNameIgnore, varIndexIgnore, packageName, dataType, dataReadTimeout) {
return `let performanceData = await driver.getPerformanceData('${packageName}', '${dataType}', ${dataReadTimeout});`;
}

codeFor_getSupportedPerformanceDataTypes () {
return `let supportedPerformanceDataTypes = await driver.getSupportedPerformanceDataTypes();`;
}

codeFor_performTouchId (varNameIgnore, varIndexIgnore, match) {
return `await driver.touchId(${match});`;
}

codeFor_toggleTouchIdEnrollment (varNameIgnore, varIndexIgnore, enroll) {
return `await driver.toggleTouchIdEnrollment(${enroll});`;
}

codeFor_openNotifications () {
return `await driver.openNotifications();`;
}

codeFor_getDeviceTime () {
return `let time = await driver.getDeviceTime();`;
}

codeFor_fingerprint (varNameIgnore, varIndexIgnore, fingerprintId) {
return `await driver.fingerprint(${fingerprintId});`;
}

}

JsWdFramework.readableName = 'JS - WD (Promise)';
Expand Down
28 changes: 28 additions & 0 deletions app/renderer/lib/client-frameworks/js-wdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,34 @@ ${this.indent(this.chainifyCode(code), 2)}
codeFor_rotateDevice (varNameIgnore, varIndexIgnore, x, y, radius, rotation, touchCount, duration) {
return `driver.rotate(${x}, ${y}, ${radius}, ${rotation}, ${touchCount}, ${duration});`;
}

codeFor_getPerformanceData () {
return `// Not supported: getPerformanceData`;
}

codeFor_getSupportedPerformanceDataTypes () {
return `// Not supported: getSupportedPerformanceDataTypes`;
}

codeFor_performTouchId (varNameIgnore, varIndexIgnore, match) {
return `await driver.touchId(${match});`;
}

codeFor_toggleTouchIdEnrollment (varNameIgnore, varIndexIgnore, enroll) {
return `await driver.toggleTouchIdEnrollment(${enroll});`;
}

codeFor_openNotifications () {
return `await driver.openNotifications();`;
}

codeFor_getDeviceTime () {
return `let time = await driver.getDeviceTime();`;
}

codeFor_fingerprint (varNameIgnore, varIndexIgnore, fingerprintId) {
return `await driver.fingerprint(${fingerprintId});`;
}
}

JsWdIoFramework.readableName = 'JS - Webdriver.io';
Expand Down
28 changes: 28 additions & 0 deletions app/renderer/lib/client-frameworks/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,34 @@ driver.quit()`;
codeFor_rotateDevice () {
return `# Not supported: rotate device`;
}

codeFor_getPerformanceData () {
return `# Not supported: getPerformanceData`;
}

codeFor_getSupportedPerformanceDataTypes () {
return `# Not supported: getSupportedPerformanceDataTypes`;
}

codeFor_performTouchId (varNameIgnore, varIndexIgnore, match) {
return `driver.touch_id(${match})`;
}

codeFor_toggleTouchIdEnrollment (varNameIgnore, varIndexIgnore, enroll) {
return `driver.toggle_touch_id_enrollment(${enroll})`;
}

codeFor_openNotifications () {
return `driver.open_notifications();`;
}

codeFor_getDeviceTime () {
return `time = self.driver.device_time()`;
}

codeFor_fingerprint (varNameIgnore, varIndexIgnore, fingerprintId) {
return `driver.finger_print(${fingerprintId})`;
}
}

PythonFramework.readableName = 'Python';
Expand Down
70 changes: 50 additions & 20 deletions app/renderer/lib/client-frameworks/robot.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,83 +147,113 @@ ${this.indent(code, 4)}
}

codeFor_pressKeycode () {
return `REPLACE_ME`;
return ``;
}

codeFor_longPressKeycode () {
return `REPLACE_ME`;
return ``;
}

codeFor_hideDeviceKeyboard () {
return `REPLACE_ME`;
return ``;
}

codeFor_isKeyboardShown () {
return `REPLACE_ME`;
return ``;
}

codeFor_pushFileToDevice () {
return `REPLACE_ME`;
return ``;
}

codeFor_pullFile () {
return `REPLACE_ME`;
return ``;
}

codeFor_pullFolder () {
return `REPLACE_ME`;
return ``;
}

codeFor_toggleAirplaneMode () {
return `REPLACE_ME`;
return ``;
}

codeFor_toggleData () {
return `REPLACE_ME`;
return ``;
}

codeFor_toggleWiFi () {
return `REPLACE_ME`;
return ``;
}

codeFor_toggleLocationServices () {
return `REPLACE_ME`;
return ``;
}

codeFor_sendSMS () {
return `REPLACE_ME`;
return ``;
}

codeFor_gsmCall () {
return `REPLACE_ME`;
return ``;
}

codeFor_gsmSignal () {
return `REPLACE_ME`;
return ``;
}

codeFor_gsmVoice () {
return `REPLACE_ME`;
return ``;
}

codeFor_shake () {
return `REPLACE_ME`;
return ``;
}

codeFor_lock () {
return `REPLACE_ME`;
return ``;
}

codeFor_unlock () {
return `REPLACE_ME`;
return ``;
}

codeFor_isLocked () {
return `REPLACE_ME`;
return ``;
}

codeFor_rotateDevice () {
return `REPLACE_ME`;
return ``;
}



codeFor_getPerformanceData () {
return ``;
}

codeFor_getSupportedPerformanceDataTypes () {
return ``;
}

codeFor_performTouchId () {
return ``;
}

codeFor_toggleTouchIdEnrollment () {
return ``;
}

codeFor_openNotifications () {
return ``;
}

codeFor_getDeviceTime () {
return ``;
}

codeFor_fingerprint () {
return ``;
}
}

Expand Down
28 changes: 28 additions & 0 deletions app/renderer/lib/client-frameworks/ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,34 @@ driver.quit`;
codeFor_rotateDevice () {
return `# Not supported: rotateDevice`;
}

codeFor_getPerformanceData (varNameIgnore, varIndexIgnore, packageName, dataType, dataReadTimeout) {
return `performance_data = driver.get_performance_data package_name: '${packageName}', data_type: '${dataType}', data_read_timeout: ${dataReadTimeout}`;
}

codeFor_getSupportedPerformanceDataTypes () {
return `performance_data = driver.get_performance_data_types`;
}

codeFor_performTouchId (varNameIgnore, varIndexIgnore, match) {
return `driver.touch_id ${match}`;
}

codeFor_toggleTouchIdEnrollment (varNameIgnore, varIndexIgnore, enroll) {
return `driver.toggle_touch_id_enrollment ${enroll}`;
}

codeFor_openNotifications () {
return `driver.open_notifications`;
}

codeFor_getDeviceTime () {
return `device_time = driver.device_time`;
}

codeFor_fingerprint (varNameIgnore, varIndexIgnore, fingerprintId) {
return `driver.finger_print ${fingerprintId}`;
}
}

RubyFramework.readableName = 'Ruby';
Expand Down

0 comments on commit 7245fb6

Please sign in to comment.