Browse Source

Log file open ui

Akash 3 years ago
parent
commit
c384a94783

+ 2 - 0
baangt/ui/pyqt/uimain.py

@@ -675,6 +675,8 @@ class MainWindow(Ui_MainWindow):
             if result_file[-5:] == ".xlsx":
                 logger.debug(f"Found result_file in the logs: {result_file}")
                 self.__result_file = result_file
+        elif "Logfile used: " in text:
+            self.__log_file = text.split("used: ")[1].strip()
         if "||Statistic:" in text:
             lis = text.split('||')
             stat = lis[1][10:]

+ 6 - 1
tests/test_browserHandling.py

@@ -3,6 +3,7 @@ import platform
 from baangt.base import GlobalConstants as GC
 from baangt.base.BrowserHandling.BrowserHandling import BrowserDriver
 from unittest.mock import patch, MagicMock
+from baangt.TestSteps.Exceptions import baangtTestStepException
 
 
 browserName = "FIREFOX"
@@ -251,6 +252,10 @@ def test_waitForPageLoadAfterButtonClick(getdriver):
 def test_handleWindow(function, getdriver):
     getdriver.browserData = MagicMock()
     getdriver.browserData.driver.window_handles = ["test"]
-    getdriver.handleWindow(function=function)
+    if function == "":
+        with pytest.raises(baangtTestStepException):
+            getdriver.handleWindow(function=function)
+    else:
+        getdriver.handleWindow(function=function)
     assert 1 == 1
 

+ 3 - 3
tests/test_testrun.py

@@ -1,5 +1,6 @@
 import pytest
 from unittest.mock import patch
+from baangt.base.TestRun.TestRun import TestRun
 
 
 class subprocess_communicate:
@@ -15,13 +16,12 @@ def testrun_obj():
     """ This function return instance of TestRun object
         which will be used by other test methods
     """
-    from baangt.base.TestRun.TestRun import TestRun
-    return TestRun("SimpleTheInternet.xlsx","globals.json", executeDirect=False)
+    return TestRun("examples/SimpleTheInternet.xlsx","globals.json", executeDirect=False)
 
 
 def test_filenotfound():
     """ To check if function raises File not found Error """
-    with pytest.raises(Exception) as e:
+    with pytest.raises(BaseException) as e:
         TestRun("SimpleTheInternet.xlsx","global.json")
 
 

+ 4 - 4
tests/test_testrun_jsonimport.py

@@ -10,11 +10,11 @@ def testrun_obj():
         which will be used by other test methods
     """
     from baangt.base.TestRun.TestRun import TestRun
-    return TestRun("SimpleTheInternet.xlsx", "globals.json", executeDirect=False)
+    return TestRun("examples/SimpleTheInternet.xlsx", "globals.json", executeDirect=False)
 
 
 def test_with_globalsHeadless(testrun_obj):
-    lTestRun = TestRun("SimpleTheInternet.xlsx",
+    lTestRun = TestRun("examples/SimpleTheInternet.xlsx",
                        globalSettingsFileNameAndPath= \
                            Path(os.getcwd()).joinpath("tests").joinpath("jsons").joinpath("globals_headless.json"),
                        executeDirect=False)
@@ -25,7 +25,7 @@ def test_with_globalsHeadless(testrun_obj):
 
 
 def test_with_globalsHeadlessVersion2(testrun_obj):
-    lTestRun = TestRun("SimpleTheInternet.xlsx",
+    lTestRun = TestRun("examples/SimpleTheInternet.xlsx",
                        globalSettingsFileNameAndPath= \
                            Path(os.getcwd()).joinpath("tests").joinpath("jsons").joinpath("globals_headless2.json"),
                        executeDirect=False)
@@ -36,7 +36,7 @@ def test_with_globalsHeadlessVersion2(testrun_obj):
     assert isinstance(lTestRun.globalSettings["TC.BrowserAttributes"], dict)
 
 def tests_with_fullGlobalsFile(testrun_obj):
-    lTestRun = TestRun("SimpleTheInternet.xlsx",
+    lTestRun = TestRun("examples/SimpleTheInternet.xlsx",
                        globalSettingsFileNameAndPath= \
                            Path(os.getcwd()).joinpath("tests").joinpath("jsons").joinpath("globalsFullExample.json"),
                        executeDirect=False)