tests: new tests folders organization (#3716)

* new tests folders organizations

* 📝 (nightly_build.yml): update tests_folder path from "tests/scheduled" to "tests/core" to reflect the correct location of the tests folder

* renaming test folder

* changing e2e to integrations folder

* 📝 (frontend/tsconfig.json): update test file paths to reflect changes in folder structure for better organization and clarity

* change assets folder

* 📝 (frontend): update file paths to remove redundant 'core' directory in test assets

* 📝 (Document QA.spec.ts, Vector Store.spec.ts, fileUploadComponent.spec.ts): Update file paths to correctly reference test assets in integration and unit tests.

* github suggestions
This commit is contained in:
Cristhian Zanforlin Lousa 2024-09-09 14:45:30 -03:00 committed by GitHub
commit 6061951cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 60 additions and 55 deletions

View file

@ -12,7 +12,7 @@ on:
description: "Frontend Tests Folder"
required: false
type: string
default: "tests/end-to-end"
default: "tests/core"
workflow_dispatch:
inputs:
branch:
@ -35,7 +35,6 @@ on:
pull_request:
types: [synchronize, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@ -109,7 +108,14 @@ jobs:
# https://github.com/langchain-ai/langchain/blob/master/.github/workflows/check_diffs.yml
ci_success:
name: "CI Success"
needs: [test-backend,test-frontend,lint-backend,test-docs-build,set-ci-condition]
needs:
[
test-backend,
test-frontend,
lint-backend,
test-docs-build,
set-ci-condition,
]
if: always()
runs-on: ubuntu-latest
@ -123,4 +129,4 @@ jobs:
echo $JOBS_JSON
echo $RESULTS_JSON
echo "Exiting with $EXIT_CODE"
exit $EXIT_CODE
exit $EXIT_CODE

View file

@ -74,7 +74,7 @@ jobs:
needs: create-nightly-tag
uses: ./.github/workflows/typescript_test.yml
with:
tests_folder: "tests/end-to-end"
tests_folder: "tests/core"
ref: ${{ needs.create-nightly-tag.outputs.tag }}
secrets:
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"

View file

@ -99,9 +99,9 @@ fi
# Run Playwright tests
if [ "$ui" = true ]; then
TEST_COMMAND="npx playwright test tests/end-to-end --ui --project=chromium"
TEST_COMMAND="npx playwright test tests/core --ui --project=chromium"
else
TEST_COMMAND="npx playwright test tests/end-to-end --project=chromium"
TEST_COMMAND="npx playwright test tests/core --project=chromium"
fi
if ! PLAYWRIGHT_HTML_REPORT=playwright-report/e2e $TEST_COMMAND; then

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

View file

@ -68,7 +68,7 @@ test("user must be able to send an image on chat", async ({ page }) => {
await page.getByText("Playground", { exact: true }).click();
// Read the image file as a binary string
const filePath = "tests/end-to-end/assets/chain.png";
const filePath = "tests/assets/chain.png";
const fileContent = readFileSync(filePath, "base64");
// Create the DataTransfer and File objects within the browser context

View file

@ -78,10 +78,7 @@ test("add a flow into a folder by drag and drop", async ({ page }) => {
timeout: 50000,
});
const jsonContent = readFileSync(
"tests/end-to-end/assets/collection.json",
"utf-8",
);
const jsonContent = readFileSync("tests/assets/collection.json", "utf-8");
// Wait for the target element to be available before evaluation

View file

@ -28,7 +28,7 @@ test.describe("save component tests", () => {
// Read your file into a buffer.
const jsonContent = readFileSync(
"tests/end-to-end/assets/flow_group_test.json",
"tests/assets/flow_group_test.json",
"utf-8",
);

View file

@ -64,7 +64,9 @@ test("Document QA", async ({ page }) => {
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("icon-FileSearch2").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt"));
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForTimeout(1000);

View file

@ -96,7 +96,9 @@ test("Vector Store RAG", async ({ page }) => {
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("icon-FileSearch2").last().click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt"));
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForTimeout(1000);

View file

@ -54,7 +54,7 @@ test("should be able to upload a file", async ({ page }) => {
await page.getByTestId("icon-FileSearch2").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../end-to-end/assets/test_file.txt"),
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();

View file

@ -25,10 +25,7 @@ test.describe("drag and drop test", () => {
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
// Read your file into a buffer.
const jsonContent = readFileSync(
"tests/end-to-end/assets/collection.json",
"utf-8",
);
const jsonContent = readFileSync("tests/assets/collection.json", "utf-8");
// Create the DataTransfer and File
const dataTransfer = await page.evaluateHandle((data) => {

View file

@ -24,39 +24,40 @@
},
"include": [
"src",
"tests/end-to-end/saveComponents.spec.ts",
"tests/scheduled-end-to-end/actionsMainPage-shard-1.spec.ts",
"tests/end-to-end/auto_login.spec.ts",
"tests/scheduled-end-to-end/chatInputOutput.spec.ts",
"tests/scheduled-end-to-end/chatInputOutputUser-shard-2.spec.ts",
"tests/scheduled-end-to-end/codeAreaModalComponent.spec.ts",
"tests/scheduled-end-to-end/curlApiGeneration.spec.ts",
"tests/scheduled-end-to-end/deleteFlows.spec.ts",
"tests/scheduled-end-to-end/dragAndDrop.spec.ts",
"tests/scheduled-end-to-end/dropdownComponent.spec.ts",
"tests/scheduled-end-to-end/fileUploadComponent.spec.ts",
"tests/end-to-end/filterEdge.spec.ts",
"tests/scheduled-end-to-end/floatComponent.spec.ts",
"tests/scheduled-end-to-end/flowPage.spec.ts",
"tests/scheduled-end-to-end/flowSettings.spec.ts",
"tests/scheduled-end-to-end/generalBugs-shard-0.spec.ts",
"tests/end-to-end/globalVariables.spec.ts",
"tests/end-to-end/group.spec.ts",
"tests/scheduled-end-to-end/folders.spec.ts",
"tests/scheduled-end-to-end/inputComponent.spec.ts",
"tests/end-to-end/inputListComponent.spec.ts",
"tests/scheduled-end-to-end/intComponent.spec.ts",
"tests/end-to-end/keyPairListComponent.spec.ts",
"tests/scheduled-end-to-end/langflowShortcuts.spec.ts",
"tests/end-to-end/nestedComponent.spec.ts",
"tests/scheduled-end-to-end/promptModalComponent.spec.ts",
"tests/end-to-end/python_api_generation.spec.ts",
"tests/scheduled-end-to-end/textAreaModalComponent.spec.ts",
"tests/end-to-end/textInputOutput.spec.ts",
"tests/scheduled-end-to-end/toggleComponent.spec.ts",
"tests/end-to-end/tweaks_test.spec.ts",
"tests/scheduled-end-to-end/twoEdges.spec.ts",
"tests/scheduled-end-to-end/userSettings.spec.ts",
"tests/end-to-end/store.spec.ts",
"tests/end-to-end/logs.spec.ts" ]
"tests/core/saveComponents.spec.ts",
"tests/extended/actionsMainPage-shard-1.spec.ts",
"tests/core/auto_login.spec.ts",
"tests/core/unit/chatInputOutput.spec.ts",
"tests/extended/integrations/chatInputOutputUser-shard-2.spec.ts",
"tests/core/unit/codeAreaModalComponent.spec.ts",
"tests/extended/features/curlApiGeneration.spec.ts",
"tests/extended/features/deleteFlows.spec.ts",
"tests/extended/features/dragAndDrop.spec.ts",
"tests/core/unit/dropdownComponent.spec.ts",
"tests/core/unit/fileUploadComponent.spec.ts",
"tests/core/filterEdge.spec.ts",
"tests/core/unit/floatComponent.spec.ts",
"tests/extended/features/flowPage.spec.ts",
"tests/extended/features/flowSettings.spec.ts",
"tests/extended/regression/generalBugs-shard-0.spec.ts",
"tests/core/globalVariables.spec.ts",
"tests/core/group.spec.ts",
"tests/extended/folders.spec.ts",
"tests/core/unit/inputComponent.spec.ts",
"tests/core/inputListComponent.spec.ts",
"tests/core/unit/intComponent.spec.ts",
"tests/core/keyPairListComponent.spec.ts",
"tests/extended/features/langflowShortcuts.spec.ts",
"tests/core/nestedComponent.spec.ts",
"tests/core/unit/promptModalComponent.spec.ts",
"tests/core/python_api_generation.spec.ts",
"tests/core/unit/textAreaModalComponent.spec.ts",
"tests/core/textInputOutput.spec.ts",
"tests/core/unit/toggleComponent.spec.ts",
"tests/core/tweaks_test.spec.ts",
"tests/extended/features/twoEdges.spec.ts",
"tests/extended/features/userSettings.spec.ts",
"tests/core/store.spec.ts",
"tests/core/logs.spec.ts"
]
}