-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: cseptimo <clarissa.septimo@analog.com> perform action based on the dound screen then screenshot then assert Signed-off-by: cseptimo <clarissa.septimo@analog.com> added attribute or method get_window_position Signed-off-by: cseptimo <clarissa.septimo@analog.com>
- Loading branch information
Showing
25 changed files
with
307 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import re | ||
import setuptools | ||
|
||
def _get_version(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import pytest | ||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--remote", | ||
action="store_true", | ||
help="Run test on network mode", | ||
) | ||
|
||
parser.addoption( | ||
"--local", | ||
action="store_true", | ||
help="Run test on local mode", | ||
) | ||
|
||
parser.addoption( | ||
"--ip", | ||
action="store", | ||
default="localhost", | ||
help="IP of DUT", | ||
) | ||
|
||
parser.addoption( | ||
"--delay", | ||
action="store", | ||
type=int, | ||
default=10, | ||
help="adding delay", | ||
) | ||
|
||
def pytest_configure(config): | ||
# register marker | ||
config.addinivalue_line("markers", "remote: mark remote tests") | ||
config.addinivalue_line("markers", "local: mark local tests") | ||
|
||
|
||
def pytest_runtest_setup(item): | ||
remote = item.config.getoption("--remote") | ||
marks = [mark.name for mark in item.iter_markers()] | ||
if not remote and "remote" in marks: | ||
pytest.skip( | ||
"Testing requires network flag: --remote" | ||
) | ||
|
||
local = item.config.getoption("--local") | ||
marks = [mark.name for mark in item.iter_markers()] | ||
if not local and "local" in marks: | ||
pytest.skip( | ||
"Testing requires local flag: --local" | ||
) | ||
|
||
@pytest.fixture(scope="session") | ||
def ip(pytestconfig): | ||
return pytestconfig.getoption("ip") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def delay(pytestconfig): | ||
return pytestconfig.getoption("delay") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import pytest | ||
import pyguit | ||
import time | ||
import os | ||
import shutil | ||
|
||
class TestDiagnostic: | ||
|
||
@classmethod | ||
def setup_class(self): | ||
'''Setup the pyguit object. Will be called once before the start of test''' | ||
self.gui = pyguit.gui() | ||
self.gui.attach_openbox() | ||
# self.gui.run_ssh_agent() | ||
time.sleep(10) | ||
try: | ||
os.makedirs("results") | ||
except FileExistsError: | ||
# directory already exists | ||
shutil.rmtree('results') | ||
os.makedirs("results") | ||
|
||
@classmethod | ||
def teardown_class(self): | ||
'''Garbage collector. Will be called once after running of tests''' | ||
time.sleep(10) | ||
self.gui.dettach_openbox() | ||
del self.gui | ||
|
||
@pytest.mark.remote | ||
def test_open_app_terminal_on_remote(self, ip, delay): | ||
'''Test if app opens, and checks main window''' | ||
self.gui.open_app( | ||
host=ip, | ||
user="analog", | ||
app_name="adi_diagnostic_report", | ||
path="/usr/local/bin/adi_diagnostic_report --gui") | ||
time.sleep(delay) | ||
print("Test build: Check application title") | ||
# Find main screen | ||
found_window = None | ||
for w in self.gui.get_open_windows(): | ||
if w: | ||
print(self.gui.get_window_title(w)) | ||
print("Test build: Check application title") | ||
#Find main screen | ||
found_window = None | ||
for w in self.gui.get_open_windows(): | ||
if w: | ||
print(self.gui.get_window_title(w)) | ||
time.sleep(delay) | ||
self.gui.find_window("Generate Diagnostic Report") | ||
print("Test build: Done main window") | ||
time.sleep(delay) | ||
# assert self.gui.controller.locateOnScreen("ref_test_open_diagnostic.png", grayscale=True, confidence=0.9) | ||
assert self.gui.controller.locateOnScreen("ref_test_open_app_rpi.png", grayscale=True, confidence=0.9) | ||
self.gui.controller.screenshot("results/test_open_diagnostic.png") | ||
time.sleep(5) | ||
|
||
#click functons | ||
noneBtn = self.gui.controller.locateCenterOnScreen("ref_test_click_none_button.png", grayscale=True, confidence=0.9) | ||
assert noneBtn | ||
self.gui.controller.click(noneBtn) | ||
time.sleep(5) | ||
self.gui.controller.screenshot("results/test_click_none_button.png") | ||
print("Test build: Done None button") | ||
time.sleep(delay) | ||
analogItem = self.gui.controller.locateCenterOnScreen("ref_test_click_analog_item.png", grayscale=True, confidence=0.9) | ||
assert analogItem | ||
self.gui.controller.click(analogItem) | ||
time.sleep(5) | ||
self.gui.controller.screenshot("results/test_click_analog.png") | ||
print("Test build: Done analog item") | ||
generateBtn = self.gui.controller.locateCenterOnScreen("ref_test_click_generate_button.png", grayscale=True, confidence=0.9) | ||
assert generateBtn | ||
self.gui.controller.click(generateBtn) | ||
time.sleep(5) | ||
self.gui.controller.screenshot("results/test_generate_button.png") | ||
print("Test build: Done Generate button") | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added
BIN
+25.7 KB
test/iio-oscilloscope/ref_test_open_adi_iio_oscilloscope-capture1_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+48.8 KB
test/iio-oscilloscope/results/test_open_adi_iio_oscilloscope-capture1_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import pytest | ||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--remote", | ||
action="store_true", | ||
help="Run test on network mode", | ||
) | ||
|
||
parser.addoption( | ||
"--local", | ||
action="store_true", | ||
help="Run test on local mode", | ||
) | ||
|
||
parser.addoption( | ||
"--ip", | ||
action="store", | ||
default="localhost", | ||
help="IP of DUT", | ||
) | ||
|
||
parser.addoption( | ||
"--delay", | ||
action="store", | ||
type=int, | ||
default=10, | ||
help="adding delay", | ||
) | ||
|
||
|
||
def pytest_configure(config): | ||
# register marker | ||
config.addinivalue_line("markers", "remote: mark remote tests") | ||
config.addinivalue_line("markers", "local: mark local tests") | ||
|
||
|
||
def pytest_runtest_setup(item): | ||
remote = item.config.getoption("--remote") | ||
marks = [mark.name for mark in item.iter_markers()] | ||
if not remote and "remote" in marks: | ||
pytest.skip( | ||
"Testing requires network flag: --remote" | ||
) | ||
|
||
local = item.config.getoption("--local") | ||
marks = [mark.name for mark in item.iter_markers()] | ||
if not local and "local" in marks: | ||
pytest.skip( | ||
"Testing requires local flag: --local" | ||
) | ||
|
||
@pytest.fixture(scope="session") | ||
def ip(pytestconfig): | ||
return pytestconfig.getoption("ip") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def delay(pytestconfig): | ||
return pytestconfig.getoption("delay") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import pytest | ||
import pyguit | ||
import time | ||
import os | ||
import shutil | ||
|
||
class TestScopy: | ||
|
||
@classmethod | ||
def setup_class(self): | ||
'''Setup the pyguit object. Will be called once before the start of test''' | ||
self.gui = pyguit.gui() | ||
self.gui.attach_openbox() | ||
# self.gui.run_ssh_agent() | ||
time.sleep(10) | ||
try: | ||
os.makedirs("results") | ||
except FileExistsError: | ||
# directory already exists | ||
shutil.rmtree('results') | ||
os.makedirs("results") | ||
|
||
@classmethod | ||
def teardown_class(self): | ||
'''Garbage collector. Will be called once after running of tests''' | ||
time.sleep(10) | ||
self.gui.dettach_openbox() | ||
del self.gui | ||
|
||
@pytest.mark.remote | ||
def test_open_app_on_remote(self, ip, delay): | ||
'''Test if app opens, and checks main window''' | ||
self.gui.open_app( | ||
host=ip, | ||
user="analog", | ||
app_name="flatpak", | ||
path="/usr/bin/flatpak", | ||
) | ||
time.sleep(delay) | ||
# print("Test build: Check application title") **commented this first** | ||
# Find main screen | ||
# found_window = None | ||
# for w in self.gui.get_open_windows(): | ||
# if w: | ||
# print(self.gui.get_window_title(w)) | ||
# print(self.gui.get_window_title(w)) | ||
# time.sleep(delay) | ||
|
||
|