From fdecd45ab9318199ff4a64472b5f64288f6c2ecb Mon Sep 17 00:00:00 2001 From: Paul <nolte@lat-lon.de> Date: Sat, 20 Apr 2024 12:46:05 +0200 Subject: [PATCH] XPLANBOX-2327 - Format, --headless, Find File in TempDictionary and fixed Nullpointerexception for Test with Invalid Plan --- .../validatorweb/XPlanValidatorWebIT.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/xplan-tests/xplan-tests-selenium/src/test/java/de/latlon/xplanbox/tests/selenium/validatorweb/XPlanValidatorWebIT.java b/xplan-tests/xplan-tests-selenium/src/test/java/de/latlon/xplanbox/tests/selenium/validatorweb/XPlanValidatorWebIT.java index 340eeb7cc..a67db8440 100644 --- a/xplan-tests/xplan-tests-selenium/src/test/java/de/latlon/xplanbox/tests/selenium/validatorweb/XPlanValidatorWebIT.java +++ b/xplan-tests/xplan-tests-selenium/src/test/java/de/latlon/xplanbox/tests/selenium/validatorweb/XPlanValidatorWebIT.java @@ -23,9 +23,10 @@ class XPlanValidatorWebIT { private static final String NAMEBPLAN_ORIGINAL = "BPlan001_5-4"; - private static final String DOWNLOADED_FILE_NAME = "Selenium_Test-Report.zip" + private static final String DOWNLOADED_FILE_NAME = "Selenium_Test-Report.zip"; + // Hier muss ein invalider Plan hin - private static final String NAMEBPLAN_ORIGINAL_INVALID = "xplan52-Laufrichtungsfehler.zip"; + private static final String NAMEBPLAN_ORIGINAL_INVALID = "xplan52-Laufrichtungsfehler"; private static String connectUrl; @@ -69,7 +70,7 @@ class XPlanValidatorWebIT { ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("prefs", chromePrefs); - options.addArguments("--no-sandbox", "--ignore-certificate-errors", "--disable-dev-shm-usage", + options.addArguments("--no-sandbox", "--ignore-certificate-errors", "--headless", "--disable-dev-shm-usage", "--disable-gpu", "--disable-software-rasterizer"); WebDriver driver = new ChromeDriver(options); @@ -78,7 +79,6 @@ class XPlanValidatorWebIT { try { - preValidate(driver, myZIPFile, NAMEBPLAN_TEST); startValidation(driver); @@ -90,7 +90,7 @@ class XPlanValidatorWebIT { sleep(); - File downloadedFile = new File(System.getProperty("java.io.tmpdir"), DOWNLOADED_FILE_NAME); + File downloadedFile = tmpDir.resolve(DOWNLOADED_FILE_NAME).toFile(); checkDownloadedFileSize(downloadedFile); @@ -139,6 +139,7 @@ class XPlanValidatorWebIT { "--disable-gpu", "--disable-software-rasterizer"); WebDriver driver = new ChromeDriver(options); + driver.get(connectUrl); String myZIPFile = getClass().getResource("/" + NAMEBPLAN_ORIGINAL_INVALID + ".zip").getFile().toString(); try { @@ -153,13 +154,12 @@ class XPlanValidatorWebIT { sleep(); - File downloadedFile = new File(System.getProperty("java.io.tmpdir"), DOWNLOADED_FILE_NAME); + File downloadedFile = tmpDir.resolve(DOWNLOADED_FILE_NAME).toFile(); checkDownloadedFileSize(downloadedFile); recheckValidationOptionsAndQuit2newPlan(driver); - - + sleep(); } catch (Exception e) { @@ -304,8 +304,9 @@ class XPlanValidatorWebIT { */ private static void checkDownloadedFileSize(File downloadedFile) { String expectedValue = "File not empty"; - //nur zum Testen, eig muss der String erst leer sein. Das Problem ist noch, dass die aktuell noch nicht richtig gefunden wird - String statusMessage = "File not empty"; + // nur zum Testen, eig muss der String erst leer sein. Das Problem ist noch, dass + // die aktuell noch nicht richtig gefunden wird + String statusMessage = ""; if (downloadedFile.exists()) { if (downloadedFile.length() > 0) { -- GitLab