[Libreoffice-commits] core.git: uitest/loginterpreter.py

Saurav Chirania saurav.chir at gmail.com
Sun Jul 1 13:23:38 UTC 2018


 uitest/loginterpreter.py |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit a4be3ebd4daddab219c347af8583bfbb9d63a843
Author: Saurav Chirania <saurav.chir at gmail.com>
Date:   Fri Jun 29 12:33:21 2018 +0530

    uitest interpreter: add more features
    
    1) Support UNO commands
    2) Support closing dialog using buttons
    3) Correct keyword for modless dialog
    4) Introduce "Redundant Couple" for couples
    from which only 1 statement can generate the log.
    
    Change-Id: I3541fea6a0b72de2c03626476b8abb43a7324dab
    Reviewed-on: https://gerrit.libreoffice.org/56776
    Tested-by: Jenkins
    Reviewed-by: Saurav Chirania <saurav.chir at gmail.com>

diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index 252fc4bd6c42..efdef95c6473 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -91,9 +91,18 @@ def get_coupling_type(line1, line2):
         return "COMMAND_MODAL_COUPLE"
 
     elif action_dict1["keyword"] == "CommandSent" and \
-        action_dict2["keyword"] == "ModelessDialogExecuted":
+        action_dict2["keyword"] == "ModelessDialogConstructed":
         return "COMMAND_MODELESS_COUPLE"
 
+    elif action_dict1["keyword"] == "ButtonUIObject" and \
+        action_dict2["keyword"] == "DialogClosed":
+        return "BUTTON_DIALOGCLOSE_COUPLE"
+
+    elif "parameters" in action_dict1 and \
+        "KEYCODE" in action_dict1["parameters"] and \
+        action_dict2["keyword"] == "CommandSent":
+        return "REDUNDANT_COUPLE"
+
     return "NOT_A_COUPLE"
 
 def get_test_line_from_one_log_line(log_line):
@@ -113,6 +122,10 @@ def get_test_line_from_one_log_line(log_line):
             else:
                 test_line += ",tuple())\n"
             return test_line
+    elif action_dict["keyword"] == "CommandSent":
+        test_line += "self.xUITest.executeCommand(\"" + \
+        action_dict["Name"] + "\")\n"
+        return test_line
 
     return ""
 
@@ -131,6 +144,11 @@ def get_test_line_from_two_log_lines(log_line1,log_line2):
         "self.ui_test.execute_modeless_dialog_through_command(\"" + \
         action_dict1["Name"] + "\")\n        " + \
         action_dict2["Id"] + " = self.xUITest.getTopFocusWindow()\n"
+    elif coupling_type == "BUTTON_DIALOGCLOSE_COUPLE":
+        test_line += \
+        action_dict1["Id"] + " = " + action_dict1["Parent"] + ".getChild(\"" + \
+        action_dict1["Id"] + "\")\n        self.ui_test.close_dialog_through_button(" + \
+        action_dict1["Id"] + ")\n"
     return test_line
 
 def main():
@@ -144,6 +162,8 @@ def main():
             test_line = get_test_line_from_one_log_line(log_lines[line_number])
             output_stream.write(test_line)
             line_number += 1
+        elif get_coupling_type(log_lines[line_number],log_lines[line_number + 1]) == "REDUNDANT_COUPLE":
+            line_number += 1
         else:
             test_line = get_test_line_from_two_log_lines(log_lines[line_number],log_lines[line_number + 1])
             output_stream.write(test_line)


More information about the Libreoffice-commits mailing list