@reactiive/ennio 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/EnnioCore.podspec +61 -0
  2. package/LICENSE +21 -0
  3. package/README.md +50 -0
  4. package/android/CMakeLists.txt +40 -0
  5. package/android/build.gradle +64 -0
  6. package/cpp/ElementMatcher.cpp +661 -0
  7. package/cpp/ElementMatcher.hpp +244 -0
  8. package/cpp/EnnioLog.hpp +182 -0
  9. package/cpp/HybridEnnio.cpp +1161 -0
  10. package/cpp/HybridEnnio.hpp +174 -0
  11. package/cpp/IdleMonitor.hpp +277 -0
  12. package/cpp/Protocol.cpp +135 -0
  13. package/cpp/Protocol.hpp +47 -0
  14. package/cpp/SelectorCriteria.hpp +281 -0
  15. package/cpp/SelectorParser.cpp +649 -0
  16. package/cpp/SelectorParser.hpp +94 -0
  17. package/cpp/ShadowTreeTraverser.cpp +305 -0
  18. package/cpp/ShadowTreeTraverser.hpp +142 -0
  19. package/cpp/TestIDRegistry.cpp +109 -0
  20. package/cpp/TestIDRegistry.hpp +84 -0
  21. package/dist/cli.js +16221 -0
  22. package/ios/EnnioAutoInit.mm +338 -0
  23. package/ios/EnnioDebugBanner.h +19 -0
  24. package/ios/EnnioDebugBanner.mm +178 -0
  25. package/ios/EnnioRuntimeHelper.h +264 -0
  26. package/ios/EnnioRuntimeHelper.mm +2443 -0
  27. package/lib/Ennio.nitro.d.ts +263 -0
  28. package/lib/Ennio.nitro.d.ts.map +1 -0
  29. package/lib/Ennio.nitro.js +2 -0
  30. package/lib/Ennio.nitro.js.map +1 -0
  31. package/lib/index.d.ts +16 -0
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/index.js +45 -0
  34. package/lib/index.js.map +1 -0
  35. package/nitro.json +24 -0
  36. package/nitrogen/generated/.gitattributes +1 -0
  37. package/nitrogen/generated/android/EnnioCore+autolinking.cmake +81 -0
  38. package/nitrogen/generated/android/EnnioCore+autolinking.gradle +27 -0
  39. package/nitrogen/generated/android/EnnioCoreOnLoad.cpp +49 -0
  40. package/nitrogen/generated/android/EnnioCoreOnLoad.hpp +34 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/ennio/EnnioCoreOnLoad.kt +35 -0
  42. package/nitrogen/generated/ios/EnnioCore+autolinking.rb +62 -0
  43. package/nitrogen/generated/ios/EnnioCore-Swift-Cxx-Bridge.cpp +17 -0
  44. package/nitrogen/generated/ios/EnnioCore-Swift-Cxx-Bridge.hpp +27 -0
  45. package/nitrogen/generated/ios/EnnioCore-Swift-Cxx-Umbrella.hpp +38 -0
  46. package/nitrogen/generated/ios/EnnioCoreAutolinking.mm +35 -0
  47. package/nitrogen/generated/ios/EnnioCoreAutolinking.swift +16 -0
  48. package/nitrogen/generated/shared/c++/ExtendedElementInfo.hpp +118 -0
  49. package/nitrogen/generated/shared/c++/HybridEnnioSpec.cpp +44 -0
  50. package/nitrogen/generated/shared/c++/HybridEnnioSpec.hpp +93 -0
  51. package/nitrogen/generated/shared/c++/LayoutMetrics.hpp +103 -0
  52. package/nitrogen/generated/shared/c++/ScrollDirection.hpp +84 -0
  53. package/package.json +78 -0
  54. package/react-native.config.js +14 -0
  55. package/src/Ennio.nitro.ts +363 -0
  56. package/src/cli/hid-daemon.py +129 -0
  57. package/src/index.ts +72 -0
@@ -0,0 +1,17 @@
1
+ ///
2
+ /// EnnioCore-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "EnnioCore-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+
12
+
13
+ namespace margelo::nitro::ennio::bridge::swift {
14
+
15
+
16
+
17
+ } // namespace margelo::nitro::ennio::bridge::swift
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// EnnioCore-Swift-Cxx-Bridge.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+
12
+
13
+ // Forward declarations of Swift defined types
14
+
15
+
16
+ // Include C++ defined types
17
+
18
+
19
+ /**
20
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
21
+ * as well as helper functions to interact with those C++ types from Swift.
22
+ */
23
+ namespace margelo::nitro::ennio::bridge::swift {
24
+
25
+
26
+
27
+ } // namespace margelo::nitro::ennio::bridge::swift
@@ -0,0 +1,38 @@
1
+ ///
2
+ /// EnnioCore-Swift-Cxx-Umbrella.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+
12
+
13
+ // Include C++ defined types
14
+
15
+
16
+ // C++ helpers for Swift
17
+ #include "EnnioCore-Swift-Cxx-Bridge.hpp"
18
+
19
+ // Common C++ types used in Swift
20
+ #include <NitroModules/ArrayBufferHolder.hpp>
21
+ #include <NitroModules/AnyMapUtils.hpp>
22
+ #include <NitroModules/RuntimeError.hpp>
23
+ #include <NitroModules/DateToChronoDate.hpp>
24
+
25
+ // Forward declarations of Swift defined types
26
+
27
+
28
+ // Include Swift defined types
29
+ #if __has_include("EnnioCore-Swift.h")
30
+ // This header is generated by Xcode/Swift on every app build.
31
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "EnnioCore".
32
+ #include "EnnioCore-Swift.h"
33
+ // Same as above, but used when building with frameworks (`use_frameworks`)
34
+ #elif __has_include(<EnnioCore/EnnioCore-Swift.h>)
35
+ #include <EnnioCore/EnnioCore-Swift.h>
36
+ #else
37
+ #error EnnioCore's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "EnnioCore", and try building the app first.
38
+ #endif
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// EnnioCoreAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+
11
+ #import <type_traits>
12
+
13
+ #include "HybridEnnio.hpp"
14
+
15
+ @interface EnnioCoreAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation EnnioCoreAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::ennio;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "Ennio",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ static_assert(std::is_default_constructible_v<HybridEnnio>,
28
+ "The HybridObject \"HybridEnnio\" is not default-constructible! "
29
+ "Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
30
+ return std::make_shared<HybridEnnio>();
31
+ }
32
+ );
33
+ }
34
+
35
+ @end
@@ -0,0 +1,16 @@
1
+ ///
2
+ /// EnnioCoreAutolinking.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class EnnioCoreAutolinking {
13
+ public typealias bridge = margelo.nitro.ennio.bridge.swift
14
+
15
+
16
+ }
@@ -0,0 +1,118 @@
1
+ ///
2
+ /// ExtendedElementInfo.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `LayoutMetrics` to properly resolve imports.
32
+ namespace margelo::nitro::ennio { struct LayoutMetrics; }
33
+
34
+ #include <string>
35
+ #include <optional>
36
+ #include "LayoutMetrics.hpp"
37
+
38
+ namespace margelo::nitro::ennio {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (ExtendedElementInfo).
42
+ */
43
+ struct ExtendedElementInfo final {
44
+ public:
45
+ bool checked SWIFT_PRIVATE;
46
+ bool focused SWIFT_PRIVATE;
47
+ bool selected SWIFT_PRIVATE;
48
+ std::string testID SWIFT_PRIVATE;
49
+ std::string type SWIFT_PRIVATE;
50
+ std::optional<std::string> text SWIFT_PRIVATE;
51
+ bool accessible SWIFT_PRIVATE;
52
+ bool enabled SWIFT_PRIVATE;
53
+ LayoutMetrics layout SWIFT_PRIVATE;
54
+
55
+ public:
56
+ ExtendedElementInfo() = default;
57
+ explicit ExtendedElementInfo(bool checked, bool focused, bool selected, std::string testID, std::string type, std::optional<std::string> text, bool accessible, bool enabled, LayoutMetrics layout): checked(checked), focused(focused), selected(selected), testID(testID), type(type), text(text), accessible(accessible), enabled(enabled), layout(layout) {}
58
+
59
+ public:
60
+ friend bool operator==(const ExtendedElementInfo& lhs, const ExtendedElementInfo& rhs) = default;
61
+ };
62
+
63
+ } // namespace margelo::nitro::ennio
64
+
65
+ namespace margelo::nitro {
66
+
67
+ // C++ ExtendedElementInfo <> JS ExtendedElementInfo (object)
68
+ template <>
69
+ struct JSIConverter<margelo::nitro::ennio::ExtendedElementInfo> final {
70
+ static inline margelo::nitro::ennio::ExtendedElementInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
71
+ jsi::Object obj = arg.asObject(runtime);
72
+ return margelo::nitro::ennio::ExtendedElementInfo(
73
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked"))),
74
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "focused"))),
75
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected"))),
76
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "testID"))),
77
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
78
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
79
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessible"))),
80
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled"))),
81
+ JSIConverter<margelo::nitro::ennio::LayoutMetrics>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layout")))
82
+ );
83
+ }
84
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ennio::ExtendedElementInfo& arg) {
85
+ jsi::Object obj(runtime);
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "checked"), JSIConverter<bool>::toJSI(runtime, arg.checked));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "focused"), JSIConverter<bool>::toJSI(runtime, arg.focused));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "selected"), JSIConverter<bool>::toJSI(runtime, arg.selected));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "testID"), JSIConverter<std::string>::toJSI(runtime, arg.testID));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::string>::toJSI(runtime, arg.type));
91
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.text));
92
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "accessible"), JSIConverter<bool>::toJSI(runtime, arg.accessible));
93
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "enabled"), JSIConverter<bool>::toJSI(runtime, arg.enabled));
94
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "layout"), JSIConverter<margelo::nitro::ennio::LayoutMetrics>::toJSI(runtime, arg.layout));
95
+ return obj;
96
+ }
97
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
98
+ if (!value.isObject()) {
99
+ return false;
100
+ }
101
+ jsi::Object obj = value.getObject(runtime);
102
+ if (!nitro::isPlainObject(runtime, obj)) {
103
+ return false;
104
+ }
105
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked")))) return false;
106
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "focused")))) return false;
107
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected")))) return false;
108
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "testID")))) return false;
109
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
110
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
111
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessible")))) return false;
112
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled")))) return false;
113
+ if (!JSIConverter<margelo::nitro::ennio::LayoutMetrics>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layout")))) return false;
114
+ return true;
115
+ }
116
+ };
117
+
118
+ } // namespace margelo::nitro
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// HybridEnnioSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridEnnioSpec.hpp"
9
+
10
+ namespace margelo::nitro::ennio {
11
+
12
+ void HybridEnnioSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("exists", &HybridEnnioSpec::exists);
18
+ prototype.registerHybridMethod("isVisible", &HybridEnnioSpec::isVisible);
19
+ prototype.registerHybridMethod("getText", &HybridEnnioSpec::getText);
20
+ prototype.registerHybridMethod("waitForIdle", &HybridEnnioSpec::waitForIdle);
21
+ prototype.registerHybridMethod("synchronize", &HybridEnnioSpec::synchronize);
22
+ prototype.registerHybridMethod("waitForNextCommit", &HybridEnnioSpec::waitForNextCommit);
23
+ prototype.registerHybridMethod("findBySelector", &HybridEnnioSpec::findBySelector);
24
+ prototype.registerHybridMethod("findAllBySelector", &HybridEnnioSpec::findAllBySelector);
25
+ prototype.registerHybridMethod("existsBySelector", &HybridEnnioSpec::existsBySelector);
26
+ prototype.registerHybridMethod("getTextBySelector", &HybridEnnioSpec::getTextBySelector);
27
+ prototype.registerHybridMethod("isVisibleBySelector", &HybridEnnioSpec::isVisibleBySelector);
28
+ prototype.registerHybridMethod("isAlertPresent", &HybridEnnioSpec::isAlertPresent);
29
+ prototype.registerHybridMethod("getAlertText", &HybridEnnioSpec::getAlertText);
30
+ prototype.registerHybridMethod("getAlertButtons", &HybridEnnioSpec::getAlertButtons);
31
+ prototype.registerHybridMethod("scroll", &HybridEnnioSpec::scroll);
32
+ prototype.registerHybridMethod("scrollTo", &HybridEnnioSpec::scrollTo);
33
+ prototype.registerHybridMethod("swipeAtPoints", &HybridEnnioSpec::swipeAtPoints);
34
+ prototype.registerHybridMethod("pressHardwareKey", &HybridEnnioSpec::pressHardwareKey);
35
+ prototype.registerHybridMethod("backGesture", &HybridEnnioSpec::backGesture);
36
+ prototype.registerHybridMethod("hideKeyboard", &HybridEnnioSpec::hideKeyboard);
37
+ prototype.registerHybridMethod("tapAlertButton", &HybridEnnioSpec::tapAlertButton);
38
+ prototype.registerHybridMethod("dismissAlert", &HybridEnnioSpec::dismissAlert);
39
+ prototype.registerHybridMethod("copyToClipboard", &HybridEnnioSpec::copyToClipboard);
40
+ prototype.registerHybridMethod("pasteFromClipboard", &HybridEnnioSpec::pasteFromClipboard);
41
+ });
42
+ }
43
+
44
+ } // namespace margelo::nitro::ennio
@@ -0,0 +1,93 @@
1
+ ///
2
+ /// HybridEnnioSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `ExtendedElementInfo` to properly resolve imports.
17
+ namespace margelo::nitro::ennio { struct ExtendedElementInfo; }
18
+ // Forward declaration of `ScrollDirection` to properly resolve imports.
19
+ namespace margelo::nitro::ennio { enum class ScrollDirection; }
20
+
21
+ #include <string>
22
+ #include <NitroModules/Null.hpp>
23
+ #include <variant>
24
+ #include "ExtendedElementInfo.hpp"
25
+ #include <vector>
26
+ #include "ScrollDirection.hpp"
27
+
28
+ namespace margelo::nitro::ennio {
29
+
30
+ using namespace margelo::nitro;
31
+
32
+ /**
33
+ * An abstract base class for `Ennio`
34
+ * Inherit this class to create instances of `HybridEnnioSpec` in C++.
35
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
36
+ * @example
37
+ * ```cpp
38
+ * class HybridEnnio: public HybridEnnioSpec {
39
+ * public:
40
+ * HybridEnnio(...): HybridObject(TAG) { ... }
41
+ * // ...
42
+ * };
43
+ * ```
44
+ */
45
+ class HybridEnnioSpec: public virtual HybridObject {
46
+ public:
47
+ // Constructor
48
+ explicit HybridEnnioSpec(): HybridObject(TAG) { }
49
+
50
+ // Destructor
51
+ ~HybridEnnioSpec() override = default;
52
+
53
+ public:
54
+ // Properties
55
+
56
+
57
+ public:
58
+ // Methods
59
+ virtual bool exists(const std::string& testID) = 0;
60
+ virtual bool isVisible(const std::string& testID) = 0;
61
+ virtual std::variant<nitro::NullType, std::string> getText(const std::string& testID) = 0;
62
+ virtual bool waitForIdle(double timeoutMs) = 0;
63
+ virtual void synchronize() = 0;
64
+ virtual bool waitForNextCommit(double maxMs) = 0;
65
+ virtual std::variant<nitro::NullType, ExtendedElementInfo> findBySelector(const std::string& selectorJson) = 0;
66
+ virtual std::vector<ExtendedElementInfo> findAllBySelector(const std::string& selectorJson) = 0;
67
+ virtual bool existsBySelector(const std::string& selectorJson) = 0;
68
+ virtual std::variant<nitro::NullType, std::string> getTextBySelector(const std::string& selectorJson) = 0;
69
+ virtual bool isVisibleBySelector(const std::string& selectorJson) = 0;
70
+ virtual bool isAlertPresent() = 0;
71
+ virtual std::string getAlertText() = 0;
72
+ virtual std::vector<std::string> getAlertButtons() = 0;
73
+ virtual bool scroll(const std::string& testID, ScrollDirection direction, double distance) = 0;
74
+ virtual bool scrollTo(const std::string& scrollViewTestID, const std::string& elementTestID) = 0;
75
+ virtual bool swipeAtPoints(double x1, double y1, double x2, double y2, double durationMs) = 0;
76
+ virtual bool pressHardwareKey(double keyCode) = 0;
77
+ virtual bool backGesture() = 0;
78
+ virtual bool hideKeyboard() = 0;
79
+ virtual bool tapAlertButton(const std::string& buttonText) = 0;
80
+ virtual bool dismissAlert() = 0;
81
+ virtual bool copyToClipboard(const std::string& text) = 0;
82
+ virtual bool pasteFromClipboard(const std::string& testID) = 0;
83
+
84
+ protected:
85
+ // Hybrid Setup
86
+ void loadHybridMethods() override;
87
+
88
+ protected:
89
+ // Tag for logging
90
+ static constexpr auto TAG = "Ennio";
91
+ };
92
+
93
+ } // namespace margelo::nitro::ennio
@@ -0,0 +1,103 @@
1
+ ///
2
+ /// LayoutMetrics.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+
34
+
35
+ namespace margelo::nitro::ennio {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (LayoutMetrics).
39
+ */
40
+ struct LayoutMetrics final {
41
+ public:
42
+ double x SWIFT_PRIVATE;
43
+ double y SWIFT_PRIVATE;
44
+ double width SWIFT_PRIVATE;
45
+ double height SWIFT_PRIVATE;
46
+ double screenX SWIFT_PRIVATE;
47
+ double screenY SWIFT_PRIVATE;
48
+
49
+ public:
50
+ LayoutMetrics() = default;
51
+ explicit LayoutMetrics(double x, double y, double width, double height, double screenX, double screenY): x(x), y(y), width(width), height(height), screenX(screenX), screenY(screenY) {}
52
+
53
+ public:
54
+ friend bool operator==(const LayoutMetrics& lhs, const LayoutMetrics& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::ennio
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ LayoutMetrics <> JS LayoutMetrics (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::ennio::LayoutMetrics> final {
64
+ static inline margelo::nitro::ennio::LayoutMetrics fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::ennio::LayoutMetrics(
67
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))),
68
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))),
69
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
70
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))),
71
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screenX"))),
72
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screenY")))
73
+ );
74
+ }
75
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ennio::LayoutMetrics& arg) {
76
+ jsi::Object obj(runtime);
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter<double>::toJSI(runtime, arg.x));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter<double>::toJSI(runtime, arg.y));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<double>::toJSI(runtime, arg.width));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<double>::toJSI(runtime, arg.height));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "screenX"), JSIConverter<double>::toJSI(runtime, arg.screenX));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "screenY"), JSIConverter<double>::toJSI(runtime, arg.screenY));
83
+ return obj;
84
+ }
85
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
86
+ if (!value.isObject()) {
87
+ return false;
88
+ }
89
+ jsi::Object obj = value.getObject(runtime);
90
+ if (!nitro::isPlainObject(runtime, obj)) {
91
+ return false;
92
+ }
93
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false;
94
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false;
95
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
96
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
97
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screenX")))) return false;
98
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screenY")))) return false;
99
+ return true;
100
+ }
101
+ };
102
+
103
+ } // namespace margelo::nitro
@@ -0,0 +1,84 @@
1
+ ///
2
+ /// ScrollDirection.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::ennio {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (ScrollDirection).
30
+ */
31
+ enum class ScrollDirection {
32
+ UP SWIFT_NAME(up) = 0,
33
+ DOWN SWIFT_NAME(down) = 1,
34
+ LEFT SWIFT_NAME(left) = 2,
35
+ RIGHT SWIFT_NAME(right) = 3,
36
+ } CLOSED_ENUM;
37
+
38
+ } // namespace margelo::nitro::ennio
39
+
40
+ namespace margelo::nitro {
41
+
42
+ // C++ ScrollDirection <> JS ScrollDirection (union)
43
+ template <>
44
+ struct JSIConverter<margelo::nitro::ennio::ScrollDirection> final {
45
+ static inline margelo::nitro::ennio::ScrollDirection fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
48
+ case hashString("up"): return margelo::nitro::ennio::ScrollDirection::UP;
49
+ case hashString("down"): return margelo::nitro::ennio::ScrollDirection::DOWN;
50
+ case hashString("left"): return margelo::nitro::ennio::ScrollDirection::LEFT;
51
+ case hashString("right"): return margelo::nitro::ennio::ScrollDirection::RIGHT;
52
+ default: [[unlikely]]
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ScrollDirection - invalid value!");
54
+ }
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::ennio::ScrollDirection arg) {
57
+ switch (arg) {
58
+ case margelo::nitro::ennio::ScrollDirection::UP: return JSIConverter<std::string>::toJSI(runtime, "up");
59
+ case margelo::nitro::ennio::ScrollDirection::DOWN: return JSIConverter<std::string>::toJSI(runtime, "down");
60
+ case margelo::nitro::ennio::ScrollDirection::LEFT: return JSIConverter<std::string>::toJSI(runtime, "left");
61
+ case margelo::nitro::ennio::ScrollDirection::RIGHT: return JSIConverter<std::string>::toJSI(runtime, "right");
62
+ default: [[unlikely]]
63
+ throw std::invalid_argument("Cannot convert ScrollDirection to JS - invalid value: "
64
+ + std::to_string(static_cast<int>(arg)) + "!");
65
+ }
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isString()) {
69
+ return false;
70
+ }
71
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
72
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
73
+ case hashString("up"):
74
+ case hashString("down"):
75
+ case hashString("left"):
76
+ case hashString("right"):
77
+ return true;
78
+ default:
79
+ return false;
80
+ }
81
+ }
82
+ };
83
+
84
+ } // namespace margelo::nitro
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@reactiive/ennio",
3
+ "version": "0.0.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/enzomanuelmangano/ennio.git",
7
+ "directory": "packages/ennio"
8
+ },
9
+ "main": "lib/index.js",
10
+ "devDependencies": {
11
+ "@types/js-yaml": "^4.0.9",
12
+ "@types/node": "^20.0.0",
13
+ "@types/react": "^18.2.0",
14
+ "@types/ws": "^8.5.0",
15
+ "esbuild": "^0.21.0",
16
+ "glob": "^10.0.0",
17
+ "js-yaml": "^4.1.0",
18
+ "nitrogen": "^0.35.5",
19
+ "react-native-nitro-modules": "^0.35.5",
20
+ "typescript": "^5.4.0",
21
+ "ws": "^8.18.0"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "*",
25
+ "react-native": "*",
26
+ "react-native-nitro-modules": ">=0.18.0"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "types": "./lib/index.d.ts",
31
+ "default": "./lib/index.js"
32
+ }
33
+ },
34
+ "bin": {
35
+ "ennio": "./dist/cli.js"
36
+ },
37
+ "description": "Maestro-compatible E2E test runner for React Native iOS. Drives the app over Hermes Inspector (CDP) and actuates real CoreSimulator touches via a persistent idb HID daemon.",
38
+ "files": [
39
+ "lib/",
40
+ "dist/",
41
+ "src/Ennio.nitro.ts",
42
+ "src/index.ts",
43
+ "src/cli/hid-daemon.py",
44
+ "cpp/",
45
+ "android/",
46
+ "ios/*.h",
47
+ "ios/*.mm",
48
+ "nitrogen/generated/",
49
+ "nitro.json",
50
+ "EnnioCore.podspec",
51
+ "react-native.config.js",
52
+ "LICENSE",
53
+ "README.md"
54
+ ],
55
+ "keywords": [
56
+ "react-native",
57
+ "e2e",
58
+ "testing",
59
+ "fabric",
60
+ "nitro",
61
+ "maestro",
62
+ "ios"
63
+ ],
64
+ "license": "MIT",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "scripts": {
69
+ "build:lib": "tsc",
70
+ "build:cli": "esbuild src/cli/index.ts --bundle --platform=node --format=cjs --outfile=dist/cli.js --banner:js=\"#!/usr/bin/env node\" --external:fsevents --external:bufferutil --external:utf-8-validate",
71
+ "build": "npm run build:lib && npm run build:cli && chmod +x dist/cli.js",
72
+ "clean": "rm -rf lib dist",
73
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.cli.json --noEmit",
74
+ "lint": "eslint . --max-warnings=0",
75
+ "prepublishOnly": "npm run clean && npm run build"
76
+ },
77
+ "types": "lib/index.d.ts"
78
+ }