[Libreoffice-commits] dev-tools.git: 3 commits - uitest/mass-testing

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Apr 18 10:56:28 UTC 2019


 uitest/mass-testing/calc.py |   40 +++++++++++++++++++++++++++++++++++++---
 uitest/mass-testing/run.py  |   23 +++++++++++++----------
 2 files changed, 50 insertions(+), 13 deletions(-)

New commits:
commit 8b3e626d2f21a65242cf3de4f08c3810ade3e5ee
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 18 12:48:28 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 18 12:55:53 2019 +0200

    mass-uitesting: Fix UnicodeDecodeError

diff --git a/uitest/mass-testing/run.py b/uitest/mass-testing/run.py
index 8de5d35..6e3aeb6 100755
--- a/uitest/mass-testing/run.py
+++ b/uitest/mass-testing/run.py
@@ -74,8 +74,8 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug):
     totalSkip = 0
 
     sofficePath = liboPath + "instdir/program/soffice"
-    process = Popen([sofficePath, "--version"], encoding="utf-8", stdout=PIPE, stderr=PIPE)
-    stdout, stderr = process.communicate()
+    process = Popen([sofficePath, "--version"], stdout=PIPE, stderr=PIPE)
+    stdout = process.communicate()[0].decode("utf-8")
     sourceHash = stdout.split(" ")[2].strip()
 
     #Keep track of the files run
@@ -110,9 +110,9 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug):
                     "--soffice=path:" + sofficePath,
                     "--userdir=file://" + profilePath,
                     "--file=" + component + ".py"], stdin=PIPE, stdout=PIPE, stderr=PIPE,
-                    encoding="utf-8", preexec_fn=os.setsid) as process:
+                    preexec_fn=os.setsid) as process:
             try:
-                outputLines = process.communicate(timeout=60)[0].splitlines()
+                outputLines = process.communicate(timeout=60)[0].decode('utf-8').splitlines()
                 importantInfo = ''
                 for line in outputLines:
                     if isDebug:
commit 50957cb6316b0d6157dc0c787550954baf95f727
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 18 12:42:46 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 18 12:55:53 2019 +0200

    mass-uitesting: Use a different log for each component
    
    and put them in 'logs' folder

diff --git a/uitest/mass-testing/run.py b/uitest/mass-testing/run.py
index 819ca20..8de5d35 100755
--- a/uitest/mass-testing/run.py
+++ b/uitest/mass-testing/run.py
@@ -32,12 +32,12 @@ class DefaultHelpParser(argparse.ArgumentParser):
         self.print_help()
         sys.exit(2)
 
-def start_logger():
+def start_logger(component):
     rootLogger = logging.getLogger()
     rootLogger.setLevel(os.environ.get("LOGLEVEL", "INFO"))
 
     logFormatter = logging.Formatter("%(asctime)s %(message)s")
-    fileHandler = logging.FileHandler("massTesting.log")
+    fileHandler = logging.FileHandler("./logs/" + component + ".log")
     fileHandler.setFormatter(logFormatter)
     rootLogger.addHandler(fileHandler)
 
@@ -81,8 +81,9 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug):
     #Keep track of the files run
     filesRun = {}
 
-    if os.path.exists('run.pkl'):
-        with open('run.pkl', 'rb') as pickle_in:
+    pklFile = './logs/' + component + '.pkl'
+    if os.path.exists(pklFile):
+        with open(pklFile, 'rb') as pickle_in:
             filesRun = pickle.load(pickle_in)
 
     if sourceHash not in filesRun:
@@ -148,7 +149,7 @@ def run_tests_and_get_results(liboPath, listFiles, isDebug):
 
         filesRun[sourceHash].append(fileName)
 
-        with open('run.pkl', 'wb') as pickle_out:
+        with open(pklFile, 'wb') as pickle_out:
             pickle.dump(filesRun, pickle_out)
 
     totalTests = totalPass + totalTimeout + totalSkip + totalFail
@@ -194,8 +195,10 @@ if __name__ == '__main__':
     os.environ["URE_BOOTSTRAP"] = "file://" + liboPath + "instdir/program/fundamentalrc"
     os.environ["SAL_USE_VCLPLUGIN"] = "gen"
 
-    logger = start_logger()
+    if not os.path.exists('./logs'):
+        os.makedirs('./logs')
 
+    logger = start_logger(component)
 
     listFiles = get_file_names(component, filesPath)
 
commit 6b15ed3504d6cc0cce0e9a2788047b1193ecf33d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 18 12:39:28 2019 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 18 12:55:53 2019 +0200

    mass-uitesting: Add a few calc tests

diff --git a/uitest/mass-testing/calc.py b/uitest/mass-testing/calc.py
index 39cbcda..14383a9 100755
--- a/uitest/mass-testing/calc.py
+++ b/uitest/mass-testing/calc.py
@@ -34,17 +34,51 @@ class massTesting(UITestCase):
 
         try:
             xDoc = self.xUITest.getTopFocusWindow()
-            xEdit = xDoc.getChild("edit")
+            xEdit = xDoc.getChild("grid_window")
         except:
             #In case the mimetype is wrong and the file is open with another component
             handle_skip()
 
         return xEdit
 
-    def test_calc(self):
+    def test_remove_all_and_undo(self):
         xEdit = self.load_file()
         if xEdit:
-            continue
+            self.xUITest.executeCommand(".uno:SelectAll")
+            xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DELETE"}))
+
+            self.xUITest.executeCommand(".uno:Undo")
+
+        self.ui_test.close_doc()
+
+    def test_insert_column_and_undo(self):
+        xEdit = self.load_file()
+        if xEdit:
+            self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+            self.xUITest.executeCommand(".uno:Undo")
+
+        self.ui_test.close_doc()
+
+    def test_insert_row_and_undo(self):
+        xEdit = self.load_file()
+        if xEdit:
+            self.xUITest.executeCommand(".uno:InsertRowsBefore")
+            self.xUITest.executeCommand(".uno:Undo")
+
+        self.ui_test.close_doc()
+
+    def test_copy_all_paste_undo(self):
+        xEdit = self.load_file()
+        if xEdit:
+            self.xUITest.executeCommand(".uno:SelectAll")
+
+            self.xUITest.executeCommand(".uno:Copy")
+
+            for i in range(5):
+                self.xUITest.executeCommand(".uno:Paste")
+
+            for i in range(5):
+                self.xUITest.executeCommand(".uno:Undo")
 
         self.ui_test.close_doc()
 


More information about the Libreoffice-commits mailing list