Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit 771a27b

Browse files
committed
Run tests for selenium-appium
1 parent 41dca6e commit 771a27b

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ matrix:
2525
- python: 3.6
2626
env:
2727
- TOX_ENV=selenium
28+
- python: 3.6
29+
env:
30+
- TOX_ENV=selenium-appium
2831
- python: 3.6
2932
env:
3033
- TOX_ENV=lint

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_run_packs(c, core=None,
130130
elif images:
131131
c.run('pytest tests/functional/eyes_images')
132132
elif appium:
133-
c.run('pytest -n 5 --remote 1 tests/functional/eyes_seleniumtest_appium.py')
133+
c.run('pytest -n 5 --remote 1 tests/functional/eyes_selenium/test_appium.py')
134134
# for pack in _packages_resolver(core, selenium, images):
135135
# c.run('pytest tests/functional/{}'.format(pack), echo=True)
136136

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def pytest_addoption(parser):
123123
parser.addoption("--platform", action="store")
124124
parser.addoption("--browser", action="store")
125125
parser.addoption("--headless", action="store")
126+
parser.addoption("--remote", action="store")
126127

127128

128129
def _get_capabilities(platform_name=None, browser_name=None, headless=False):

tests/functional/eyes_selenium/test_appium.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66

77
@pytest.mark.platform('Android')
8-
@pytest.mark.capabilities(**{"app": "http://saucelabs.com/example_files/ContactManager.apk",
9-
"clearSystemFiles": True,
10-
"noReset": True,
11-
"browserName": '',
12-
})
8+
@pytest.mark.capabilities(**{
9+
"app": "http://saucelabs.com/example_files/ContactManager.apk",
10+
"clearSystemFiles": True,
11+
"noReset": True,
12+
"browserName": '',
13+
})
1314
@pytest.mark.eyes(hide_scrollbars=False)
1415
def test_android_native(eyes, driver):
1516
eyes.open(driver, "Contacts!", "My first Appium Python test!")
@@ -18,21 +19,38 @@ def test_android_native(eyes, driver):
1819

1920

2021
@pytest.mark.platform('iOS')
22+
@pytest.mark.parametrize('eyes', [{
23+
'force_full_page_screenshot': True,
24+
'hide_scrollbars': False
25+
}, {
26+
'force_full_page_screenshot': False,
27+
'hide_scrollbars': False
28+
}, ], indirect=True, ids=lambda o: "with FSP" if o['force_full_page_screenshot'] else "no FSP")
29+
@pytest.mark.test_page_url('http://applitools.com')
30+
def test_final_application_ios(eyes_open):
31+
eyes, driver = eyes_open
32+
eyes.check_window("Home", target=(Target().ignore(IgnoreRegionBySelector(By.CLASS_NAME, 'hero-container')).floating(
33+
FloatingRegion(Region(10, 20, 30, 40), FloatingBounds(10, 0, 20, 10)))))
34+
35+
hero = driver.find_element_by_class_name("hero-container")
36+
eyes.check_region_by_element(hero, "Page Hero",
37+
target=(Target().ignore(Region(20, 20, 50, 50), Region(40, 40, 10, 20))))
38+
39+
2140
@pytest.mark.platform('Android')
22-
@pytest.mark.parametrize('eyes', [
23-
{'force_full_page_screenshot': True, 'hide_scrollbars': False},
24-
{'force_full_page_screenshot': False, 'hide_scrollbars': False},
25-
],
26-
indirect=True,
27-
ids=lambda o: "with FSP" if o['force_full_page_screenshot'] else "no FSP")
41+
@pytest.mark.parametrize('eyes', [{
42+
'force_full_page_screenshot': True,
43+
'hide_scrollbars': False
44+
}, {
45+
'force_full_page_screenshot': False,
46+
'hide_scrollbars': False
47+
}, ], indirect=True, ids=lambda o: "with FSP" if o['force_full_page_screenshot'] else "no FSP")
2848
@pytest.mark.test_page_url('http://applitools.com')
29-
def test_final_application(eyes_open):
49+
def test_final_application_android(eyes_open):
3050
eyes, driver = eyes_open
31-
eyes.check_window("Home", target=(Target()
32-
.ignore(IgnoreRegionBySelector(By.CLASS_NAME, 'hero-container'))
33-
.floating(FloatingRegion(Region(10, 20, 30, 40), FloatingBounds(10, 0, 20, 10))))
34-
)
51+
eyes.check_window("Home", target=(Target().ignore(IgnoreRegionBySelector(By.CLASS_NAME, 'hero-container')).floating(
52+
FloatingRegion(Region(10, 20, 30, 40), FloatingBounds(10, 0, 20, 10)))))
3553

3654
hero = driver.find_element_by_class_name("hero-container")
37-
eyes.check_region_by_element(hero, "Page Hero", target=(Target()
38-
.ignore(Region(20, 20, 50, 50), Region(40, 40, 10, 20))))
55+
eyes.check_region_by_element(hero, "Page Hero",
56+
target=(Target().ignore(Region(20, 20, 50, 50), Region(40, 40, 10, 20))))

0 commit comments

Comments
 (0)