summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorSaurav Chirania <saurav.chir@gmail.com>2018-07-30 21:13:34 +0530
committerSaurav Chirania <saurav.chir@gmail.com>2018-08-27 09:33:03 +0200
commitdb68a9c002314e17c2b1d1748269af4d1851ef48 (patch)
tree0b964e3756901a5fdd68cbd90def8595e4bc1e73 /uitest
parent00f6bec6b70130327313b9e203625272ef05ae93 (diff)
uitest interpreter: some improvements
Change-Id: I7b768694ba5a82f7273fd7641fae5c3fc84233a6 Reviewed-on: https://gerrit.libreoffice.org/58340 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Jenkins
Diffstat (limited to 'uitest')
-rw-r--r--uitest/loginterpreter.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/uitest/loginterpreter.py b/uitest/loginterpreter.py
index becd8b322937..770beb966064 100644
--- a/uitest/loginterpreter.py
+++ b/uitest/loginterpreter.py
@@ -16,14 +16,15 @@ def parse_line(line):
This function parses a line from log file
and returns the parsed values as a python dictionary
"""
- if (line == "" or line.startswith("Action on element")):
+ if (line == ""):
return
dict = {}
if "{" in line:
start_index_of_parameters = line.find("{")
end_index_of_parameters = line.find("}") + 1
parameters = line[start_index_of_parameters:end_index_of_parameters]
- dict["parameters"] = parameters
+ if parameters != "":
+ dict["parameters"] = parameters
line = line[:start_index_of_parameters-1]
word_list = line.split()
dict["keyword"] = word_list[0]
@@ -54,7 +55,7 @@ def get_log_file(input_address):
print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage instructions")
sys.exit(1)
- content = [x.strip() for x in content]
+ content = [x.strip() for x in content if not x.startswith("Action on element")]
return content
def initiate_test_generation(address):
@@ -65,6 +66,7 @@ def initiate_test_generation(address):
print("Use " + os.path.basename(sys.argv[0]) + " -h to get usage instructions")
sys.exit(1)
initial_text = \
+ "# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-\n\n" + \
"from uitest.framework import UITestCase\n" + \
"from libreoffice.uno.propertyvalue import mkPropertyValues\n" + \
"import importlib\n\n" + \
@@ -135,8 +137,18 @@ def get_test_line_from_one_log_line(log_line):
test_line += ",tuple())\n"
return test_line
elif action_dict["keyword"] == "CommandSent":
- test_line += "self.xUITest.executeCommand(\"" + \
- action_dict["Name"] + "\")\n"
+ if "parameters" not in action_dict:
+ test_line += "self.xUITest.executeCommand(\"" + \
+ action_dict["Name"] + "\")\n"
+ return test_line
+ else:
+ test_line += "self.xUITest.executeCommandWithParameters(\"" + \
+ action_dict["Name"] + "\", mkPropertyValues(" + action_dict["parameters"] + \
+ "))\n"
+ return test_line
+ elif action_dict["keyword"] == "ModalDialogExecuted" or \
+ action_dict["keyword"] == "ModelessDialogConstructed":
+ test_line += action_dict["Id"] + " = " + "self.xUITest.getTopFocusWindow()\n"
return test_line
return ""
@@ -187,6 +199,7 @@ def main():
output_stream.write(test_line)
line_number += 2
output_stream.write(" self.ui_test.close_doc()")
+ output_stream.write("\n\n# vim: set shiftwidth=4 softtabstop=4 expandtab:")
output_stream.close()
if __name__ == '__main__':