Skip to content
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ jobs:
- run:
command: python ./test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py
name: total_record_and_html_report_test
- run:
command: python ./test/integrated_test/get_dir_file_and_execute/get_dir_file_and_execute.py
name: get_dir_file_and_execute

build-and-test-windows-stable:
executor:
Expand Down Expand Up @@ -190,6 +193,9 @@ jobs:
- run:
command: python ./test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py
name: total_record_and_html_report_test
- run:
command: python ./test/integrated_test/get_dir_file_and_execute/get_dir_file_and_execute.py
name: get_dir_file_and_execute

workflows:
main:
Expand Down
43 changes: 25 additions & 18 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control_dev",
version="0.0.15",
version="0.0.16",
author="JE-Chen",
author_email="[email protected]",
description="auto testing",
Expand Down
9 changes: 7 additions & 2 deletions je_auto_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@
from je_auto_control.wrapper.auto_control_record import stop_record

# json
from je_auto_control.utils.executor.action_executor import execute_action
from je_auto_control.utils.json.json_file import read_action_json
from je_auto_control.utils.json.json_file import write_action_json

# executor
from je_auto_control.utils.executor.action_executor import execute_action
from je_auto_control.utils.executor.action_executor import execute_files

# timeout
from je_auto_control.utils.timeout.multiprocess_timeout import multiprocess_timeout
# test record
Expand All @@ -63,5 +66,7 @@
from je_auto_control.wrapper.auto_control_image import screenshot

# html report

from je_auto_control.utils.html_report.html_report_generate import generate_html

# file process
from je_auto_control.utils.file_process.get_dir_file_list import get_dir_files_as_list
10 changes: 10 additions & 0 deletions je_auto_control/utils/executor/action_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from je_auto_control.utils.exception.exception_tag import action_is_null_error
from je_auto_control.utils.exception.exception_tag import cant_execute_action_error
from je_auto_control.utils.exception.exceptions import AutoControlActionException
from je_auto_control.utils.json.json_file import read_action_json

from je_auto_control.utils.test_record.record_test_class import record_total

Expand Down Expand Up @@ -86,3 +87,12 @@ def execute_action(action_list: list):
except Exception as error:
print(repr(error), file=sys.stderr)
return execute_record_string


def execute_files(execute_files_list: list):
"""
:param execute_files_list:
:return:
"""
for file in execute_files_list:
execute_action(read_action_json(file))
Empty file.
18 changes: 18 additions & 0 deletions je_auto_control/utils/file_process/get_dir_file_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from os import walk
from os import getcwd
from os.path import abspath
from os.path import join


def get_dir_files_as_list(dir_path: str = getcwd(), default_search_file_extension: str = ".json"):
"""
:param dir_path: which dir we want to walk and get file list
:param default_search_file_extension: which extension we want to search
:return: [] if nothing searched or [file1, file2.... files] file was searched
"""
return [
abspath(join(dir_path, file)) for root, dirs, files in walk(dir_path)
for file in files
if file.endswith(default_search_file_extension.lower())
]

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control",
version="0.0.85",
version="0.0.86",
author="JE-Chen",
author_email="[email protected]",
description="auto testing",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os

from je_auto_control import get_dir_files_as_list
from je_auto_control import execute_files
files_list = get_dir_files_as_list(os.getcwd() + "/test/integrated_test/get_dir_file_and_execute")
print(files_list)
if files_list is not None:
execute_files(files_list)
1 change: 1 addition & 0 deletions test/integrated_test/get_dir_file_and_execute/test1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[["type_key", {"keycode": 0}], ["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["position"], ["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]]
1 change: 1 addition & 0 deletions test/integrated_test/get_dir_file_and_execute/test2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[["type_key", {"keycode": 0}], ["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["position"], ["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]]
1 change: 1 addition & 0 deletions test/integrated_test/get_dir_file_and_execute/test3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[["type_key", {"keycode": 0}], ["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["position"], ["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]]