diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..3e36148
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,84 @@
+name: Tests (Python 3.x)
+
+on:
+ push:
+ paths:
+ - '.github/workflows/**'
+ - 'src/**'
+ - 'tests/**'
+ - 'setup.py'
+ pull_request:
+ paths:
+ - '.github/workflows/**'
+ - 'src/**'
+ - 'tests/**'
+ - 'setup.py'
+jobs:
+ test_using_builtin_python:
+
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ 'ubuntu-latest', 'windows-latest' ]
+ python-version: [ '3.6', '3.7', '3.8' ]
+ include:
+ - os: ubuntu-latest
+ set_display: export DISPLAY=:99; Xvfb :99 -screen 0 1024x768x24 -ac -noreset & sleep 3
+ #- os: macos-latest
+ #set_tmpdir: export TMPDIR=/tmp
+ - os: windows-latest
+ set_codepage: chcp 850
+
+ runs-on: ${{ matrix.os }}
+
+ name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup python ${{ matrix.python-version }} for running the tests
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+ architecture: 'x64'
+
+ # pyautogui does not work by default (https://github.com/asweigart/pyautogui/issues/247)
+ # need to disable security feature (https://apple.stackexchange.com/questions/178313/change-accessibility-setting-on-mac-using-terminal)
+ # and database is readonly (https://github.com/jacobsalmela/tccutil/issues/18)
+ # you need to disable SIP, but for that go into recovery mode and disable it - not on CI system
+ #- name: Install test tools to Mac
+ #run: |
+ #sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" 'UPDATE access SET allowed = "1";'
+ #if: runner.os == 'macOS'
+
+ - name: Install test tools to Linux
+ run: |
+ sudo apt-get update
+ sudo apt-get -y -q install xvfb scrot chromium-browser
+ touch ~/.Xauthority
+ if: contains(matrix.os, 'ubuntu')
+
+ - name: Install python test dependencies
+ run: |
+ python --version
+ python -m pip install mock robotframework opencv-python eel .
+
+ - name: Run tests
+ run: |
+ ${{ matrix.set_codepage }}
+ ${{ matrix.set_display }}
+ python tests/utest/run_tests.py
+ python tests/atest/run_tests.py
+
+ - name: Archive acceptances test results
+ uses: actions/upload-artifact@v1.0.0
+ with:
+ name: log-${{ matrix.python-version }}-${{ matrix.os }}
+ path: log.html
+ if: always() && job.status == 'failure'
+
+ - name: Archive acceptances test failure screenshot on Linux
+ uses: actions/upload-artifact@v1.0.0
+ with:
+ name: screenshot-${{ matrix.python-version }}-${{ matrix.os }}
+ path: /tmp/Atest.Calculator-screenshot-1.png
+ if: always() && job.status == 'failure' && contains(matrix.os, 'ubuntu')
diff --git a/.gitignore b/.gitignore
index f398139..df4c17f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,7 @@ log.html
*-screenshot-*.png
*\$py.class
*.swp
-*__pycache__
\ No newline at end of file
+*__pycache__
+/bin
+/include
+/lib
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 0118ab5..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: python
-python:
-- '3.6'
-- '3.7'
-- '3.8'
-before_install:
-- pip install mock
-- pip install robotframework
-script:
-- python tests/utest/run_tests.py
-notifications:
- email:
- recipients:
- - tatu.kairi@eficode.com
- - markus.suonto@eficode.com
- - matej.cotman@eficode.com
- on_success: change
- on_failure: always
- slack:
- rooms:
- - secure: "gY5UD57i1QV4X6JLaFDZoAfzgx5Li1frmnI0zfOCCYUO/UJm1WqKlWQSvp5W990dc1LV3YzRNihFCHYZ0YKsOKogd1DvIIV6rxJbn3KX8HB4EoVTqM47gqs15shgFkVohFUQ+Re8xB92Ou4zdED7tTrmZQsyFxk977Gighgj4gYXvi5r9arqAew35HZh0oZFpQMJJDKE6KOwCjw3w35NHwbsaECIamsWzE4c7/p0A3pVGnSvBor8kS8rqivoMo9cj7dACLeaWL8zftGxne9qyUColeH2jGQp8bgR30B23XrZfnmKFV6kk2oosQS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s6QbdspqwBrX4PK17TEi6HiJkSphTDF3ulMwAm8j/qoOXL9FYbeWALbfdqpMfCSQb6fJK+ZYBrzm+ISqTtsDS7IjXfuY+ZLQKfKmh2dt81ZAEncHjiNqXXV7KC2T/tyEPml2HOHAweHE/a+Plm6wztc5Z4hJbEnTOc2tOHBeq2oIXNW8syNYLdbqVPB6tXe7/pII/pwUxcoSG5qzTvlExVb3k613PX4M9r2yBt9sgkUM1wcoE/eTshHNsppdn4OCZYsqROoIa1jNCqi5O/+aX6qhXqNNDTW0z9NfWuxqo/XLJXZpgKMqB6fYwDKiWCmw1bKxcXGiu8utcy1iqkvGg9tbnnUJAyH7vZFp/DILfrZzdp0vP9SA34xyD/yVxXcVMMW+eQ1IZsFZAYKEqj+s2Hzo8wyvPVxKkBKfcwk/9hwInGWFre78Foc3Yy2y0d19haERdeyg/UPlo0A+BIThbrZaY0YoG/JoRGR5tCOCKsRQlFxV+3KF14oAZkHJjEtWW6vjHxvMYV4ks1Nkh+VZvC52ec6lqQyoBp1HfSmVPz2OpR8v4MFR4NHseciJ4oZ7uRRZ+TvN7GADnNiHYsdQ4zWXpVQMynbd0lCf4ymGDWzDZ54MsqIa6XnZLmG5xkmi4aXXJcSWBhAvjUGk0j1q+Z1V1vAdpCfwzetyeI="
- on_success: change
- on_failure: always
- on_start: never
- on_pull_requests: false
diff --git a/tests/atest/calculator.robot b/tests/atest/calculator.robot
new file mode 100755
index 0000000..5fa2636
--- /dev/null
+++ b/tests/atest/calculator.robot
@@ -0,0 +1,20 @@
+*** Settings ***
+Library ImageHorizonLibrary ${CURDIR}${/}reference_images${/}calculator screenshot_folder=${TEMPDIR}
+
+*** Test cases ***
+
+Calculator
+ Set Confidence 0.9
+ Launch application python tests/atest/calculator/calculator.py
+ ${location1}= Wait for inputs.png timeout=30
+ Click to the above of ${location1} 20
+ Type 1010
+ Click to the below of ${location1} 20
+ Type 1001
+ ${location2}= Locate or_button.png
+ Click to the below of ${location2} 0
+ Click to the below of ${location2} 50
+ ${result}= Copy
+ Should be equal as integers ${result} 1011
+ Click Image close_button.png
+ [Teardown] Terminate application
diff --git a/tests/atest/calculator/calculator.py b/tests/atest/calculator/calculator.py
new file mode 100644
index 0000000..c5743d6
--- /dev/null
+++ b/tests/atest/calculator/calculator.py
@@ -0,0 +1,16 @@
+import eel
+import os
+import sys
+
+
+os.chdir(os.path.dirname(__file__))
+
+eel.init('web')
+
+
+@eel.expose
+def close():
+ sys.exit(0)
+
+
+eel.start('main.html', size=(300, 380))
diff --git a/tests/atest/calculator/web/Roboto-Black.ttf b/tests/atest/calculator/web/Roboto-Black.ttf
new file mode 100644
index 0000000..2d45238
Binary files /dev/null and b/tests/atest/calculator/web/Roboto-Black.ttf differ
diff --git a/tests/atest/calculator/web/main.html b/tests/atest/calculator/web/main.html
new file mode 100644
index 0000000..cb61562
--- /dev/null
+++ b/tests/atest/calculator/web/main.html
@@ -0,0 +1,191 @@
+
+
+
+ Bitwise Calculator
+
+
+
+
+
+
+
+
+
+
+
+ N/A
+
+
+
+
diff --git a/tests/atest/linux_tests.robot b/tests/atest/linux_tests.robot
deleted file mode 100755
index 8cfa45e..0000000
--- a/tests/atest/linux_tests.robot
+++ /dev/null
@@ -1,18 +0,0 @@
-*** Settings ***
-Library ImageHorizonLibrary ${CURDIR}${/}reference_images${/}linux screenshot_folder=${TEMPDIR}
-Force Tags linux
-
-*** Test cases ***
-
-Calculator
- Launch application gnome-calculator
- ${location}= Wait for calculator
- Click to the above of ${location} 50
- Type 5
- Click image button plus
- Type 5
- Click image button equals
- Press combination key.ALT key.A
- ${result}= Copy
- Should be equal as integers ${result} 10
- [Teardown] Terminate application
diff --git a/tests/atest/mac_tests.robot b/tests/atest/mac_tests.robot
deleted file mode 100644
index 60c8a4e..0000000
--- a/tests/atest/mac_tests.robot
+++ /dev/null
@@ -1,56 +0,0 @@
-*** Settings ***
-Library ImageHorizonLibrary ${CURDIR}${/}reference_images${/}mac
-Force Tags mac
-
-*** Test Cases ***
-Test empty lib initialization
- No operation
-
-Test open and close application
- ${alias1}= Launch application open -a /Applications/Calculator.app
- Wait for calculator_active
- Terminate application ${alias1}
- Launch application open -a Calculator alias=My calculator
- Wait for calculator_active
- Terminate application My calculator
- Launch application open -a Calculator.app
- Wait for calculator_active
- Terminate application
-
-Test folder as reference image
- Launch application open -a Calculator alias=My calculator
- Wait for folder_calculator_active
- Terminate application My calculator
-
-Test calculator
- Launch application open -a Calculator
- Wait for calculator active
- Clear calculator
- ${button_5_pos}= Click image button 5
- Click image button plus
- Move to ${button_5_pos}
- Click
- Click image button equals
- Wait for result 10
- press combination key.command q
-
-Test click to directions
- Launch application open -a Calculator
- Wait for calculator active
- Clear calculator
- ${button_5_pos}= locate button 5
- Click to the left of ${button_5_pos} 56 clicks=2 button=left
- ... interval=0.0
- Click to the above of ${button_5_pos} 56 clicks=2 button=left
- ... interval=0.0
- Click to the right of ${button_5_pos} 56 clicks=2 button=left
- ... interval=0.0
- Click to the below of ${button_5_pos} 56 clicks=2 button=left
- ... interval=0.0
- Wait for result 44886622
- Terminate application
-
-*** Keywords ***
-Clear calculator
- Type c
-
diff --git a/tests/atest/reference_images/calculator/close_button.png b/tests/atest/reference_images/calculator/close_button.png
new file mode 100644
index 0000000..2bccd7d
Binary files /dev/null and b/tests/atest/reference_images/calculator/close_button.png differ
diff --git a/tests/atest/reference_images/calculator/inputs.png b/tests/atest/reference_images/calculator/inputs.png
new file mode 100644
index 0000000..cdce707
Binary files /dev/null and b/tests/atest/reference_images/calculator/inputs.png differ
diff --git a/tests/atest/reference_images/calculator/or_button.png b/tests/atest/reference_images/calculator/or_button.png
new file mode 100644
index 0000000..dc87def
Binary files /dev/null and b/tests/atest/reference_images/calculator/or_button.png differ
diff --git a/tests/atest/reference_images/linux/button_equals.png b/tests/atest/reference_images/linux/button_equals.png
deleted file mode 100644
index 1df7ff6..0000000
Binary files a/tests/atest/reference_images/linux/button_equals.png and /dev/null differ
diff --git a/tests/atest/reference_images/linux/button_plus.png b/tests/atest/reference_images/linux/button_plus.png
deleted file mode 100644
index 003824a..0000000
Binary files a/tests/atest/reference_images/linux/button_plus.png and /dev/null differ
diff --git a/tests/atest/reference_images/linux/calculator.png b/tests/atest/reference_images/linux/calculator.png
deleted file mode 100755
index a9bff60..0000000
Binary files a/tests/atest/reference_images/linux/calculator.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_0.png b/tests/atest/reference_images/mac/button_0.png
deleted file mode 100644
index 8082038..0000000
Binary files a/tests/atest/reference_images/mac/button_0.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_1.png b/tests/atest/reference_images/mac/button_1.png
deleted file mode 100644
index 59d0ed2..0000000
Binary files a/tests/atest/reference_images/mac/button_1.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_2.png b/tests/atest/reference_images/mac/button_2.png
deleted file mode 100644
index d97fc02..0000000
Binary files a/tests/atest/reference_images/mac/button_2.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_3.png b/tests/atest/reference_images/mac/button_3.png
deleted file mode 100644
index 2121501..0000000
Binary files a/tests/atest/reference_images/mac/button_3.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_4.png b/tests/atest/reference_images/mac/button_4.png
deleted file mode 100644
index b21ea64..0000000
Binary files a/tests/atest/reference_images/mac/button_4.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_5.png b/tests/atest/reference_images/mac/button_5.png
deleted file mode 100644
index e375b40..0000000
Binary files a/tests/atest/reference_images/mac/button_5.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_6.png b/tests/atest/reference_images/mac/button_6.png
deleted file mode 100644
index 6a304b4..0000000
Binary files a/tests/atest/reference_images/mac/button_6.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_7.png b/tests/atest/reference_images/mac/button_7.png
deleted file mode 100644
index 748a000..0000000
Binary files a/tests/atest/reference_images/mac/button_7.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_8.png b/tests/atest/reference_images/mac/button_8.png
deleted file mode 100644
index 5dd7596..0000000
Binary files a/tests/atest/reference_images/mac/button_8.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_9.png b/tests/atest/reference_images/mac/button_9.png
deleted file mode 100644
index 499b2ee..0000000
Binary files a/tests/atest/reference_images/mac/button_9.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_comma.png b/tests/atest/reference_images/mac/button_comma.png
deleted file mode 100644
index f793f46..0000000
Binary files a/tests/atest/reference_images/mac/button_comma.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_divide.png b/tests/atest/reference_images/mac/button_divide.png
deleted file mode 100644
index bc8f43f..0000000
Binary files a/tests/atest/reference_images/mac/button_divide.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_equals.png b/tests/atest/reference_images/mac/button_equals.png
deleted file mode 100644
index 7e352ba..0000000
Binary files a/tests/atest/reference_images/mac/button_equals.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_minus.png b/tests/atest/reference_images/mac/button_minus.png
deleted file mode 100644
index fc808d1..0000000
Binary files a/tests/atest/reference_images/mac/button_minus.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_multiply.png b/tests/atest/reference_images/mac/button_multiply.png
deleted file mode 100644
index 39c1825..0000000
Binary files a/tests/atest/reference_images/mac/button_multiply.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/button_plus.png b/tests/atest/reference_images/mac/button_plus.png
deleted file mode 100644
index a61bda0..0000000
Binary files a/tests/atest/reference_images/mac/button_plus.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/calculator_active.png b/tests/atest/reference_images/mac/calculator_active.png
deleted file mode 100644
index 5064d16..0000000
Binary files a/tests/atest/reference_images/mac/calculator_active.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/folder_calculator_active/doge.png b/tests/atest/reference_images/mac/folder_calculator_active/doge.png
deleted file mode 100644
index d8d36ad..0000000
Binary files a/tests/atest/reference_images/mac/folder_calculator_active/doge.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/folder_calculator_active/the_real_calculator.png b/tests/atest/reference_images/mac/folder_calculator_active/the_real_calculator.png
deleted file mode 100644
index 5064d16..0000000
Binary files a/tests/atest/reference_images/mac/folder_calculator_active/the_real_calculator.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/result_10.png b/tests/atest/reference_images/mac/result_10.png
deleted file mode 100644
index ce31054..0000000
Binary files a/tests/atest/reference_images/mac/result_10.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/result_44886622.png b/tests/atest/reference_images/mac/result_44886622.png
deleted file mode 100644
index bd5e934..0000000
Binary files a/tests/atest/reference_images/mac/result_44886622.png and /dev/null differ
diff --git a/tests/atest/reference_images/mac/spotlight.png b/tests/atest/reference_images/mac/spotlight.png
deleted file mode 100644
index a3f9154..0000000
Binary files a/tests/atest/reference_images/mac/spotlight.png and /dev/null differ
diff --git a/tests/atest/reference_images/win/Start.png b/tests/atest/reference_images/win/Start.png
deleted file mode 100644
index ad8be6e..0000000
Binary files a/tests/atest/reference_images/win/Start.png and /dev/null differ
diff --git a/tests/atest/reference_images/win/calculator_active.PNG b/tests/atest/reference_images/win/calculator_active.PNG
deleted file mode 100644
index a127beb..0000000
Binary files a/tests/atest/reference_images/win/calculator_active.PNG and /dev/null differ
diff --git a/tests/atest/reference_images/win/notepad_active.PNG b/tests/atest/reference_images/win/notepad_active.PNG
deleted file mode 100644
index a0b3337..0000000
Binary files a/tests/atest/reference_images/win/notepad_active.PNG and /dev/null differ
diff --git a/tests/atest/run_tests.py b/tests/atest/run_tests.py
index f198e39..b56d3e3 100755
--- a/tests/atest/run_tests.py
+++ b/tests/atest/run_tests.py
@@ -2,21 +2,8 @@
# -*- coding: utf-8 -*-
import sys
-
-from os.path import abspath, dirname, join as path_join
+import os
from robot import run_cli
-if __name__ == '__main__':
- curdir = abspath(dirname(__file__))
- sys.path.insert(1, abspath(path_join(curdir, '..', '..', 'src')))
- from ImageHorizonLibrary.utils import *
-
- if is_windows():
- tag = 'windows'
- elif is_mac():
- tag = 'mac'
- elif is_linux():
- tag = 'linux'
-
-run_cli(sys.argv[1:] + ['--include', tag, '.'])
+run_cli(sys.argv[1:] + [os.path.dirname(__file__)])
diff --git a/tests/atest/windows_tests.robot b/tests/atest/windows_tests.robot
deleted file mode 100644
index 9bbecf3..0000000
--- a/tests/atest/windows_tests.robot
+++ /dev/null
@@ -1,25 +0,0 @@
-*** Settings ***
-Library ImageHorizonLibrary ${CURDIR}${/}reference_images${/}win screenshot_folder=${TEMPDIR}
-Force Tags windows
-
-*** Test Cases ***
-Test open application
- Launch application Calc.exe
- Wait for calculator active 8
- Press combination key.alt key.f4
- [Teardown] Terminate application
-
-Test notepad with images
- Type Key.WIN notepad Key.enter interval=0.1
- Wait for notepad active
- Type I love ImageHorizonLibrary key.enter
- Type with keys down shift makes me shout key.shift
- ... pause=0.1 interval=0.05
- Press combination KEY.CTRL a
- ${retval}= Copy
- Should be equal as strings ${retval}
- ... I love ImageHorizonLibrary\nSHIFT MAKES ME SHOUT
- Type key.Enter
- Press combination Key.ctrl V
- Press combination key.alt key.F4
- Type key.right key.enter