Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge develop in main #19

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/DataTable/TemplateTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -75,6 +80,11 @@ export default function TemplateTable({ data }) {
globalFilter: filtering,
rowSelection,
},
initialState: {
columnVisibility: {
uuid: false,
},
},
});

const setIdShosen = useSetIsShosen();
Expand Down Expand Up @@ -110,6 +120,7 @@ export default function TemplateTable({ data }) {
</tr>
))}
</thead>
{/* {console.log(table.getRowModel().rows[0]?.original?.uuid)} */}
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row) => (
<tbody>
Expand Down
8 changes: 7 additions & 1 deletion src/SurveyComp/SurveyComp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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() {
Expand Down
8 changes: 1 addition & 7 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 && <WizardPage />}
{UUID ? <TemplatePage uuid={UUID} /> : null}
{uuidParams || UUID ? <TemplatePage uuid={UUID} /> : null}
{!uuidParams && !wizardParams && <StartScreenComp />}
</>
);
Expand Down
46 changes: 46 additions & 0 deletions test/other_tests/create-and-find.spec.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
Loading