Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 1f9c1d8

Browse files
author
Serhii Khalymon
committed
Update tests configuration
1 parent a88698a commit 1f9c1d8

File tree

7 files changed

+66
-35
lines changed

7 files changed

+66
-35
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ addons:
1010
language: python
1111
python:
1212
- 2.7
13+
- 3.4
1314
- 3.5
1415
- 3.6
1516
env:

tests/conftest.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ def eyes(request):
5555

5656

5757
@pytest.fixture(scope="function")
58-
def eyes_session(request, eyes, driver):
58+
def eyes_open(request, eyes, driver):
5959
test_page_url = request.node.get_closest_marker('test_page_url').args[-1]
60-
viewport_size = request.node.get_closest_marker('viewport_size').args[-1]
61-
test_suite_name = request.node.get_closest_marker('test_suite_name').args[-1]
60+
61+
viewport_size = request.node.get_closest_marker('viewport_size')
62+
viewport_size = viewport_size.args[-1] if viewport_size else None
63+
64+
test_suite_name = request.node.get_closest_marker('test_suite_name')
65+
test_suite_name = test_suite_name.args[-1] if test_suite_name else 'Python SDK'
66+
6267
# use camel case in method name for fit java sdk tests name
6368
test_name = request.function.__name__.title().replace('_', '')
6469

@@ -68,19 +73,24 @@ def eyes_session(request, eyes, driver):
6873
driver = eyes.open(driver, test_suite_name, test_name,
6974
viewport_size=viewport_size)
7075
driver.get(test_page_url)
76+
yield eyes, driver
77+
results = eyes.close()
78+
print(results)
7179

80+
81+
@pytest.fixture(scope="function")
82+
def eyes_for_class(request, eyes_open):
7283
# TODO: implement eyes.setDebugScreenshotsPrefix("Java_" + testName + "_");
7384

85+
eyes, driver = eyes_open
7486
request.cls.eyes = eyes
7587
request.cls.driver = driver
7688

7789
yield
78-
results = eyes.close()
79-
print(results)
8090

8191

8292
@pytest.fixture(scope="function")
83-
def driver_session(request, driver):
93+
def driver_for_class(request, driver):
8494
test_page_url = request.node.get_closest_marker('test_page_url').args[0]
8595
viewport_size = request.node.get_closest_marker('viewport_size').args[0]
8696

@@ -140,9 +150,9 @@ def pytest_addoption(parser):
140150
def _get_capabilities(platform_name=None, browser_name=None, headless=False):
141151
if platform_name is None:
142152
sys2platform_name = {
143-
'linux': 'Linux',
153+
'linux': 'Linux',
144154
'darwin': 'macOS 10.13',
145-
'win32': 'Windows 10'
155+
'win32': 'Windows 10'
146156
}
147157
platform_name = sys2platform_name[sys.platform]
148158
platform = SUPPORTED_PLATFORMS_DICT[platform_name]

tests/platfroms.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,28 @@ def full_name(self):
8585
"deviceName": "Iphone Emulator",
8686
"deviceOrientation": "portrait",
8787
"browserName": "Safari",
88+
"newCommandTimeout": 60 * 5
8889
}),
8990
Platform(name='Android', version='6.0', browsers=[], extra={
90-
"appiumVersion": "1.9.1",
91-
"deviceName": "Android Emulator",
92-
"deviceOrientation": "portrait",
93-
"browserName": "Chrome",
91+
"appiumVersion": "1.9.1",
92+
"deviceName": "Android Emulator",
93+
"deviceOrientation": "portrait",
94+
"browserName": "Chrome",
95+
"newCommandTimeout": 60 * 5
9496
}),
9597
Platform(name='Android', version='7.0', browsers=[], extra={
96-
"appiumVersion": "1.9.1",
97-
"deviceName": "Android Emulator",
98-
"deviceOrientation": "portrait",
99-
"browserName": "Chrome",
98+
"appiumVersion": "1.9.1",
99+
"deviceName": "Android Emulator",
100+
"deviceOrientation": "portrait",
101+
"browserName": "Chrome",
102+
"newCommandTimeout": 60 * 5
100103
}),
101104
Platform(name='Android', version='8.0', browsers=[], extra={
102105
"appiumVersion": "1.9.1",
103106
"deviceName": "Samsung S9+",
104107
"deviceOrientation": "portrait",
105108
"browserName": "Chrome",
109+
"newCommandTimeout": 60 * 5
106110
})
107111
]
108112
SUPPORTED_PLATFORMS_DICT = {platform.full_name: platform for platform in SUPPORTED_PLATFORMS}

tests/selenium/test_appium.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,31 @@ def test_android_native(eyes, driver):
1717

1818
@pytest.mark.mobile
1919
@pytest.mark.platform('Android')
20-
@pytest.mark.eyes(hide_scrollbars=False)
21-
def test_final_application_android(eyes, driver):
22-
driver = eyes.open(driver, "sample2", "titleicon5")
23-
driver.get("http://applitools.com")
20+
@pytest.mark.parametrize('eyes', [
21+
{'force_full_page_screenshot': True, 'hide_scrollbars': False},
22+
{'force_full_page_screenshot': False, 'hide_scrollbars': False},
23+
],
24+
indirect=True,
25+
ids=lambda o: "with FSP" if o['force_full_page_screenshot'] else "no FSP")
26+
@pytest.mark.test_page_url('http://applitools.com')
27+
def test_final_application_android(eyes_open):
28+
eyes, driver = eyes_open
2429
eyes.check_window("test2")
2530
btn_element = driver.find_element_by_css_selector('button')
2631
eyes.check_region_by_element(btn_element, stitch_content=True)
27-
eyes.close()
2832

2933

3034
@pytest.mark.mobile
3135
@pytest.mark.platform('iPhone')
32-
@pytest.mark.eyes(hide_scrollbars=False)
33-
def test_final_application_ios(eyes, driver):
34-
driver = eyes.open(driver, "sample", "IOS")
35-
driver.get("http://applitools.com")
36+
@pytest.mark.parametrize('eyes', [
37+
{'force_full_page_screenshot': True, 'hide_scrollbars': False},
38+
{'force_full_page_screenshot': False, 'hide_scrollbars': False},
39+
],
40+
indirect=True,
41+
ids=lambda o: "with FSP" if o['force_full_page_screenshot'] else "no FSP")
42+
@pytest.mark.test_page_url('http://applitools.com')
43+
def test_final_application_ios(eyes_open):
44+
eyes, driver = eyes_open
3645
eyes.check_window()
3746
btn_element = driver.find_element_by_css_selector('button')
3847
eyes.check_region_by_element(btn_element, stitch_content=True)
39-
eyes.close()

tests/selenium/test_dom_capture.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from applitools.selenium.capture import dom_capture
1111

1212

13-
@pytest.mark.usefixtures('driver_session')
13+
@pytest.mark.usefixtures('driver_for_class')
1414
@pytest.mark.browser('chrome')
1515
@pytest.mark.platform('Linux')
1616
@pytest.mark.viewport_size({'width': 800, 'height': 600})
@@ -88,7 +88,7 @@ def test_send_dom_nsa(self):
8888
assert inner_css(dom_json) == inner_css(expected_json)
8989

9090

91-
@pytest.mark.usefixtures("eyes_session")
91+
@pytest.mark.usefixtures("eyes_for_class")
9292
@pytest.mark.test_suite_name('Eyes Selenium SDK - DynamicPages')
9393
@pytest.mark.viewport_size({'width': 1200, 'height': 800})
9494
@pytest.mark.skip("Only for local testing because changes always")
@@ -121,7 +121,7 @@ def test_bestbuy(self):
121121
self.eyes.check_window("BestBuy Test")
122122

123123

124-
@pytest.mark.usefixtures("eyes_session")
124+
@pytest.mark.usefixtures("eyes_for_class")
125125
@pytest.mark.test_suite_name('Eyes Selenium SDK - CustomersPages')
126126
@pytest.mark.viewport_size({'width': 1200, 'height': 800})
127127
@pytest.mark.skip("Only for local testing because changes always")

tests/selenium/test_main_use_flows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
@pytest.mark.platform('Linux', 'Windows', 'macOS')
9-
@pytest.mark.usefixtures("eyes_session")
9+
@pytest.mark.usefixtures("eyes_for_class")
1010
@pytest.mark.parametrize('eyes', [
1111
{'force_full_page_screenshot': True},
1212
{'force_full_page_screenshot': False},

tox.ini

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
[tox]
2-
envlist = lint,py27,py34,py35,py36
2+
envlist = lint,selenium,appium
33
skip_missing_interpreters = true
44

55
[travis]
66
python =
7-
2.7: py27
8-
3.5: py35
9-
3.6: lint
7+
2.7: selenium
8+
3.5: selenium
9+
3.4: appium
10+
3.6: lint
1011

1112
[testenv]
1213
description = run linux chrome tests with pytest under {basepython}
1314
passenv = SAUCE_USERNAME SAUCE_ACCESS_KEY APPLITOOLS_API_KEY SELENIUM_SERVER_URL TOXENV CI DISPLAY TRAVIS TRAVIS_* APPLITOOLS_BATCH_ID
1415
extras = testing
16+
17+
[testenv:selenium]
1518
commands =
16-
pytest -n 2 --platform="Android 6.0" --remote 1 tests/selenium/test_appium.py
1719
pytest -n 2 --platform="Linux" --browser chrome --headless 1
1820

21+
[testenv:appium]
22+
basepython = python3.4
23+
commands =
24+
pytest -n 5 --platform="Android 6.0" --remote 1 tests/selenium/test_appium.py
25+
pytest -n 2 --platform="iPhone 11.3" --remote 1 tests/selenium/test_appium.py
26+
1927

2028
[testenv:lint]
2129
basepython = python3.6

0 commit comments

Comments
 (0)