Skip to content

Commit 0f4d5c7

Browse files
committed
Add version tests
1 parent 138cab9 commit 0f4d5c7

File tree

3 files changed

+140
-8
lines changed

3 files changed

+140
-8
lines changed

.vscode/.ropeproject/config.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# The default ``config.py``
2+
# flake8: noqa
3+
4+
5+
def set_prefs(prefs):
6+
"""This function is called before opening the project"""
7+
8+
# Specify which files and folders to ignore in the project.
9+
# Changes to ignored resources are not added to the history and
10+
# VCSs. Also they are not returned in `Project.get_files()`.
11+
# Note that ``?`` and ``*`` match all characters but slashes.
12+
# '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
13+
# 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
14+
# '.svn': matches 'pkg/.svn' and all of its children
15+
# 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
16+
# 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
17+
prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject',
18+
'.hg', '.svn', '_svn', '.git', '.tox']
19+
20+
# Specifies which files should be considered python files. It is
21+
# useful when you have scripts inside your project. Only files
22+
# ending with ``.py`` are considered to be python files by
23+
# default.
24+
#prefs['python_files'] = ['*.py']
25+
26+
# Custom source folders: By default rope searches the project
27+
# for finding source folders (folders that should be searched
28+
# for finding modules). You can add paths to that list. Note
29+
# that rope guesses project source folders correctly most of the
30+
# time; use this if you have any problems.
31+
# The folders should be relative to project root and use '/' for
32+
# separating folders regardless of the platform rope is running on.
33+
# 'src/my_source_folder' for instance.
34+
#prefs.add('source_folders', 'src')
35+
36+
# You can extend python path for looking up modules
37+
#prefs.add('python_path', '~/python/')
38+
39+
# Should rope save object information or not.
40+
prefs['save_objectdb'] = True
41+
prefs['compress_objectdb'] = False
42+
43+
# If `True`, rope analyzes each module when it is being saved.
44+
prefs['automatic_soa'] = True
45+
# The depth of calls to follow in static object analysis
46+
prefs['soa_followed_calls'] = 0
47+
48+
# If `False` when running modules or unit tests "dynamic object
49+
# analysis" is turned off. This makes them much faster.
50+
prefs['perform_doa'] = True
51+
52+
# Rope can check the validity of its object DB when running.
53+
prefs['validate_objectdb'] = True
54+
55+
# How many undos to hold?
56+
prefs['max_history_items'] = 32
57+
58+
# Shows whether to save history across sessions.
59+
prefs['save_history'] = True
60+
prefs['compress_history'] = False
61+
62+
# Set the number spaces used for indenting. According to
63+
# :PEP:`8`, it is best to use 4 spaces. Since most of rope's
64+
# unit-tests use 4 spaces it is more reliable, too.
65+
prefs['indent_size'] = 4
66+
67+
# Builtin and c-extension modules that are allowed to be imported
68+
# and inspected by rope.
69+
prefs['extension_modules'] = []
70+
71+
# Add all standard c-extensions to extension_modules list.
72+
prefs['import_dynload_stdmods'] = True
73+
74+
# If `True` modules with syntax errors are considered to be empty.
75+
# The default value is `False`; When `False` syntax errors raise
76+
# `rope.base.exceptions.ModuleSyntaxError` exception.
77+
prefs['ignore_syntax_errors'] = False
78+
79+
# If `True`, rope ignores unresolvable imports. Otherwise, they
80+
# appear in the importing namespace.
81+
prefs['ignore_bad_imports'] = False
82+
83+
# If `True`, rope will insert new module imports as
84+
# `from <package> import <module>` by default.
85+
prefs['prefer_module_from_imports'] = False
86+
87+
# If `True`, rope will transform a comma list of imports into
88+
# multiple separate import statements when organizing
89+
# imports.
90+
prefs['split_imports'] = False
91+
92+
# If `True`, rope will sort imports alphabetically by module name
93+
# instead of alphabetically by import statement, with from imports
94+
# after normal imports.
95+
prefs['sort_imports_alphabetically'] = False
96+
97+
98+
def project_opened(project):
99+
"""This function is called after opening the project"""
100+
# Do whatever you like here!

appium/tests/test_ios.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33

44
from time import sleep
55

6-
def test_send_message(driver):
7-
driver.find_element_by_accessibility_id('send message').click()
86

9-
sleep(3)
7+
def extractText(driver):
8+
return driver.find_element_by_accessibility_id('textarea').get_attribute("value")
109

11-
value = driver.find_element_by_accessibility_id('textarea').get_attribute("value")
1210

11+
def test_send_message(driver):
12+
driver.find_element_by_accessibility_id('send message').click()
13+
sleep(3)
14+
value = extractText(driver)
1315
assert value != None
1416
event = json.loads(value)
15-
1617
assert len(event['breadcrumbs']) > 0
1718
assert len(event['contexts']) > 0
1819
assert event['message'] == 'TEST message'
@@ -21,10 +22,41 @@ def test_send_message(driver):
2122
assert event['sdk']['integrations'][0] == 'react-native'
2223
assert len(event['user']) > 0
2324

25+
26+
def test_version(driver):
27+
driver.find_element_by_accessibility_id('set version').click()
28+
driver.find_element_by_accessibility_id('send message').click()
29+
sleep(3)
30+
value = extractText(driver)
31+
assert value != None
32+
event = json.loads(value)
33+
assert event['release'] == 'org.reactjs.native.example.AwesomeProject-1337'
34+
35+
36+
def test_release(driver):
37+
driver.find_element_by_accessibility_id('set release').click()
38+
driver.find_element_by_accessibility_id('send message').click()
39+
sleep(3)
40+
value = extractText(driver)
41+
assert value != None
42+
event = json.loads(value)
43+
assert event['release'] == 'myversion'
44+
45+
46+
def test_dist(driver):
47+
driver.find_element_by_accessibility_id('set dist').click()
48+
driver.find_element_by_accessibility_id('send message').click()
49+
sleep(3)
50+
value = extractText(driver)
51+
assert value != None
52+
event = json.loads(value)
53+
assert event['dist'] == '500'
54+
55+
2456
def test_throw_error(driver):
2557
driver.find_element_by_accessibility_id('throw error').click()
2658
driver.relaunch_app()
27-
value = driver.find_element_by_accessibility_id('textarea').get_attribute("value")
59+
value = extractText(driver)
2860
# the crash should have been already sent
2961
assert value is None
3062

@@ -33,7 +65,7 @@ def test_native_crash(driver):
3365
driver.find_element_by_accessibility_id('native crash').click()
3466
driver.relaunch_app()
3567
sleep(3)
36-
value = driver.find_element_by_accessibility_id('textarea').get_attribute("value")
68+
value = extractText(driver)
3769
# the crash should have been already sent
3870
assert value != None
3971
event = json.loads(value)

0 commit comments

Comments
 (0)