[evolution] tests: add necessary comboboxes in contact editor if needed



commit 9f673bc5193d41f615619a061fd89f9543f75149
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Apr 28 10:06:12 2014 -0400

    tests: add necessary comboboxes in contact editor if needed

 tests/steps/addressbook_steps.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/tests/steps/addressbook_steps.py b/tests/steps/addressbook_steps.py
index 3249d3c..d515be5 100644
--- a/tests/steps/addressbook_steps.py
+++ b/tests/steps/addressbook_steps.py
@@ -255,8 +255,8 @@ def get_combobox_textbox_object(contact_editor, section):
         correct_textbox = min(matching_textboxes, key=lambda x: x.position[0])
         result.append((combo, correct_textbox))
 
-    comboboxes = [x[0] for x in result]
-    textboxes = [x[1] for x in result]
+    comboboxes = [x[0] for x in result][::-1]
+    textboxes = [x[1] for x in result][::-1]
 
     return (textboxes, comboboxes)
 
@@ -271,6 +271,12 @@ def set_contact_emails_to_value(context, section):
         textbox.text = ""
 
     for index, row in enumerate(context.table.rows):
+        # Check that we have sufficient amount of textboxes
+        # 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(
+                context.app.contact_editor, section)
         textboxes[index].text = row['Value']
         if comboboxes[index].combovalue != row['Field']:
             comboboxes[index].combovalue = row['Field']
@@ -368,4 +374,4 @@ def set_field_in_section_to_value(context, field_name, section, field_value):
     if element.roleName == "text":
         element.text = field_value
     elif element.roleName == "combo box":
-        element.combovalue = field_value
\ No newline at end of file
+        element.combovalue = field_value


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]