Skip to content

Commit

Permalink
generate DetoxViewActions properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Schmidt committed Nov 24, 2018
1 parent 1395964 commit 2cce220
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 48 deletions.
39 changes: 39 additions & 0 deletions detox/src/android/espressoapi/DetoxViewActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
This code is generated.
For more information see generation/README.md.
*/



class DetoxViewActions {
static getConstraints(element) {
return {
target: element,
method: "getConstraints",
args: []
};
}

static getDescription(element) {
return {
target: element,
method: "getDescription",
args: []
};
}

static click() {
return {
target: {
type: "Class",
value: "com.wix.detox.espresso.DetoxViewActions"
},
method: "click",
args: []
};
}

}

module.exports = DetoxViewActions;
3 changes: 2 additions & 1 deletion detox/src/android/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const invoke = require('../invoke');
const matchers = require('./matcher');
const DetoxActionApi = require('./espressoapi/DetoxAction');
const ViewActionsApi = require('./espressoapi/ViewActions');
const DetoxViewActionsApi = require('./espressoapi/DetoxViewActions');
const DetoxAssertionApi = require('./espressoapi/DetoxAssertion');
const EspressoDetoxApi = require('./espressoapi/EspressoDetox');
const DetoxMatcherApi = require('./espressoapi/DetoxMatcher');
Expand Down Expand Up @@ -34,7 +35,7 @@ class Action {}
class TapAction extends Action {
constructor() {
super();
this._call = invoke.callDirectly(ViewActionsApi.click());
this._call = invoke.callDirectly(DetoxViewActionsApi.click());
}
}

Expand Down
83 changes: 36 additions & 47 deletions generation/index.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,57 @@
#!/usr/bin/env node
const generateIOSAdapters = require("./adapters/ios");
const generateAndroidAdapters = require("./adapters/android");
const downloadEspressoFileByClass = require("./utils/downloadEspresso");
const downloadFile = require("./utils/downloadFile");
const generateIOSAdapters = require('./adapters/ios');
const generateAndroidAdapters = require('./adapters/android');
const downloadEspressoFileByClass = require('./utils/downloadEspresso');
const downloadFile = require('./utils/downloadFile');

const iosFiles = {
"../detox/ios/EarlGrey/EarlGrey/Action/GREYActions.h":
"../detox/src/ios/earlgreyapi/GREYActions.js",
"../detox/ios/Detox/GREYMatchers+Detox.h":
"../detox/src/ios/earlgreyapi/GREYMatchers+Detox.js",
"../detox/ios/EarlGrey/EarlGrey/Matcher/GREYMatchers.h":
"../detox/src/ios/earlgreyapi/GREYMatchers.js",
"../detox/ios/EarlGrey/EarlGrey/Core/GREYInteraction.h":
"../detox/src/ios/earlgreyapi/GREYInteraction.js",
"../detox/ios/Detox/GREYCondition+Detox.h":
"../detox/src/ios/earlgreyapi/GREYConditionDetox.js",
"../detox/ios/EarlGrey/EarlGrey/Synchronization/GREYCondition.h":
"../detox/src/ios/earlgreyapi/GREYCondition.js",
"../detox/ios/Detox/GREYConfiguration+Detox.h":
"../detox/src/ios/earlgreyapi/GREYConfigurationDetox.js",
"../detox/ios/EarlGrey/EarlGrey/Common/GREYConfiguration.h":
"../detox/src/ios/earlgreyapi/GREYConfiguration.js",
"../detox/ios/EarlGrey/EarlGrey/Core/EarlGreyImpl.h":
"../detox/src/ios/earlgreyapi/EarlGreyImpl.js"
'../detox/ios/EarlGrey/EarlGrey/Action/GREYActions.h': '../detox/src/ios/earlgreyapi/GREYActions.js',
'../detox/ios/Detox/GREYMatchers+Detox.h': '../detox/src/ios/earlgreyapi/GREYMatchers+Detox.js',
'../detox/ios/EarlGrey/EarlGrey/Matcher/GREYMatchers.h': '../detox/src/ios/earlgreyapi/GREYMatchers.js',
'../detox/ios/EarlGrey/EarlGrey/Core/GREYInteraction.h': '../detox/src/ios/earlgreyapi/GREYInteraction.js',
'../detox/ios/Detox/GREYCondition+Detox.h': '../detox/src/ios/earlgreyapi/GREYConditionDetox.js',
'../detox/ios/EarlGrey/EarlGrey/Synchronization/GREYCondition.h': '../detox/src/ios/earlgreyapi/GREYCondition.js',
'../detox/ios/Detox/GREYConfiguration+Detox.h': '../detox/src/ios/earlgreyapi/GREYConfigurationDetox.js',
'../detox/ios/EarlGrey/EarlGrey/Common/GREYConfiguration.h': '../detox/src/ios/earlgreyapi/GREYConfiguration.js',
'../detox/ios/EarlGrey/EarlGrey/Core/EarlGreyImpl.h': '../detox/src/ios/earlgreyapi/EarlGreyImpl.js'
};

generateIOSAdapters(iosFiles);
//TODO - network failing on CI, check ASAP
// const espressoFilesToDownload = {
// "android.support.test.espresso.action.ViewActions":
// "../detox/src/android/espressoapi/ViewActions.js"
// 'android.support.test.espresso.action.ViewActions': '../detox/src/android/espressoapi/ViewActions.js'
// };
//
// const downloadedEspressoFilesMap = Object.entries(
// espressoFilesToDownload
// ).reduce(
// (obj, [fullyQualifiedClass, dest]) => ({
// ...obj,
// [downloadEspressoFileByClass(fullyQualifiedClass)]: dest
// }),
// {}

// const downloadedEspressoFilesMap = Object.entries(espressoFilesToDownload).reduce(
// (obj, [fullyQualifiedClass, dest]) => ({
// ...obj,
// [downloadEspressoFileByClass(fullyQualifiedClass)]: dest
// }),
// {}
// );
//

// const externalFilesToDownload = {
// 'https://android.googlesource.com/platform/frameworks/uiautomator/+/master/src/com/android/uiautomator/core/UiDevice.java?format=TEXT': '../detox/src/android/espressoapi/UIDevice.js'
// }
//
// const downloadedAndroidFilesMap = Object.entries(
// externalFilesToDownload
// ).reduce(
// (obj, [url, dest]) => ({
// ...obj,
// [downloadFile(url)]: dest
// }),
// {}
// 'https://android.googlesource.com/platform/frameworks/uiautomator/+/master/src/com/android/uiautomator/core/UiDevice.java?format=TEXT':
// '../detox/src/android/espressoapi/UIDevice.js'
// };

// const downloadedAndroidFilesMap = Object.entries(externalFilesToDownload).reduce(
// (obj, [url, dest]) => ({
// ...obj,
// [downloadFile(url)]: dest
// }),
// {}
// );
//

// const androidFiles = {
// ...downloadedAndroidFilesMap,
// ...downloadedEspressoFilesMap,
// '../detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxAction.java': '../detox/src/android/espressoapi/DetoxAction.js',
// '../detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxViewActions.java':
// '../detox/src/android/espressoapi/DetoxViewActions.js',
// '../detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxMatcher.java': '../detox/src/android/espressoapi/DetoxMatcher.js',
// '../detox/android/detox/src/main/java/com/wix/detox/Detox.java': '../detox/src/android/espressoapi/Detox.js',
// '../detox/android/detox/src/main/java/com/wix/detox/espresso/EspressoDetox.java': '../detox/src/android/espressoapi/EspressoDetox.js',
// '../detox/android/detox/src/main/java/com/wix/detox/uiautomator/UiAutomator.java': '../detox/src/android/espressoapi/UIAutomator.js',
// '../detox/android/detox/src/main/java/com/wix/detox/uiautomator/UiAutomator.java': '../detox/src/android/espressoapi/UIAutomator.js'
// };
// generateAndroidAdapters(androidFiles);

0 comments on commit 2cce220

Please sign in to comment.