optics-framework 1.0.0__tar.gz
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.
- optics_framework-1.0.0/LICENSE +202 -0
- optics_framework-1.0.0/PKG-INFO +482 -0
- optics_framework-1.0.0/README.md +451 -0
- optics_framework-1.0.0/optics_framework/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/api/__init__.py +6 -0
- optics_framework-1.0.0/optics_framework/api/action_keyword.py +432 -0
- optics_framework-1.0.0/optics_framework/api/app_management.py +81 -0
- optics_framework-1.0.0/optics_framework/api/flow_control.py +402 -0
- optics_framework-1.0.0/optics_framework/api/verifier.py +261 -0
- optics_framework-1.0.0/optics_framework/common/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/common/base_factory.py +187 -0
- optics_framework-1.0.0/optics_framework/common/config_handler.py +214 -0
- optics_framework-1.0.0/optics_framework/common/driver_interface.py +225 -0
- optics_framework-1.0.0/optics_framework/common/elementsource_interface.py +54 -0
- optics_framework-1.0.0/optics_framework/common/execution.py +257 -0
- optics_framework-1.0.0/optics_framework/common/expose_api.py +235 -0
- optics_framework-1.0.0/optics_framework/common/factories.py +38 -0
- optics_framework-1.0.0/optics_framework/common/image_interface.py +60 -0
- optics_framework-1.0.0/optics_framework/common/logging_config.py +394 -0
- optics_framework-1.0.0/optics_framework/common/optics_builder.py +71 -0
- optics_framework-1.0.0/optics_framework/common/runner/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/common/runner/data_reader.py +281 -0
- optics_framework-1.0.0/optics_framework/common/runner/keyword_register.py +52 -0
- optics_framework-1.0.0/optics_framework/common/runner/printers.py +186 -0
- optics_framework-1.0.0/optics_framework/common/runner/test_runnner.py +452 -0
- optics_framework-1.0.0/optics_framework/common/session_manager.py +70 -0
- optics_framework-1.0.0/optics_framework/common/strategies.py +236 -0
- optics_framework-1.0.0/optics_framework/common/text_interface.py +59 -0
- optics_framework-1.0.0/optics_framework/common/utils.py +192 -0
- optics_framework-1.0.0/optics_framework/engines/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/appium.py +375 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/appium_UI_helper.py +687 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/appium_driver_manager.py +20 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/ble.py +19 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/selenium.py +157 -0
- optics_framework-1.0.0/optics_framework/engines/drivers/selenium_driver_manager.py +24 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/appium_find_element.py +142 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/appium_page_source.py +247 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/camera_screenshot.py +60 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/device_screenshot.py +93 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/selenium_find_element.py +150 -0
- optics_framework-1.0.0/optics_framework/engines/elementsources/selenium_screenshot.py +119 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/image_models/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/image_models/remote_oir.py +178 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/image_models/templatematch.py +232 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/ocr_models/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/ocr_models/easyocr.py +104 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/ocr_models/googlevision.py +124 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/ocr_models/pytesseract.py +102 -0
- optics_framework-1.0.0/optics_framework/engines/vision_models/ocr_models/remote_ocr.py +179 -0
- optics_framework-1.0.0/optics_framework/helper/__init__.py +0 -0
- optics_framework-1.0.0/optics_framework/helper/cli.py +284 -0
- optics_framework-1.0.0/optics_framework/helper/config_manager.py +206 -0
- optics_framework-1.0.0/optics_framework/helper/execute.py +370 -0
- optics_framework-1.0.0/optics_framework/helper/generate.py +207 -0
- optics_framework-1.0.0/optics_framework/helper/initialize.py +105 -0
- optics_framework-1.0.0/optics_framework/helper/list_keyword.py +60 -0
- optics_framework-1.0.0/optics_framework/helper/setup.py +139 -0
- optics_framework-1.0.0/optics_framework/helper/version.py +1 -0
- optics_framework-1.0.0/optics_framework/optics.py +163 -0
- optics_framework-1.0.0/optics_framework/samples/contact/config.yaml +37 -0
- optics_framework-1.0.0/optics_framework/samples/contact/elements.csv +17 -0
- optics_framework-1.0.0/optics_framework/samples/contact/test_cases.csv +6 -0
- optics_framework-1.0.0/optics_framework/samples/contact/test_modules.csv +15 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/config.yaml +64 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/elements.csv +12 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/input_templates/home.png +0 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/input_templates/sub.jpeg +0 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/input_templates/youtube.jpeg +0 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/test_cases.csv +3 -0
- optics_framework-1.0.0/optics_framework/samples/youtube/test_modules.csv +18 -0
- optics_framework-1.0.0/pyproject.toml +59 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright Mozark India Pvt. Ltd.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: optics-framework
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A flexible and modular test automation framework that can be used to automate any mobile application.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Keywords: test automation,framework,mobile automation
|
|
7
|
+
Author: Lalitanand Dandge
|
|
8
|
+
Author-email: lalit@mozark.ai
|
|
9
|
+
Requires-Python: >=3.12,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: fastapi (>=0.115.12,<0.116.0)
|
|
15
|
+
Requires-Dist: fuzzywuzzy (>=0.18.0,<0.19.0)
|
|
16
|
+
Requires-Dist: lxml (>=5.3.1,<6.0.0)
|
|
17
|
+
Requires-Dist: opencv-python (>=4.11.0.86,<5.0.0.0)
|
|
18
|
+
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
|
19
|
+
Requires-Dist: prompt-toolkit (>=3.0.50,<4.0.0)
|
|
20
|
+
Requires-Dist: pydantic (>=2.11.2,<3.0.0)
|
|
21
|
+
Requires-Dist: pytest (>=8.3.5,<9.0.0)
|
|
22
|
+
Requires-Dist: python-json-logger (>=3.3.0,<4.0.0)
|
|
23
|
+
Requires-Dist: python-levenshtein (>=0.27.1,<0.28.0)
|
|
24
|
+
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
25
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
26
|
+
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
|
27
|
+
Requires-Dist: sse-starlette (>=2.2.1,<3.0.0)
|
|
28
|
+
Requires-Dist: textual (>=3.0.0,<4.0.0)
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Optics Framework
|
|
32
|
+
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](https://www.python.org/)
|
|
35
|
+
[](docs/)
|
|
36
|
+
|
|
37
|
+
**Optics Framework** is a powerful, extensible no code test automation framework designed for **vision powered**, **data-driven testing** and **production app synthetic monitoring**. It enables seamless integration with intrusive action & detection drivers such as Appium / WebDriver as well as non-intrusive action drivers such as BLE mouse / keyboard and detection drivers such as video capture card and external web cams.
|
|
38
|
+
|
|
39
|
+
This framework was designed primarily for the following use cases:
|
|
40
|
+
|
|
41
|
+
1. Production app monitoring where access to USB debugging / developer mode and device screenshots is prohibited
|
|
42
|
+
2. Resilient self-healing test automation that rely on more than one element identifier and multiple fallbacks to ensure maximum recovery
|
|
43
|
+
3. Enable non-coders to build test automation scripts
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚀 Features
|
|
48
|
+
|
|
49
|
+
- **Vision powered detections:** UI object detections are powered by computer vision and not just on XPath elements.
|
|
50
|
+
- **No code automation:** No knowledge of programming languages or access to IDE needed to build automations scripts
|
|
51
|
+
- **Supports non-intrusive action drivers:** Non-intrusive action drivers such as BLE mouse and keyboard are supported
|
|
52
|
+
- **Data-Driven Testing (DDT):** Execute test cases dynamically with multiple datasets, enabling parameterized testing and iterative execution.
|
|
53
|
+
- **Extensible & Scalable:** Easily add new keywords and modules without any hassle.
|
|
54
|
+
- **AI Integration:** Choose which AI models to use for object recognition and OCR.
|
|
55
|
+
- **Self-healing capability:** Configure multiple drivers, screen capture methods, and detection techniques with priority-based execution. If a primary method fails, the system automatically switches to the next available method in the defined hierarchy
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📦 Installation
|
|
60
|
+
|
|
61
|
+
### Install via `pip`
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ optics-framework
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 🚀 Quick Start
|
|
70
|
+
|
|
71
|
+
### 1 Create a New Test Project
|
|
72
|
+
|
|
73
|
+
**Note**: Ensure Appium server is running and a virtual Android device is enabled before proceeding.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
mkdir ~/test-code
|
|
77
|
+
cd ~/test-code
|
|
78
|
+
python3 -m venv venv
|
|
79
|
+
source venv/bin/activate
|
|
80
|
+
pip install --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ optics-framework
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2 Create a New Test Project
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
optics init --name my_test_project --path . --template youtube
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 📌 Dry Run Test Cases
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
optics dry_run my_test_project
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 📌 Execute Test Cases
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
optics execute my_test_project
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🛠️ Usage
|
|
104
|
+
|
|
105
|
+
### Execute Tests
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
optics execute <project_name> --test-cases <test_case_name>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Initialize a New Project
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
optics init --name <project_name> --path <directory> --template <contact/youtube> --force
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### List Available Keywords
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
optics list
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Display Help
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
optics --help
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Check Version
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
optics version
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 🏗️ Developer Guide
|
|
138
|
+
|
|
139
|
+
### Project Structure
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
Optics_Framework/
|
|
143
|
+
├── LICENSE
|
|
144
|
+
├── README.md
|
|
145
|
+
├── dev_requirements.txt
|
|
146
|
+
├── samples/ # Sample test cases and configurations
|
|
147
|
+
| ├── contact/
|
|
148
|
+
| ├── youtube/
|
|
149
|
+
├── pyproject.toml
|
|
150
|
+
├── tox.ini
|
|
151
|
+
├── docs/ # Documentation using Sphinx
|
|
152
|
+
├── optics_framework/ # Main package
|
|
153
|
+
│ ├── api/ # Core API modules
|
|
154
|
+
│ ├── common/ # Factories, interfaces, and utilities
|
|
155
|
+
│ ├── engines/ # Engine implementations (drivers, vision models, screenshot tools)
|
|
156
|
+
│ ├── helper/ # Configuration management
|
|
157
|
+
├── tests/ # Unit tests and test assets
|
|
158
|
+
│ ├── assets/ # Sample images for testing
|
|
159
|
+
│ ├── units/ # Unit tests organized by module
|
|
160
|
+
│ ├── functional/ # Functional tests organized by module
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Available Keywords
|
|
165
|
+
|
|
166
|
+
The following keywords are available and organized by category. These keywords can be used directly in your test cases or extended further for custom workflows.
|
|
167
|
+
<details>
|
|
168
|
+
<summary><strong>🔹 Core Keywords</strong></summary>
|
|
169
|
+
|
|
170
|
+
<ul>
|
|
171
|
+
<li>
|
|
172
|
+
<code>clear_element_text(element, event_name=None)</code><br/>
|
|
173
|
+
Clears any existing text from the given input element.
|
|
174
|
+
</li>
|
|
175
|
+
<li>
|
|
176
|
+
<code>detect_and_press(element, timeout, event_name=None)</code><br/>
|
|
177
|
+
Detects if the element exists, then performs a press action on it.
|
|
178
|
+
</li>
|
|
179
|
+
<li>
|
|
180
|
+
<code>enter_number(element, number, event_name=None)</code><br/>
|
|
181
|
+
Enters a numeric value into the specified input field.
|
|
182
|
+
</li>
|
|
183
|
+
<li>
|
|
184
|
+
<code>enter_text(element, text, event_name=None)</code><br/>
|
|
185
|
+
Inputs the given text into the specified element.
|
|
186
|
+
</li>
|
|
187
|
+
<li>
|
|
188
|
+
<code>get_text(element)</code><br/>
|
|
189
|
+
Retrieves the text content from the specified element.
|
|
190
|
+
</li>
|
|
191
|
+
<li>
|
|
192
|
+
<code>press_by_coordinates(x, y, repeat=1, event_name=None)</code><br/>
|
|
193
|
+
Performs a tap at the specified absolute screen coordinates.
|
|
194
|
+
</li>
|
|
195
|
+
<li>
|
|
196
|
+
<code>press_by_percentage(percent_x, percent_y, repeat=1, event_name=None)</code><br/>
|
|
197
|
+
Taps on a location based on percentage of screen width and height.
|
|
198
|
+
</li>
|
|
199
|
+
<li>
|
|
200
|
+
<code>press_element(element, repeat=1, offset_x=0, offset_y=0, event_name=None)</code><br/>
|
|
201
|
+
Taps on a given element with optional offset and repeat parameters.
|
|
202
|
+
</li>
|
|
203
|
+
<li>
|
|
204
|
+
<code>press_element_with_index(element, index=0, event_name=None)</code><br/>
|
|
205
|
+
Presses the element found at the specified index from multiple matches.
|
|
206
|
+
</li>
|
|
207
|
+
<li>
|
|
208
|
+
<code>press_keycode(keycode, event_name)</code><br/>
|
|
209
|
+
Simulates pressing a hardware key using a keycode.
|
|
210
|
+
</li>
|
|
211
|
+
<li>
|
|
212
|
+
<code>scroll(direction, event_name=None)</code><br/>
|
|
213
|
+
Scrolls the screen in the specified direction.
|
|
214
|
+
</li>
|
|
215
|
+
<li>
|
|
216
|
+
<code>scroll_from_element(element, direction, scroll_length, event_name)</code><br/>
|
|
217
|
+
Scrolls starting from a specific element in the given direction.
|
|
218
|
+
</li>
|
|
219
|
+
<li>
|
|
220
|
+
<code>scroll_until_element_appears(element, direction, timeout, event_name=None)</code><br/>
|
|
221
|
+
Continuously scrolls until the target element becomes visible or the timeout is reached.
|
|
222
|
+
</li>
|
|
223
|
+
<li>
|
|
224
|
+
<code>select_dropdown_option(element, option, event_name=None)</code><br/>
|
|
225
|
+
Selects an option from a dropdown field by visible text.
|
|
226
|
+
</li>
|
|
227
|
+
<li>
|
|
228
|
+
<code>sleep(duration)</code><br/>
|
|
229
|
+
Pauses execution for a specified number of seconds.
|
|
230
|
+
</li>
|
|
231
|
+
<li>
|
|
232
|
+
<code>swipe(x, y, direction='right', swipe_length=50, event_name=None)</code><br/>
|
|
233
|
+
Swipes from a coordinate point in the given direction and length.
|
|
234
|
+
</li>
|
|
235
|
+
<li>
|
|
236
|
+
<code>swipe_from_element(element, direction, swipe_length, event_name=None)</code><br/>
|
|
237
|
+
Swipes starting from the position of a given element.
|
|
238
|
+
</li>
|
|
239
|
+
<li>
|
|
240
|
+
<code>swipe_until_element_appears(element, direction, timeout, event_name=None)</code><br/>
|
|
241
|
+
Swipes repeatedly until the element is detected or timeout is reached.
|
|
242
|
+
</li>
|
|
243
|
+
</ul>
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
|
|
247
|
+
<details>
|
|
248
|
+
<summary><strong>🔹 AppManagement</strong></summary>
|
|
249
|
+
|
|
250
|
+
<ul>
|
|
251
|
+
<li>
|
|
252
|
+
<code>close_and_terminate_app(package_name, event_name)</code><br/>
|
|
253
|
+
Closes and fully terminates the specified application using its package name.
|
|
254
|
+
</li>
|
|
255
|
+
<li>
|
|
256
|
+
<code>force_terminate_app(event_name)</code><br/>
|
|
257
|
+
Forcefully terminates the currently running application.
|
|
258
|
+
</li>
|
|
259
|
+
<li>
|
|
260
|
+
<code>get_app_version()</code><br/>
|
|
261
|
+
Returns the version of the currently running application.
|
|
262
|
+
</li>
|
|
263
|
+
<li>
|
|
264
|
+
<code>initialise_setup()</code><br/>
|
|
265
|
+
Prepares the environment for performing application management operations.
|
|
266
|
+
</li>
|
|
267
|
+
<li>
|
|
268
|
+
<code>launch_app(event_name=None)</code><br/>
|
|
269
|
+
Launches the default application configured in the session.
|
|
270
|
+
</li>
|
|
271
|
+
<li>
|
|
272
|
+
<code>start_appium_session(event_name=None)</code><br/>
|
|
273
|
+
Starts a new Appium session for the current application.
|
|
274
|
+
</li>
|
|
275
|
+
<li>
|
|
276
|
+
<code>start_other_app(package_name, event_name)</code><br/>
|
|
277
|
+
Launches a different application using the provided package name.
|
|
278
|
+
</li>
|
|
279
|
+
</ul>
|
|
280
|
+
|
|
281
|
+
</details>
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
<details>
|
|
285
|
+
<summary><strong>🔹 FlowControl</strong></summary>
|
|
286
|
+
|
|
287
|
+
<ul>
|
|
288
|
+
<li>
|
|
289
|
+
<code>_compute_expression(param2)</code><br/>
|
|
290
|
+
Resolves variables and safely computes a mathematical or logical expression.
|
|
291
|
+
</li>
|
|
292
|
+
<li>
|
|
293
|
+
<code>_ensure_runner()</code><br/>
|
|
294
|
+
Internal method to ensure a valid runner is set before execution.
|
|
295
|
+
</li>
|
|
296
|
+
<li>
|
|
297
|
+
<code>_evaluate_conditions(pairs, else_target)</code><br/>
|
|
298
|
+
Evaluates a list of condition-target pairs and executes the first matched one.
|
|
299
|
+
</li>
|
|
300
|
+
<li>
|
|
301
|
+
<code>_extract_element_name(input_element)</code><br/>
|
|
302
|
+
Extracts the variable name from a Robot-style input (e.g., ${var}).
|
|
303
|
+
</li>
|
|
304
|
+
<li>
|
|
305
|
+
<code>_extract_variable_name(param1)</code><br/>
|
|
306
|
+
Extracts a variable name from a string and strips formatting.
|
|
307
|
+
</li>
|
|
308
|
+
<li>
|
|
309
|
+
<code>_is_condition_true(condition)</code><br/>
|
|
310
|
+
Resolves variables and safely evaluates a condition string.
|
|
311
|
+
</li>
|
|
312
|
+
<li>
|
|
313
|
+
<code>_load_data(file_path, index=None)</code><br/>
|
|
314
|
+
Loads data from a local CSV, API response, or list for use in test steps.
|
|
315
|
+
</li>
|
|
316
|
+
<li>
|
|
317
|
+
<code>_loop_by_count(target, count)</code><br/>
|
|
318
|
+
Executes a module a specified number of times.
|
|
319
|
+
</li>
|
|
320
|
+
<li>
|
|
321
|
+
<code>_loop_with_variables(target, args)</code><br/>
|
|
322
|
+
Loops over multiple sets of variables and values to execute a module with dynamic input.
|
|
323
|
+
</li>
|
|
324
|
+
<li>
|
|
325
|
+
<code>_parse_iterables(variables, iterables)</code><br/>
|
|
326
|
+
Parses raw iterable strings or lists into structured Python lists.
|
|
327
|
+
</li>
|
|
328
|
+
<li>
|
|
329
|
+
<code>_parse_single_iterable(iterable, variable)</code><br/>
|
|
330
|
+
Parses a single iterable string or list and validates its structure.
|
|
331
|
+
</li>
|
|
332
|
+
<li>
|
|
333
|
+
<code>_parse_variable_iterable_pairs(variables, iterables)</code><br/>
|
|
334
|
+
Parses variables and iterable values into matched pairs.
|
|
335
|
+
</li>
|
|
336
|
+
<li>
|
|
337
|
+
<code>_parse_variable_names(variables)</code><br/>
|
|
338
|
+
Extracts variable names from Robot Framework-style variable syntax.
|
|
339
|
+
</li>
|
|
340
|
+
<li>
|
|
341
|
+
<code>_resolve_condition(condition)</code><br/>
|
|
342
|
+
Substitutes variables in a condition string with their values.
|
|
343
|
+
</li>
|
|
344
|
+
<li>
|
|
345
|
+
<code>_safe_eval(expression)</code><br/>
|
|
346
|
+
Evaluates expressions securely with limited allowed operations and types.
|
|
347
|
+
</li>
|
|
348
|
+
<li>
|
|
349
|
+
<code>_split_condition_args(args)</code><br/>
|
|
350
|
+
Separates condition-target pairs and an optional else-target from arguments.
|
|
351
|
+
</li>
|
|
352
|
+
<li>
|
|
353
|
+
<code>condition(*args)</code><br/>
|
|
354
|
+
Evaluates multiple conditions and executes corresponding modules if the condition is true.
|
|
355
|
+
</li>
|
|
356
|
+
<li>
|
|
357
|
+
<code>evaluate(param1, param2)</code><br/>
|
|
358
|
+
Evaluates a mathematical or logical expression and stores the result in a variable.
|
|
359
|
+
</li>
|
|
360
|
+
<li>
|
|
361
|
+
<code>execute_module(module_name)</code><br/>
|
|
362
|
+
Executes all the steps defined in the specified module.
|
|
363
|
+
</li>
|
|
364
|
+
<li>
|
|
365
|
+
<code>read_data(input_element, file_path, index=None)</code><br/>
|
|
366
|
+
Reads data from a CSV file, API URL, or list and assigns it to a variable.
|
|
367
|
+
</li>
|
|
368
|
+
<li>
|
|
369
|
+
<code>run_loop(target, *args)</code><br/>
|
|
370
|
+
Runs a loop either by count or by iterating over variable-value pairs.
|
|
371
|
+
</li>
|
|
372
|
+
</ul>
|
|
373
|
+
|
|
374
|
+
</details>
|
|
375
|
+
|
|
376
|
+
<details>
|
|
377
|
+
<summary><strong>🔹 Verifier</strong></summary>
|
|
378
|
+
|
|
379
|
+
<ul>
|
|
380
|
+
<li>
|
|
381
|
+
<code>assert_equality(output, expression)</code><br/>
|
|
382
|
+
Compares two values and checks if they are equal.
|
|
383
|
+
</li>
|
|
384
|
+
<li>
|
|
385
|
+
<code>assert_images_vision(frame, images, element_status, rule)</code><br/>
|
|
386
|
+
Searches for the specified image templates within the frame using vision-based template matching.
|
|
387
|
+
</li>
|
|
388
|
+
<li>
|
|
389
|
+
<code>assert_presence(elements, timeout=30, rule='any', event_name=None)</code><br/>
|
|
390
|
+
Verifies the presence of given elements using Appium or vision-based fallback logic.
|
|
391
|
+
</li>
|
|
392
|
+
<li>
|
|
393
|
+
<code>assert_texts_vision(frame, texts, element_status, rule)</code><br/>
|
|
394
|
+
Searches for text in the given frame using OCR and updates element status.
|
|
395
|
+
</li>
|
|
396
|
+
<li>
|
|
397
|
+
<code>is_element(element, element_state, timeout, event_name)</code><br/>
|
|
398
|
+
Checks if a given element exists.
|
|
399
|
+
</li>
|
|
400
|
+
<li>
|
|
401
|
+
<code>validate_element(element, timeout=10, rule='all', event_name=None)</code><br/>
|
|
402
|
+
Validates if the given element is present on the screen using defined rule and timeout.
|
|
403
|
+
</li>
|
|
404
|
+
<li>
|
|
405
|
+
<code>validate_screen(elements, timeout=30, rule='any', event_name=None)</code><br/>
|
|
406
|
+
Validates the presence of a set of elements on a screen using the defined rule.
|
|
407
|
+
</li>
|
|
408
|
+
<li>
|
|
409
|
+
<code>vision_search(elements, timeout, rule)</code><br/>
|
|
410
|
+
Performs vision-based search to detect text or image elements in the screen.
|
|
411
|
+
</li>
|
|
412
|
+
</ul>
|
|
413
|
+
|
|
414
|
+
</details>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
### Setup Development Environment
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
git clone git@github.com:mozarkai/optics-framework.git
|
|
421
|
+
cd Optics_Framework
|
|
422
|
+
pipx install poetry
|
|
423
|
+
poetry install --with dev
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Running Tests
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
poetry install --with tests
|
|
430
|
+
poetry run pytest
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Build Documentation
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
poetry install --with docs
|
|
437
|
+
poetry run sphinx-build -b html docs/ docs/_build/
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Packaging the Project
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
poetry build
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## 📜 Contributing
|
|
449
|
+
|
|
450
|
+
We welcome contributions! Please follow these steps:
|
|
451
|
+
|
|
452
|
+
1. Fork the repository.
|
|
453
|
+
2. Create a new feature branch.
|
|
454
|
+
3. Commit your changes.
|
|
455
|
+
4. Open a pull request.
|
|
456
|
+
|
|
457
|
+
Ensure your code follows **PEP8** standards and is formatted with **Black**.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## 🎯 Roadmap
|
|
462
|
+
|
|
463
|
+
Here are the key initiatives planned for the upcoming quarter:
|
|
464
|
+
1. MCP Servicer: Introduce a dedicated service to handle MCP (Model Context Protocol), improving scalability and modularity across the framework.
|
|
465
|
+
2. Omniparser Integration: Seamlessly integrate Omniparser to enable robust and flexible element extraction and location.
|
|
466
|
+
3. Playwright Integration: Add support for Playwright to enhance browser automation capabilities, enabling cross-browser testing with modern and powerful tooling.
|
|
467
|
+
4. Audio Support: Extend the framework to support audio inputs and outputs, enabling testing and verification of voice-based or sound-related interactions.
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## 📄 License
|
|
472
|
+
|
|
473
|
+
This project is licensed under the **Apache 2.0 License**. See the [LICENSE](https://github.com/mozarkai/optics-framework?tab=Apache-2.0-1-ov-file) file for details.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## 📞 Support
|
|
478
|
+
|
|
479
|
+
:TODO: Add support information
|
|
480
|
+
|
|
481
|
+
Happy Testing! 🚀
|
|
482
|
+
|