From a4be3ebd4daddab219c347af8583bfbb9d63a843 Mon Sep 17 00:00:00 2001 From: Saurav Chirania Date: Fri, 29 Jun 2018 12:33:21 +0530 Subject: 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 --- uitest/loginterpreter.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'uitest') 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) -- cgit