Skip to content

Commit

Permalink
tests: add new tests to tableComponent (#3627)
Browse files Browse the repository at this point in the history
* refactor: modularized categories and fixed Discover More not appearing

* refactor: modularized categories and fixed Discover More not appearing

* refactor: modularized categories and fixed Discover More not appearing

* refactor: add end-to-end test for interacting with table input component

* refactor: Remove duplicate ID in filterSidebar.spec.ts and remove commented code in tableInputComponent.spec.ts
  • Loading branch information
Cristhianzl authored Aug 30, 2024
1 parent 1c87a80 commit 70ac197
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 153 deletions.
59 changes: 19 additions & 40 deletions src/frontend/tests/end-to-end/filterEdge-shard-0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,25 @@ test("user must see on handle hover a tooltip with possibility connections", asy
}

await visibleElementHandle.hover().then(async () => {
await expect(
page.getByTestId("available-output-inputs").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-chains").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-textsplitters").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-retrievers").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-prototypes").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-embeddings").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-data").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-vectorstores").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-memories").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-models").first(),
).toBeVisible();

await expect(
page.getByTestId("available-output-outputs").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-agents").first(),
).toBeVisible();
await expect(
page.getByTestId("available-output-helpers").first(),
).toBeVisible();
const testIds = [
"available-output-inputs",
"available-output-chains",
"available-output-textsplitters",
"available-output-retrievers",
"available-output-prototypes",
"available-output-embeddings",
"available-output-data",
"available-output-vectorstores",
"available-output-memories",
"available-output-models",
"available-output-outputs",
"available-output-agents",
"available-output-helpers",
];

await Promise.all(
testIds.map((id) => expect(page.getByTestId(id).first()).toBeVisible()),
);

await page.getByTestId("icon-X").click();
await page.waitForTimeout(500);
Expand Down
148 changes: 88 additions & 60 deletions src/frontend/tests/end-to-end/filterSidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,73 +54,101 @@ test("user must see on handle click the possibility connections - LLMChain", asy

await page.getByTestId("handle-apirequest-shownode-urls-left").click();

await expect(page.getByTestId("disclosure-inputs")).toBeVisible();
await expect(page.getByTestId("disclosure-outputs")).toBeVisible();
await expect(page.getByTestId("disclosure-prompts")).toBeVisible();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await expect(page.getByTestId("disclosure-chains")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();

await expect(page.getByTestId("inputsChat Input")).toBeVisible();
await expect(page.getByTestId("outputsChat Output")).toBeVisible();
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).toBeVisible();
await expect(page.getByTestId("agentsCSVAgent")).toBeVisible();
await expect(page.getByTestId("chainsConversationChain")).toBeVisible();
await expect(page.getByTestId("prototypesConditional Router")).toBeVisible();
let disclosureTestIds = [
"disclosure-inputs",
"disclosure-outputs",
"disclosure-prompts",
"disclosure-models",
"disclosure-helpers",
"disclosure-agents",
"disclosure-chains",
"disclosure-prototypes",
];

let specificTestIds = [
"inputsChat Input",
"outputsChat Output",
"promptsPrompt",
"modelsAmazon Bedrock",
"helpersChat Memory",
"agentsCSVAgent",
"chainsConversationChain",
"prototypesConditional Router",
];

await Promise.all(
disclosureTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);

await Promise.all(
specificTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);

await page.getByPlaceholder("Search").click();

await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await expect(page.getByTestId("outputsChat Output")).not.toBeVisible();
await expect(page.getByTestId("promptsPrompt")).not.toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).not.toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).not.toBeVisible();
await expect(page.getByTestId("agentsTool Calling Agent")).not.toBeVisible();
await expect(page.getByTestId("chainsConversationChain")).not.toBeVisible();
await expect(
page.getByTestId("prototypesConditional Router"),
).not.toBeVisible();
let notVisibleTestIds = [
"inputsChat Input",
"outputsChat Output",
"promptsPrompt",
"modelsAmazon Bedrock",
"helpersChat Memory",
"agentsTool Calling Agent",
"chainsConversationChain",
"prototypesConditional Router",
];

await Promise.all(
notVisibleTestIds.map((id) =>
expect(page.getByTestId(id)).not.toBeVisible(),
),
);

await page.getByTestId("handle-apirequest-shownode-headers-left").click();

await expect(page.getByTestId("disclosure-data")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-vector stores")).toBeVisible();
await expect(page.getByTestId("disclosure-utilities")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await expect(page.getByTestId("disclosure-retrievers")).toBeVisible();
await expect(page.getByTestId("disclosure-text splitters")).toBeVisible();
await expect(page.getByTestId("disclosure-tools")).toBeVisible();

await expect(page.getByTestId("dataAPI Request")).toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await expect(page.getByTestId("prototypesSub Flow")).toBeVisible();
await expect(
page.getByTestId("retrieversSelf Query Retriever"),
).toBeVisible();
await expect(
page.getByTestId("textsplittersCharacterTextSplitter"),
).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
disclosureTestIds = [
"disclosure-data",
"disclosure-helpers",
"disclosure-vector stores",
"disclosure-utilities",
"disclosure-prototypes",
"disclosure-retrievers",
"disclosure-text splitters",
"disclosure-tools",
];

specificTestIds = [
"dataAPI Request",
"helpersChat Memory",
"vectorstoresAstra DB",
"toolsSearch API",
"prototypesSub Flow",
"retrieversSelf Query Retriever",
"textsplittersCharacterTextSplitter",
];

await Promise.all(
disclosureTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);

await Promise.all(
specificTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);

await page.getByPlaceholder("Search").click();

await expect(page.getByTestId("dataAPI Request")).not.toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).not.toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
await expect(page.getByTestId("prototypesSub Flow")).not.toBeVisible();
await expect(
page.getByTestId("retrieversSelf Query Retriever"),
).not.toBeVisible();
await expect(
page.getByTestId("textsplittersCharacterTextSplitter"),
).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
notVisibleTestIds = [
"dataAPI Request",
"helpersChat Memory",
"vectorstoresAstra DB",
"toolsSearch API",
"prototypesSub Flow",
"retrieversSelf Query Retriever",
"textsplittersCharacterTextSplitter",
];

await Promise.all(
notVisibleTestIds.map((id) =>
expect(page.getByTestId(id)).not.toBeVisible(),
),
);
});
112 changes: 59 additions & 53 deletions src/frontend/tests/scheduled-end-to-end/filterEdge-shard-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,62 +70,68 @@ test("user must see on handle click the possibility connections - RetrievalQA",
force: true,
});

await expect(page.getByTestId("disclosure-inputs")).toBeVisible();
await expect(page.getByTestId("disclosure-outputs")).toBeVisible();
await expect(page.getByTestId("disclosure-data")).toBeVisible();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-vector stores")).toBeVisible();
await expect(page.getByTestId("disclosure-embeddings")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await expect(page.getByTestId("disclosure-chains")).toBeVisible();
await expect(page.getByTestId("disclosure-memories")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await expect(page.getByTestId("disclosure-retrievers")).toBeVisible();
await expect(page.getByTestId("disclosure-text splitters")).toBeVisible();

await expect(page.getByTestId("inputsChat Input").first()).toBeVisible();
await expect(page.getByTestId("outputsChat Output").first()).toBeVisible();
await expect(page.getByTestId("dataAPI Request").first()).toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock").first()).toBeVisible();
await expect(page.getByTestId("helpersChat Memory").first()).toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB").first()).toBeVisible();
await expect(
page.getByTestId("embeddingsAmazon Bedrock Embeddings").first(),
).toBeVisible();
await expect(
page.getByTestId("agentsTool Calling Agent").first(),
).toBeVisible();
await expect(
page.getByTestId("chainsConversationChain").first(),
).toBeVisible();
await expect(
page.getByTestId("memoriesAstra DB Chat Memory").first(),
).toBeVisible();
await expect(
page.getByTestId("prototypesConditional Router").first(),
).toBeVisible();
await expect(
page.getByTestId("retrieversSelf Query Retriever").first(),
).toBeVisible();
await expect(
page.getByTestId("textsplittersCharacterTextSplitter").first(),
).toBeVisible();
const disclosureTestIds = [
"disclosure-inputs",
"disclosure-outputs",
"disclosure-data",
"disclosure-models",
"disclosure-helpers",
"disclosure-vector stores",
"disclosure-embeddings",
"disclosure-agents",
"disclosure-chains",
"disclosure-memories",
"disclosure-prototypes",
"disclosure-retrievers",
"disclosure-text splitters",
];

const elementTestIds = [
"inputsChat Input",
"outputsChat Output",
"dataAPI Request",
"modelsAmazon Bedrock",
"helpersChat Memory",
"vectorstoresAstra DB",
"embeddingsAmazon Bedrock Embeddings",
"agentsTool Calling Agent",
"chainsConversationChain",
"memoriesAstra DB Chat Memory",
"prototypesConditional Router",
"retrieversSelf Query Retriever",
"textsplittersCharacterTextSplitter",
];

await Promise.all(
disclosureTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);

await Promise.all(
elementTestIds.map((id) =>
expect(page.getByTestId(id).first()).toBeVisible(),
),
);

await page.getByPlaceholder("Search").click();

await expect(page.getByTestId("model_specsVertexAI")).not.toBeVisible();
await expect(page.getByTestId("model_specsCTransformers")).not.toBeVisible();
await expect(page.getByTestId("model_specsAmazon Bedrock")).not.toBeVisible();
await expect(page.getByTestId("modelsAzure OpenAI")).not.toBeVisible();
await expect(
page.getByTestId("model_specsAzureChatOpenAI"),
).not.toBeVisible();
await expect(page.getByTestId("model_specsChatAnthropic")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatLiteLLM")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatVertexAI")).not.toBeVisible();
const notVisibleModelSpecsTestIds = [
"model_specsVertexAI",
"model_specsCTransformers",
"model_specsAmazon Bedrock",
"modelsAzure OpenAI",
"model_specsAzureChatOpenAI",
"model_specsChatAnthropic",
"model_specsChatLiteLLM",
"model_specsChatOllama",
"model_specsChatOpenAI",
"model_specsChatVertexAI",
];

await Promise.all(
notVisibleModelSpecsTestIds.map((id) =>
expect(page.getByTestId(id)).not.toBeVisible(),
),
);

const chainInputElements1 = await page
.getByTestId("handle-retrievalqa-shownode-llm-left")
Expand Down
Loading

0 comments on commit 70ac197

Please sign in to comment.