diff --git a/src/DataTable/TemplateTable.tsx b/src/DataTable/TemplateTable.tsx index 11c28ed..a7d490c 100644 --- a/src/DataTable/TemplateTable.tsx +++ b/src/DataTable/TemplateTable.tsx @@ -14,6 +14,11 @@ import { useSetIsShosen } from "../store/store"; import { ontLookup } from "./CategoryLookUp"; const columns = [ + { + accessorKey: "uuid", + header: "UUID", + cell: (props) => <>{props.getValue()}, + }, { accessorKey: "template_name", header: "Template Name", @@ -75,6 +80,11 @@ export default function TemplateTable({ data }) { globalFilter: filtering, rowSelection, }, + initialState: { + columnVisibility: { + uuid: false, + }, + }, }); const setIdShosen = useSetIsShosen(); @@ -110,6 +120,7 @@ export default function TemplateTable({ data }) { ))} + {/* {console.log(table.getRowModel().rows[0]?.original?.uuid)} */} {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( diff --git a/src/SurveyComp/SurveyComp.jsx b/src/SurveyComp/SurveyComp.jsx index f8b48ac..2332e8d 100644 --- a/src/SurveyComp/SurveyComp.jsx +++ b/src/SurveyComp/SurveyComp.jsx @@ -17,6 +17,8 @@ import { useIntermediateData, } from "../store/store"; +import { useLocation } from "react-router-dom"; + import config from "../utils/config"; import "survey-core/defaultV2.min.css"; @@ -36,7 +38,11 @@ function SurveyComponent({ setResult }) { const idShosen = useIsShosen(); const setIntermediateData = useSetIntermediateData(); - const id = idShosen ? idShosen : UUID; + const location = useLocation(); + const queryParams = new URLSearchParams(location.search); + const uuidParams = queryParams.get("uuid"); + + const id = idShosen ? idShosen : UUID || uuidParams; // eslint-disable-next-line react-hooks/exhaustive-deps async function getTemplateInfo() { diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index e1c0c99..ebf479d 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -15,16 +15,10 @@ export default function HomePage() { const uuidParams = queryParams.get("uuid"); const wizardParams = queryParams.get("wizard"); - // if (uuidParams) { - // setUUID(uuidParams); - // } - - console.log("home", UUID); - return ( <> {wizardParams && } - {UUID ? : null} + {uuidParams || UUID ? : null} {!uuidParams && !wizardParams && } ); diff --git a/test/other_tests/create-and-find.spec.js b/test/other_tests/create-and-find.spec.js new file mode 100644 index 0000000..8b76f93 --- /dev/null +++ b/test/other_tests/create-and-find.spec.js @@ -0,0 +1,46 @@ +/* eslint-disable no-undef */ +const { Builder, Browser, By } = require("selenium-webdriver"); + +describe("Create New Template and Find it in Table", function () { + let driver; + + const templateNme = "Template for testing1"; + + before(async function () { + driver = await new Builder().forBrowser(Browser.CHROME).build(); + }); + + it("should create a New Template", async function () { + await driver.get("https://enm-dev.adma.ai/designer"); + + await driver.findElement(By.className("createNewBtn")).click(); + + await driver.findElement(By.id("name")).sendKeys(templateNme); + + await driver + .findElement(By.id("author")) + .sendKeys("Selenium Testing: Author"); + + await driver + .findElement(By.id("template_acknowledgment")) + .sendKeys("Selenium Testing: Acknowledgment"); + + await driver.findElement(By.id("create_new")).click(); + + await driver.sleep(5000); + + await driver.findElement(By.className("logoWrap")).click(); + }); + + it("should find a New Template in Table", async function () { + await driver + .findElement(By.className("search")) + .sendKeys(templateNme, Key.RETURN); + + await driver.sleep(5000); + }); + + after(async function () { + await driver.quit(); + }); +});