From 81a9afcd08d1138b44e01ce8d2d452563857b614 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 02:44:16 +0800 Subject: [PATCH 01/13] test add github workflow test add github workflow --- .../workflows/auto-control-github-actions.yml | 28 +++++++++++++++++++ .idea/workspace.xml | 24 +++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/auto-control-github-actions.yml diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions.yml new file mode 100644 index 0000000..6cd51a4 --- /dev/null +++ b/.github/workflows/auto-control-github-actions.yml @@ -0,0 +1,28 @@ +name: Python application + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + +permissions: + contents: read + +jobs: + build: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.5 + uses: actions/setup-python@v3 + with: + python-version: "3.5" + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + if [ -f dev_requirements.txt ]; then pip install -r dev_requirements.txt; fi + # screen test + - name: screen_test + run: python ./test/unit_test/screen/screen_test.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d086363..8c1156e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,9 @@ - + + + - { - "keyToString": { - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "last_opened_file_path": "C:/program_workspace/python/Integration-testing-environment", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" + +}]]> @@ -401,6 +403,8 @@ + + From 2c14a1ea787aa283ca99efc5bad657ed9bf581bb Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 02:50:13 +0800 Subject: [PATCH 02/13] fix github workflow test fix github workflow test --- .github/workflows/auto-control-github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions.yml index 6cd51a4..90ae2e4 100644 --- a/.github/workflows/auto-control-github-actions.yml +++ b/.github/workflows/auto-control-github-actions.yml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel - if [ -f dev_requirements.txt ]; then pip install -r dev_requirements.txt; fi + pip install -r dev_requirements.txt # screen test - name: screen_test run: python ./test/unit_test/screen/screen_test.py From a69305d68b0456d4eb0d8cf7f8af2617222cbc96 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 03:18:11 +0800 Subject: [PATCH 03/13] update dev workflow update dev workflow --- .../workflows/auto-control-github-actions.yml | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions.yml index 90ae2e4..333635f 100644 --- a/.github/workflows/auto-control-github-actions.yml +++ b/.github/workflows/auto-control-github-actions.yml @@ -10,7 +10,7 @@ permissions: contents: read jobs: - build: + build_dev_version: runs-on: windows-2019 steps: @@ -26,3 +26,47 @@ jobs: # screen test - name: screen_test run: python ./test/unit_test/screen/screen_test.py + - name: screenshot_test + run: python ./test/unit_test/screen/screenshot_test.py + # keyboard test + - name: keyboard_type_test + run: python ./test/unit_test/keyboard/keyboard_type_test.py + - name: keyboard_write_test + run: python ./test/unit_test/keyboard/keyboard_write_test.py + - name: keyboard_is_press_test + run: python ./test/unit_test/keyboard/keyboard_is_press_test.py + - name: hotkey_test + run: python ./test/unit_test/keyboard/hotkey_test.py + # mouse test + - name: mouse_test + run: python ./test/unit_test/mouse/mouse_test.py + - name: scroll_test + run: python ./test/unit_test/exception/auto_control_exception_test.py + # exception test + - name: auto_control_exception_test + run: python ./test/unit_test/exception/auto_control_exception_test.py + # critical exit + - name: critical_exit_test + run: python ./test/unit_test/critical_exit/critical_exit_test.py + - name: real_critical_test + run: python ./test/unit_test/critical_exit/real_critical_test.py + # test_record + - name: record_test + run: python ./test/unit_test/record/record_test.py + - name: total record + run: python ./test/unit_test/total_record/total_record_test.py + # execute + - name: execute_action_test + run: python ./test/unit_test/execute_action/execute_action_test.py + # json + - name: json_test + run: python ./test/unit_test/json/json_test.py + # timeout + - name: timeout_test + run: python ./test/unit_test/timeout/timeout_test.py + # argparse + - name: argparse_test + run: python ./test/unit_test/argparse/argparse_test.py + # html report test + - name: html_report_test + run: python ./test/unit_test/html_report/html_report_test.py \ No newline at end of file From d0fa6a0308e100fcc1df9d11fde5bae36a7a505b Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 03:27:46 +0800 Subject: [PATCH 04/13] test fix test return make console error test fix test return make console error --- test/unit_test/keyboard/keyboard_write_test.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 5c2e8f7..d52c989 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -9,15 +9,10 @@ press_key("shift") write("123456789") -press_key("return") -release_key("return") assert (write("abcdefghijklmnopqrstuvwxyz") == "abcdefghijklmnopqrstuvwxyz") release_key("shift") -press_key("return") -release_key("return") assert (write("abcdefghijklmnopqrstuvwxyz") == "abcdefghijklmnopqrstuvwxyz") -press_key("return") -release_key("return") + """ this write will print one error -> keyboard write error can't find key : Ѓ and write remain string """ From 64c108c9956d91804ff6e8b4063fc6b5994adc1c Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 03:36:20 +0800 Subject: [PATCH 05/13] Update keyboard_write_test.py --- test/unit_test/keyboard/keyboard_write_test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index d52c989..250a4f8 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -9,19 +9,18 @@ press_key("shift") write("123456789") -assert (write("abcdefghijklmnopqrstuvwxyz") == "abcdefghijklmnopqrstuvwxyz") +write("abcdefghijklmnopqrstuvwxyz") release_key("shift") -assert (write("abcdefghijklmnopqrstuvwxyz") == "abcdefghijklmnopqrstuvwxyz") +write("abcdefghijklmnopqrstuvwxyz") """ this write will print one error -> keyboard write error can't find key : Ѓ and write remain string """ try: - assert (write("Ѓ123456789") == "123456789") + write("Ѓ123456789") except Exception as error: print(repr(error), file=sys.stderr) try: write("!#@L@#{@#PL#{!@#L{!#{|##PO}!@#O@!O#P!)KI#O_!K") except Exception as error: print(repr(error), file=sys.stderr) - From 81e81d911fa10ff46d29f155072d533eaffae6a6 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 17:22:17 +0800 Subject: [PATCH 06/13] Update keyboard_write_test.py --- test/unit_test/keyboard/keyboard_write_test.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 250a4f8..9644147 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -19,8 +19,4 @@ try: write("Ѓ123456789") except Exception as error: - print(repr(error), file=sys.stderr) -try: - write("!#@L@#{@#PL#{!@#L{!#{|##PO}!@#O@!O#P!)KI#O_!K") -except Exception as error: - print(repr(error), file=sys.stderr) + print(repr(error), file=sys.stderr) \ No newline at end of file From 3ac95399cc483117f631de2c5ee6ee782a064c20 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 17:28:41 +0800 Subject: [PATCH 07/13] test test --- .github/workflows/auto-control-github-actions.yml | 4 +++- test/unit_test/keyboard/keyboard_write_test.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions.yml index 333635f..91fb5dd 100644 --- a/.github/workflows/auto-control-github-actions.yml +++ b/.github/workflows/auto-control-github-actions.yml @@ -32,7 +32,9 @@ jobs: - name: keyboard_type_test run: python ./test/unit_test/keyboard/keyboard_type_test.py - name: keyboard_write_test - run: python ./test/unit_test/keyboard/keyboard_write_test.py + run: | + python ./test/unit_test/keyboard/keyboard_write_test.py + exit 0 - name: keyboard_is_press_test run: python ./test/unit_test/keyboard/keyboard_is_press_test.py - name: hotkey_test diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 9644147..250a4f8 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -19,4 +19,8 @@ try: write("Ѓ123456789") except Exception as error: - print(repr(error), file=sys.stderr) \ No newline at end of file + print(repr(error), file=sys.stderr) +try: + write("!#@L@#{@#PL#{!@#L{!#{|##PO}!@#O@!O#P!)KI#O_!K") +except Exception as error: + print(repr(error), file=sys.stderr) From 8e42dfb27175cbb6096c8c56e18ec899645243fc Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 19:14:45 +0800 Subject: [PATCH 08/13] test test --- test/unit_test/keyboard/keyboard_write_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 250a4f8..74cb0c0 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -3,6 +3,7 @@ from je_auto_control import keys_table from je_auto_control import press_key from je_auto_control import release_key +from je_auto_control import type_key from je_auto_control import write print(keys_table.keys()) @@ -24,3 +25,9 @@ write("!#@L@#{@#PL#{!@#L{!#{|##PO}!@#O@!O#P!)KI#O_!K") except Exception as error: print(repr(error), file=sys.stderr) +if sys.platform in ["win32", "cygwin"]: + for i in range(61): + type_key("back") +else: + for i in range(61): + type_key("backspace") From 06b5b1fda1d0202fd58730da5ea477dfb8b97912 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 19:31:12 +0800 Subject: [PATCH 09/13] Update keyboard_write_test.py --- test/unit_test/keyboard/keyboard_write_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 74cb0c0..c006aa9 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -31,3 +31,4 @@ else: for i in range(61): type_key("backspace") +type_key("return") From f01d87f9a272d554aeed1cfda8b6e2e2392565dd Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 21:12:24 +0800 Subject: [PATCH 10/13] Update keyboard_write_test.py --- .../unit_test/keyboard/keyboard_write_test.py | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index c006aa9..3602dab 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -3,32 +3,20 @@ from je_auto_control import keys_table from je_auto_control import press_key from je_auto_control import release_key -from je_auto_control import type_key from je_auto_control import write print(keys_table.keys()) press_key("shift") -write("123456789") -write("abcdefghijklmnopqrstuvwxyz") +print(write("123456789")) +print(write("abcdefghijklmnopqrstuvwxyz")) release_key("shift") -write("abcdefghijklmnopqrstuvwxyz") +print(write("abcdefghijklmnopqrstuvwxyz")) """ this write will print one error -> keyboard write error can't find key : Ѓ and write remain string """ try: - write("Ѓ123456789") + print(write("Ѓ123456789")) except Exception as error: print(repr(error), file=sys.stderr) -try: - write("!#@L@#{@#PL#{!@#L{!#{|##PO}!@#O@!O#P!)KI#O_!K") -except Exception as error: - print(repr(error), file=sys.stderr) -if sys.platform in ["win32", "cygwin"]: - for i in range(61): - type_key("back") -else: - for i in range(61): - type_key("backspace") -type_key("return") From 67d500eb211d7c747e5691756889ac049a93d118 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 21:22:38 +0800 Subject: [PATCH 11/13] test --- .github/workflows/auto-control-github-actions.yml | 1 - .../total_record_and_html_report_test.py | 1 + test/unit_test/keyboard/keyboard_write_test.py | 1 + test/unit_test/total_record/total_record_test.py | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions.yml index 91fb5dd..dd9684e 100644 --- a/.github/workflows/auto-control-github-actions.yml +++ b/.github/workflows/auto-control-github-actions.yml @@ -34,7 +34,6 @@ jobs: - name: keyboard_write_test run: | python ./test/unit_test/keyboard/keyboard_write_test.py - exit 0 - name: keyboard_is_press_test run: python ./test/unit_test/keyboard/keyboard_is_press_test.py - name: hotkey_test diff --git a/test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py b/test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py index 148a8e2..f51b3e9 100644 --- a/test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py +++ b/test/integrated_test/total_record_and_html_report_test/total_record_and_html_report_test.py @@ -32,5 +32,6 @@ # html name is test.html and this html will recode all test detail # if test_record.init_total_record = True generate_html("test") + sys.exit(0) except Exception as error: print(repr(error), file=sys.stderr) diff --git a/test/unit_test/keyboard/keyboard_write_test.py b/test/unit_test/keyboard/keyboard_write_test.py index 3602dab..ac8cb08 100644 --- a/test/unit_test/keyboard/keyboard_write_test.py +++ b/test/unit_test/keyboard/keyboard_write_test.py @@ -20,3 +20,4 @@ print(write("Ѓ123456789")) except Exception as error: print(repr(error), file=sys.stderr) +sys.exit(0) diff --git a/test/unit_test/total_record/total_record_test.py b/test/unit_test/total_record/total_record_test.py index 6be1b7d..cf22aa9 100644 --- a/test/unit_test/total_record/total_record_test.py +++ b/test/unit_test/total_record/total_record_test.py @@ -29,3 +29,4 @@ print(test_record_instance.test_record_list) except Exception as error: print(repr(error), file=sys.stderr) +sys.exit(0) \ No newline at end of file From b93d9cf305c118ca335ca3697fa6df7f9845d352 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 21:36:06 +0800 Subject: [PATCH 12/13] test test --- test/unit_test/keyboard/keyboard_type_test.py | 10 ---------- test/unit_test/total_record/total_record_test.py | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/test/unit_test/keyboard/keyboard_type_test.py b/test/unit_test/keyboard/keyboard_type_test.py index ab940c4..31a8152 100644 --- a/test/unit_test/keyboard/keyboard_type_test.py +++ b/test/unit_test/keyboard/keyboard_type_test.py @@ -15,14 +15,4 @@ assert (type_key("S") == "S") assert (type_key("T") == "T") -try: - type_key("dwadawddwadaw") -except AutoControlKeyboardException as error: - print(repr(error), file=sys.stderr) -# no error system will catch it but may make some system error -# you can try to reconnect usb -type_key(-1) -type_key(18919819819165161616161651651651651231231) -press_key(1616516516516516516515) -release_key(15616516516511) diff --git a/test/unit_test/total_record/total_record_test.py b/test/unit_test/total_record/total_record_test.py index cf22aa9..04cc443 100644 --- a/test/unit_test/total_record/total_record_test.py +++ b/test/unit_test/total_record/total_record_test.py @@ -29,4 +29,4 @@ print(test_record_instance.test_record_list) except Exception as error: print(repr(error), file=sys.stderr) -sys.exit(0) \ No newline at end of file +sys.exit(0) From 6f620fd6e2117b488aa131976d4ab2707b772d28 Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Mon, 20 Jun 2022 23:21:43 +0800 Subject: [PATCH 13/13] add stable version workflow add stable version workflow --- ...ml => auto-control-github-actions_dev.yml} | 0 .../auto-control-github-actions_stable.yml | 73 +++++++++++++++++++ 2 files changed, 73 insertions(+) rename .github/workflows/{auto-control-github-actions.yml => auto-control-github-actions_dev.yml} (100%) create mode 100644 .github/workflows/auto-control-github-actions_stable.yml diff --git a/.github/workflows/auto-control-github-actions.yml b/.github/workflows/auto-control-github-actions_dev.yml similarity index 100% rename from .github/workflows/auto-control-github-actions.yml rename to .github/workflows/auto-control-github-actions_dev.yml diff --git a/.github/workflows/auto-control-github-actions_stable.yml b/.github/workflows/auto-control-github-actions_stable.yml new file mode 100644 index 0000000..32cd62c --- /dev/null +++ b/.github/workflows/auto-control-github-actions_stable.yml @@ -0,0 +1,73 @@ +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build_dev_version: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.5 + uses: actions/setup-python@v3 + with: + python-version: "3.5" + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + pip install -r requirements.txt + # screen test + - name: screen_test + run: python ./test/unit_test/screen/screen_test.py + - name: screenshot_test + run: python ./test/unit_test/screen/screenshot_test.py + # keyboard test + - name: keyboard_type_test + run: python ./test/unit_test/keyboard/keyboard_type_test.py + - name: keyboard_write_test + run: | + python ./test/unit_test/keyboard/keyboard_write_test.py + - name: keyboard_is_press_test + run: python ./test/unit_test/keyboard/keyboard_is_press_test.py + - name: hotkey_test + run: python ./test/unit_test/keyboard/hotkey_test.py + # mouse test + - name: mouse_test + run: python ./test/unit_test/mouse/mouse_test.py + - name: scroll_test + run: python ./test/unit_test/exception/auto_control_exception_test.py + # exception test + - name: auto_control_exception_test + run: python ./test/unit_test/exception/auto_control_exception_test.py + # critical exit + - name: critical_exit_test + run: python ./test/unit_test/critical_exit/critical_exit_test.py + - name: real_critical_test + run: python ./test/unit_test/critical_exit/real_critical_test.py + # test_record + - name: record_test + run: python ./test/unit_test/record/record_test.py + - name: total record + run: python ./test/unit_test/total_record/total_record_test.py + # execute + - name: execute_action_test + run: python ./test/unit_test/execute_action/execute_action_test.py + # json + - name: json_test + run: python ./test/unit_test/json/json_test.py + # timeout + - name: timeout_test + run: python ./test/unit_test/timeout/timeout_test.py + # argparse + - name: argparse_test + run: python ./test/unit_test/argparse/argparse_test.py + # html report test + - name: html_report_test + run: python ./test/unit_test/html_report/html_report_test.py \ No newline at end of file