From 86bb76a70fb674d8021ea63ae76a901529de10e3 Mon Sep 17 00:00:00 2001 From: Simone Brunello <15804966+simone36050@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:13:11 +0100 Subject: [PATCH] Fix default selenium driver, onlyValidate & documentation --- README.md | 12 +++++++++--- tool/src/main/java/migt/ExecuteWebServer.java | 5 +++-- tool/src/main/java/migt/Main.java | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e4a8b0d..13aaa87 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,6 @@ Documentation about MIG-T and the language can be found in this repo's [wiki](ht # MIG-T API Documentation -Explore the API endpoints and documentation here: - ### API Endpoints MIG-T supports both GUI and API interaction. Two endpoints are available for API interaction: @@ -98,7 +96,7 @@ MIG-T supports both GUI and API interaction. Two endpoints are available for API #### /execute [POST] -Check the validity of the test and run the test. +Check the validity of the test and run the test. The *onlyValidate* parameter is available, if enabled the test will only be validated but not executed (e.g., `/execute?onlyValidate=true`) Input: ```json @@ -114,6 +112,14 @@ Input: Output: - HTTP status code 200 (ok) +If the validation of the test fails, the output is: +```json +{ + "success": false, + "error": "the error" +} +``` + #### /result [GET] Checks whether the test is finished and returns the result. diff --git a/tool/src/main/java/migt/ExecuteWebServer.java b/tool/src/main/java/migt/ExecuteWebServer.java index 672dc3b..47e5377 100644 --- a/tool/src/main/java/migt/ExecuteWebServer.java +++ b/tool/src/main/java/migt/ExecuteWebServer.java @@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletRequest; import javax.swing.table.DefaultTableModel; +import java.awt.*; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; @@ -111,8 +112,8 @@ public void handle(String target, org.eclipse.jetty.server.Request baseRequest, // verify errors JsonObject result = new JsonObject(); - String error = mainPane.lblOutput.getText(); - if (false) { + if (mainPane.bot_tabbed.getBackgroundAt(mainPane.bot_tabs_index.get("Input JSON")) == Color.RED) { + String error = mainPane.txt_err_debug_tab.getText(); result.addProperty("success", false); result.addProperty("error", error); } else { diff --git a/tool/src/main/java/migt/Main.java b/tool/src/main/java/migt/Main.java index 856808f..ea3127c 100644 --- a/tool/src/main/java/migt/Main.java +++ b/tool/src/main/java/migt/Main.java @@ -190,6 +190,7 @@ public Main() { //-------------------------------------- //DRIVER_PATH = Main.class.getClassLoader().getResource("driver/geckodriver").getPath(); //DRIVER_PATH = JOptionPane.showInputDialog(null, "enter the driver path:"); + DRIVER_PATH = ""; //-------------------------------------- if (!DRIVER_PATH.equals("")) {