aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Rutkovsky <vrutkovs@redhat.com>2014-06-11 17:35:34 +0800
committerVadim Rutkovsky <vrutkovs@redhat.com>2014-06-11 17:36:19 +0800
commit53d071edc63ba6bfed035d937e9695aa12e143a0 (patch)
treea00aeb3e4598b0ee54f3e657fd1f32440fcc4ede
parent1ec775dd0e4098b247361b79ba879765cf698309 (diff)
downloadgsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar.gz
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar.bz2
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar.lz
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar.xz
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.tar.zst
gsoc2013-evolution-53d071edc63ba6bfed035d937e9695aa12e143a0.zip
tests: correctly fetch combobox/textbox pair in contact editor
-rw-r--r--tests/steps/addressbook_steps.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/steps/addressbook_steps.py b/tests/steps/addressbook_steps.py
index 14bdaff661..64bfc5a673 100644
--- a/tests/steps/addressbook_steps.py
+++ b/tests/steps/addressbook_steps.py
@@ -226,7 +226,7 @@ def property_in_contact_window_is_set_to(context, field, expected):
assert unicode(actual) == expected, "Incorrect value"
-def get_combobox_textbox_object(contact_editor, section):
+def get_combobox_textbox_object(contact_editor, section, scroll_to_bottom=True):
"""Get a list of paired 'combobox-textbox' objects in contact editor"""
section_names = {
'Ims': 'Instant Messaging',
@@ -245,10 +245,14 @@ def get_combobox_textbox_object(contact_editor, section):
if button and (False in [x.showing for x in textboxes]):
button.click()
- # Scroll to the bottom of the page if possible
+ # Scroll to the bottom of the page if needed
+
pagetab = panel.findAncestor(GenericPredicate(roleName='page tab'))
for scroll in pagetab.findChildren(lambda x: x.roleName == 'scroll bar'):
- scroll.value = scroll.maxValue
+ if scroll_to_bottom:
+ scroll.value = scroll.maxValue
+ else:
+ scroll.value = 0
comboboxes = panel.findChildren(GenericPredicate(roleName='combo box'))
@@ -266,12 +270,12 @@ def get_combobox_textbox_object(contact_editor, section):
comboboxes = [x[0] for x in result][::-1]
textboxes = [x[1] for x in result][::-1]
- return (textboxes, comboboxes)
+ return (textboxes, comboboxes, button)
@step(u'Set {section} in contact editor to')
def set_contact_emails_to_value(context, section):
- (textboxes, comboboxes) = get_combobox_textbox_object(
+ (textboxes, comboboxes, collapse_button) = get_combobox_textbox_object(
context.app.contact_editor, section)
# clear existing data
@@ -283,7 +287,7 @@ def set_contact_emails_to_value(context, section):
# If not - click plus buttons until we have enough
if index == len(textboxes):
textboxes[0].parent.child(roleName="push button").click()
- (textboxes, comboboxes) = get_combobox_textbox_object(
+ (textboxes, comboboxes, collapse_button) = get_combobox_textbox_object(
context.app.contact_editor, section)
textboxes[index].text = row['Value']
if comboboxes[index].combovalue != row['Field']:
@@ -292,8 +296,8 @@ def set_contact_emails_to_value(context, section):
@then(u'{section} are set to')
def emails_are_set_to(context, section):
- (textboxes, comboboxes) = get_combobox_textbox_object(
- context.app.contact_editor, section)
+ (textboxes, comboboxes,collapse_button) = get_combobox_textbox_object(
+ context.app.contact_editor, section, False)
actual = []
for index, textbox in enumerate(textboxes):
@@ -311,6 +315,9 @@ def emails_are_set_to(context, section):
assert actual == expected, "Incorrect %s value:\nexpected:%s\n but was:%s" % (
row['Field'], expected, actual)
+ # Collapse the section after check
+ collapse_button.click()
+
@step(u'Tick "Wants to receive HTML mail" checkbox')
def tick_checkbox(context):