Browse Source

BaangtUI - first steps

bernhardbuhl 4 years ago
parent
commit
b1dd8c9b1d

+ 4 - 4
baangt.py

@@ -1,6 +1,7 @@
 import getopt
 import sys
 from baangt.base.TestRun import TestRun
+from baangt.ui.ui import UI
 from baangtVIG.CustTestRun import CustTestRun
 from baangt.base.utils import utils
 
@@ -59,11 +60,10 @@ print_args()
 testRunFile=args_read("run")
 if testRunFile:
     print(f"Starting Testrun: {testRunFile}")
+    globalSettingsFileName = getGlobalSettings()
+    callTestrun()
 else:
-    sys.exit("Called without Testrun definition - exiting")
-
-globalSettingsFileName = getGlobalSettings()
-callTestrun()
+    UI()
 
 
 

+ 1 - 1
baangt/TestSteps/TestStepMaster.py

@@ -118,7 +118,7 @@ class TestStepMaster:
                 self.testcaseDataDict = GC.TESTCASESTATUS_ERROR
             else:
                 sys.exit("No idea, what happened here. Unknown condition appeared")
-        self.timing.takeTime(self.timingName)
+        self.timing.takeTime(self.timingName) # Why does this not work?
 
     def replaceVariables(self, expression):
         if not "$(" in expression:

+ 3 - 0
baangt/katalonImporter/katalonImport.py

@@ -271,6 +271,7 @@ from baangt.TestSteps.TestStepMaster import TestStepMaster
         l_string = l_string.replace("}", "")
         l_string = l_string.replace("))", ")")
         l_string = l_string.replace(".toString()","")
+        l_string = l_string.replace(".trim()", ".strip()")
 
         if "WebUI.waitForElementClickable" in l_string:
             l_string = ""
@@ -345,6 +346,8 @@ from baangt.TestSteps.TestStepMaster import TestStepMaster
             stringIn = " ".join(lFirst[0:-1]) + lEnd
             stringIn = stringIn.replace("), timeout =", ", timeout =")
 
+        stringIn = stringIn.replace("else: if", "elif")
+
         # Fix space vs. tab in the file beginning
         lengthDiffSpace = len(stringIn) - len(stringIn.lstrip(' '))
         if lengthDiffSpace > 0:

+ 0 - 0
baangt/ui/__init__.py


+ 57 - 0
baangt/ui/ui.py

@@ -0,0 +1,57 @@
+import PySimpleGUI as sg
+
+class UI:
+    def __init__(self):
+        self.directory = None
+        self.configFile = None
+        self.configFiles = []
+        self.testRunFile = None
+        self.testRunFiles = []
+        self.window = None
+
+        self.startWindow()
+
+
+    def startWindow(self):
+        sg.theme("TanBlue")
+
+        lLayout = [[sg.Text("Select Directory, Testrun and Global settings to use:")],
+                   [sg.Text("Directory", size=(20,1)),
+                    sg.In(key="-directory-", size=(20,1)), sg.FolderBrowse()],
+                   [sg.Text("TestRun", size=(20,1)),
+                    sg.InputCombo(("CV1", "CV2"), key="testRunFile", size=(20,1))],
+                   [sg.Text("Global Settings", size=(20,1)),
+                    sg.InputCombo(("GS1", "GS2"), key="configFile", size=(20,1))],
+                   [sg.Submit(), sg.Button('Exit')]]
+
+        self.window = sg.Window("Baangt interactive Starter", layout=lLayout)
+        lWindow = self.window
+        lWindow.finalize()
+        lWindow["_franzi_"].update("jetztzeit")
+        lWindow["configFile"].update(values=["susi", "strolchi"])
+        lWindow["-directory-"].update(value=self.directory)
+
+        while True:
+
+            lEvent, lValues = lWindow.read()
+            print(lValues["configFile"])
+            if lEvent == "Exit":
+                break
+            if lValues.get('-directory-') != self.directory:
+                self.directory = lValues.get("-directory-")
+                self.getConfigFilesInDirectory()
+                lWindow['configFile'].update(values=self.configFiles, value="")
+                lWindow['testRunFile'].update(values=self.testRunFiles, value="")
+            text_input = lValues.get('franzi')
+            file_chosen = lValues["configFile"]
+            sg.popup(f"You entered: {text_input} and chose file {file_chosen}")
+
+        lWindow.close
+
+    def getConfigFilesInDirectory(self):
+        """Reads *.JSON-Files from directory given in self.directory and builds 2 lists (Testrunfiles and ConfiFiles"""
+
+
+
+
+