From 8d35fe816b8f6174b17dd12b1736fdf39b8f2540 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 26 Mar 2024 23:25:24 -0300 Subject: [PATCH 01/41] Add TypeScript test workflow --- .github/workflows/python_test.yml | 43 +++++++++++++++++++++++++++ .github/workflows/typescript_test.yml | 30 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/python_test.yml create mode 100644 .github/workflows/typescript_test.yml diff --git a/.github/workflows/python_test.yml b/.github/workflows/python_test.yml new file mode 100644 index 0000000000..629633f23d --- /dev/null +++ b/.github/workflows/python_test.yml @@ -0,0 +1,43 @@ +name: test + +on: + push: + branches: [main] + paths: + - "poetry.lock" + - "pyproject.toml" + - "src/backend/**" + pull_request: + branches: [dev] + paths: + - "poetry.lock" + - "pyproject.toml" + - "src/backend/**" + +env: + POETRY_VERSION: "1.8.2" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.10" + - "3.11" + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + steps: + - uses: actions/checkout@v4 + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "poetry" + - name: Install dependencies + run: poetry install + - name: Run unit tests + run: | + make tests diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml new file mode 100644 index 0000000000..1f8af6eb40 --- /dev/null +++ b/.github/workflows/typescript_test.yml @@ -0,0 +1,30 @@ +name: Run frontend tests + +on: + pull_request: + paths: + - "src/frontend/**" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "21" + + - name: Install dependencies + run: | + cd src/frontend + npm ci + + - name: Run tests + run: | + cd src/frontend + chmod +x run-tests.sh + ./run-tests.sh From 0e356fbe5cbe393f2f65188a4c511b5a072e7aed Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 26 Mar 2024 23:29:54 -0300 Subject: [PATCH 02/41] Update follow-redirects and katex versions --- src/frontend/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 2d61fd033e..10ad180738 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -5770,9 +5770,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -7079,9 +7079,9 @@ } }, "node_modules/katex": { - "version": "0.16.9", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", - "integrity": "sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==", + "version": "0.16.10", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.10.tgz", + "integrity": "sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" From 6d684a1fe4ac319f8ecc02e779d42d6b08155067 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 26 Mar 2024 23:40:32 -0300 Subject: [PATCH 03/41] Add Python setup and Poetry installation for backend --- .github/workflows/typescript_test.yml | 27 +++++- src/frontend/.github/workflows/playwright.yml | 27 ------ src/frontend/run-tests.sh | 83 +++++++++++++------ 3 files changed, 83 insertions(+), 54 deletions(-) delete mode 100644 src/frontend/.github/workflows/playwright.yml diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 1f8af6eb40..3866b95230 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -18,11 +18,36 @@ jobs: with: node-version: "21" - - name: Install dependencies + - name: Install Node.js dependencies run: | cd src/frontend npm ci + # Added step to set up Python + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" # Specify your Python version + + # Added step to install Poetry + - name: Install Poetry + run: | + pipx install poetry + + # Ensuring the Poetry bin directory is in PATH + - name: Add Poetry to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Configure Poetry + run: | + poetry config virtualenvs.create false + + # Assuming you have Python dependencies to install via Poetry + - name: Install Python dependencies + run: | + poetry install + + # Running tests as before - name: Run tests run: | cd src/frontend diff --git a/src/frontend/.github/workflows/playwright.yml b/src/frontend/.github/workflows/playwright.yml deleted file mode 100644 index 90b6b700d4..0000000000 --- a/src/frontend/.github/workflows/playwright.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Playwright Tests -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] -jobs: - test: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/src/frontend/run-tests.sh b/src/frontend/run-tests.sh index bb4535f5bc..362499fc17 100755 --- a/src/frontend/run-tests.sh +++ b/src/frontend/run-tests.sh @@ -3,6 +3,17 @@ # Default value for the --ui flag ui=false +# Absolute path to the project root directory +PROJECT_ROOT="../../" + +# Check if necessary commands are available +for cmd in npx poetry fuser; do + if ! command -v $cmd &> /dev/null; then + echo "Error: Required command '$cmd' is not installed. Aborting." + exit 1 + fi +done + # Parse command-line arguments while [[ $# -gt 0 ]]; do key="$1" @@ -23,54 +34,74 @@ done terminate_process_by_port() { port="$1" echo "Terminating process on port: $port" - fuser -k -n tcp "$port" # Forcefully terminate processes using the specified port - echo "Process terminated." + if ! fuser -k -n tcp "$port"; then + echo "Failed to terminate process on port $port. Please check manually." + else + echo "Process terminated." + fi } delete_temp() { - cd ../../ - echo "Deleting temp database" - rm temp - echo "Temp database deleted." + if cd "$PROJECT_ROOT"; then + echo "Deleting temp database" + rm -f temp && echo "Temp database deleted." || echo "Failed to delete temp database." + else + echo "Failed to navigate to project root for cleanup." + fi } - # Trap signals to ensure cleanup on script termination trap 'terminate_process_by_port 7860; terminate_process_by_port 3000; delete_temp' EXIT -# install playwright if there is not installed yet -npx playwright install +# Ensure the script is executed from the project root directory +if ! cd "$PROJECT_ROOT"; then + echo "Error: Failed to navigate to project root directory. Aborting." + exit 1 +fi -# Navigate to the project root directory (where the Makefile is located) -cd ../../ +# Install playwright if not installed yet +if ! npx playwright install; then + echo "Error: Failed to install Playwright. Aborting." + exit 1 +fi -# Start the frontend using 'make frontend' in the background +# Start the frontend make frontend & -# Give some time for the frontend to start (adjust sleep duration as needed) +# Adjust sleep duration as needed sleep 10 -#install backend -poetry install --extras deploy +# Install backend dependencies +if ! poetry install; then + echo "Error: Failed to install backend dependencies. Aborting." + exit 1 +fi -# Start the backend using 'make backend' in the background -LANGFLOW_DATABASE_URL=sqlite:///./temp LANGFLOW_AUTO_LOGIN=True poetry run langflow run --backend-only --port 7860 --host 0.0.0.0 --no-open-browser --env-file .env & +# Start the backend +if ! LANGFLOW_DATABASE_URL=sqlite:///./temp LANGFLOW_AUTO_LOGIN=True poetry run langflow run --backend-only --port 7860 --host 0.0.0.0 --no-open-browser --env-file .env &; then + echo "Error: Failed to start the backend. Aborting." + exit 1 +fi -# Give some time for the backend to start (adjust sleep duration as needed) +# Adjust sleep duration as needed sleep 25 # Navigate to the test directory -cd src/frontend +if ! cd src/frontend; then + echo "Error: Failed to navigate to test directory. Aborting." + exit 1 +fi -# Run Playwright tests with or without UI based on the --ui flag +# Run Playwright tests if [ "$ui" = true ]; then - PLAYWRIGHT_HTML_REPORT=playwright-report/e2e npx playwright test tests/end-to-end --ui --project=chromium + TEST_COMMAND="npx playwright test tests/end-to-end --ui --project=chromium" else - PLAYWRIGHT_HTML_REPORT=playwright-report/e2e npx playwright test tests/end-to-end --project=chromium + TEST_COMMAND="npx playwright test tests/end-to-end --project=chromium" fi -npx playwright show-report - -# After the tests are finished, you can add cleanup or teardown logic here if needed +if ! PLAYWRIGHT_HTML_REPORT=playwright-report/e2e $TEST_COMMAND; then + echo "Error: Playwright tests failed. Aborting." + exit 1 +fi -# The trap will automatically terminate processes by port on script exit +npx playwright show-report From b9bf53ea198957b22556cdc94fed3d9f88b81a79 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 26 Mar 2024 23:47:55 -0300 Subject: [PATCH 04/41] Update Poetry version and setup Python in workflows --- .github/workflows/test.yml | 2 +- .github/workflows/typescript_test.yml | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 10ab9b3244..629633f23d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ on: - "src/backend/**" env: - POETRY_VERSION: "1.5.0" + POETRY_VERSION: "1.8.2" jobs: build: diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 3866b95230..7d59a5897d 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -4,7 +4,8 @@ on: pull_request: paths: - "src/frontend/**" - +env: + POETRY_VERSION: "1.8.2" jobs: test: runs-on: ubuntu-latest @@ -25,22 +26,14 @@ jobs: # Added step to set up Python - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" # Specify your Python version + cache: "poetry" # Added step to install Poetry - - name: Install Poetry - run: | - pipx install poetry - - # Ensuring the Poetry bin directory is in PATH - - name: Add Poetry to PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Configure Poetry - run: | - poetry config virtualenvs.create false + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION # Assuming you have Python dependencies to install via Poetry - name: Install Python dependencies @@ -51,5 +44,4 @@ jobs: - name: Run tests run: | cd src/frontend - chmod +x run-tests.sh ./run-tests.sh From 8768061d73dfbb2443791daf52affaf2528daa25 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 26 Mar 2024 23:49:28 -0300 Subject: [PATCH 05/41] Add Poetry installation step to GitHub Actions workflow --- .github/workflows/typescript_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 7d59a5897d..da749357eb 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -24,6 +24,10 @@ jobs: cd src/frontend npm ci + # Added step to install Poetry + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION + # Added step to set up Python - name: Set up Python uses: actions/setup-python@v5 @@ -31,10 +35,6 @@ jobs: python-version: "3.10" # Specify your Python version cache: "poetry" - # Added step to install Poetry - - name: Install poetry - run: pipx install poetry==$POETRY_VERSION - # Assuming you have Python dependencies to install via Poetry - name: Install Python dependencies run: | From 2ee081aea4b70cdbf62c5e988d8c995cc078aaaa Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 00:09:49 -0300 Subject: [PATCH 06/41] Add Playwright report artifact upload and improve test script --- .github/workflows/typescript_test.yml | 10 ++++++++++ src/frontend/run-tests.sh | 25 ++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index da749357eb..068ae5e462 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -41,7 +41,17 @@ jobs: poetry install # Running tests as before + + - name: Install playwright browsers + run: npx playwright install --with-deps + - name: Run tests run: | cd src/frontend ./run-tests.sh + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 15 diff --git a/src/frontend/run-tests.sh b/src/frontend/run-tests.sh index 362499fc17..f04a096623 100755 --- a/src/frontend/run-tests.sh +++ b/src/frontend/run-tests.sh @@ -66,7 +66,7 @@ if ! npx playwright install; then fi # Start the frontend -make frontend & +make frontend > /dev/null 2>&1 & # Adjust sleep duration as needed sleep 10 @@ -78,17 +78,22 @@ if ! poetry install; then fi # Start the backend -if ! LANGFLOW_DATABASE_URL=sqlite:///./temp LANGFLOW_AUTO_LOGIN=True poetry run langflow run --backend-only --port 7860 --host 0.0.0.0 --no-open-browser --env-file .env &; then - echo "Error: Failed to start the backend. Aborting." - exit 1 -fi - +LANGFLOW_DATABASE_URL=sqlite:///./temp LANGFLOW_AUTO_LOGIN=True poetry run langflow run --backend-only --port 7860 --host 0.0.0.0 --no-open-browser > /dev/null 2>&1 & +backend_pid=$! # Capture PID of the backend process # Adjust sleep duration as needed sleep 25 # Navigate to the test directory if ! cd src/frontend; then echo "Error: Failed to navigate to test directory. Aborting." + kill $backend_pid # Terminate the backend process if navigation fails + echo "Backend process terminated." + exit 1 +fi + +# Check if backend is running +if ! lsof -i :7860; then + echo "Error: Backend is not running. Aborting." exit 1 fi @@ -104,4 +109,10 @@ if ! PLAYWRIGHT_HTML_REPORT=playwright-report/e2e $TEST_COMMAND; then exit 1 fi -npx playwright show-report +if [ "$ui" = true ]; then + echo "Opening Playwright report..." + npx playwright show-report +fi + + +trap 'terminate_process_by_port 7860; terminate_process_by_port 3000; delete_temp; kill $backend_pid 2>/dev/null' EXIT \ No newline at end of file From 0d272be832c6973e533958e71a6739c4cce374e2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 09:35:35 -0300 Subject: [PATCH 07/41] Update Playwright test configuration and add global teardown script --- .github/workflows/typescript_test.yml | 3 +- src/frontend/playwright.config.ts | 34 +++++++++++-------- .../tests/end-to-end/auto_login.spec.ts | 10 +++--- .../tests/end-to-end/dragAndDrop.spec.ts | 2 +- src/frontend/tests/end-to-end/group.spec.ts | 2 +- .../tests/end-to-end/saveComponents.spec.ts | 2 +- src/frontend/tests/globalTeardown.ts | 12 +++++++ 7 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 src/frontend/tests/globalTeardown.ts diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 068ae5e462..6cccf1864a 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -48,7 +48,8 @@ jobs: - name: Run tests run: | cd src/frontend - ./run-tests.sh + npx playwright test --reporter=list + - uses: actions/upload-artifact@v4 if: always() with: diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index 30e7216c09..5999bb30a5 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: "http://127.0.0.1:3000", + baseURL: "http://127.0.0.1:3000", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", @@ -43,6 +43,10 @@ export default defineConfig({ name: "firefox", use: { ...devices["Desktop Firefox"] }, }, + { + name: "cleanup db", + testMatch: /global\.Teardown\.ts/, + }, // { // name: "webkit", @@ -69,18 +73,20 @@ export default defineConfig({ // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // }, ], - /* Run your local dev server before starting the tests */ - // webServer: [ - // { - // command: "npm run backend", - // reuseExistingServer: !process.env.CI, - // timeout: 120 * 1000, - // }, - // { - // command: "npm run start", - // url: "http://127.0.0.1:3000", - // reuseExistingServer: !process.env.CI, - // }, - // ], + webServer: [ + { + command: + "poetry run uvicorn --factory langflow.main:create_app --host 127.0.0.1 --port 7860", + port: 7860, + env: { + LANGFLOW_DATABASE_URL: "sqlite:///./temp", + LANGFLOW_AUTO_LOGIN: "true", + VITE_PROXY_TARGET: "http://127.0.0.1:7860", + }, + + reuseExistingServer: !process.env.CI, + timeout: 15000, + }, + ], }); diff --git a/src/frontend/tests/end-to-end/auto_login.spec.ts b/src/frontend/tests/end-to-end/auto_login.spec.ts index 7e847cefd8..2828e35536 100644 --- a/src/frontend/tests/end-to-end/auto_login.spec.ts +++ b/src/frontend/tests/end-to-end/auto_login.spec.ts @@ -5,24 +5,24 @@ test.beforeEach(async ({ page }) => { }); test.describe("Auto_login tests", () => { test("auto_login sign in", async ({ page }) => { - await page.goto("http:localhost:3000/"); + await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); }); test("auto_login block_admin", async ({ page }) => { - await page.goto("http:localhost:3000/"); + await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await page.waitForTimeout(5000); - await page.goto("http:localhost:3000/login"); + await page.goto("/login"); await page.locator('//*[@id="new-project-btn"]').click(); await page.waitForTimeout(5000); - await page.goto("http:localhost:3000/admin"); + await page.goto("/admin"); await page.locator('//*[@id="new-project-btn"]').click(); await page.waitForTimeout(5000); - await page.goto("http:localhost:3000/admin/login"); + await page.goto("/admin/login"); await page.locator('//*[@id="new-project-btn"]').click(); await page.waitForTimeout(5000); }); diff --git a/src/frontend/tests/end-to-end/dragAndDrop.spec.ts b/src/frontend/tests/end-to-end/dragAndDrop.spec.ts index bcaa08db06..d6830d003d 100644 --- a/src/frontend/tests/end-to-end/dragAndDrop.spec.ts +++ b/src/frontend/tests/end-to-end/dragAndDrop.spec.ts @@ -7,7 +7,7 @@ test.beforeEach(async ({ page }) => { test.describe("drag and drop test", () => { /// test("drop collection", async ({ page }) => { - await page.goto("http:localhost:3000/"); + await page.goto("/"); await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); // Read your file into a buffer. const jsonContent = readFileSync( diff --git a/src/frontend/tests/end-to-end/group.spec.ts b/src/frontend/tests/end-to-end/group.spec.ts index fe717b8f85..7335026c93 100644 --- a/src/frontend/tests/end-to-end/group.spec.ts +++ b/src/frontend/tests/end-to-end/group.spec.ts @@ -7,7 +7,7 @@ test.beforeEach(async ({ page }) => { test.describe("group node test", () => { /// test("group and ungroup updating values", async ({ page }) => { - await page.goto("http:localhost:3000/"); + await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await page.getByTestId("blank-flow").click(); diff --git a/src/frontend/tests/end-to-end/saveComponents.spec.ts b/src/frontend/tests/end-to-end/saveComponents.spec.ts index c9a6925531..79e731a54c 100644 --- a/src/frontend/tests/end-to-end/saveComponents.spec.ts +++ b/src/frontend/tests/end-to-end/saveComponents.spec.ts @@ -14,7 +14,7 @@ test.describe("save component tests", () => { /// test("save group component tests", async ({ page }) => { - await page.goto("http:localhost:3000/"); + await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await page.getByTestId("blank-flow").click(); diff --git a/src/frontend/tests/globalTeardown.ts b/src/frontend/tests/globalTeardown.ts new file mode 100644 index 0000000000..af9655373a --- /dev/null +++ b/src/frontend/tests/globalTeardown.ts @@ -0,0 +1,12 @@ +// tests/globalTeardown.ts +import { unlinkSync } from "fs"; +import { resolve } from "path"; + +export default async () => { + try { + unlinkSync(resolve(__dirname, "../temp")); + console.log("Successfully removed the temp database"); + } catch (error) { + console.error("Error while removing the temp database:", error); + } +}; From d6b8c67eca5988547bbd3f9d27dba027e1f686af Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 09:36:04 -0300 Subject: [PATCH 08/41] Update path for playwright-report directory --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 6cccf1864a..97930a1b80 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -54,5 +54,5 @@ jobs: if: always() with: name: playwright-report - path: playwright-report/ + path: src/frontend/playwright-report/ retention-days: 15 From e44a70f3dfa198bc12756d3a76691a4c1e97331e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 09:39:52 -0300 Subject: [PATCH 09/41] Update timeout value in playwright.config.ts --- src/frontend/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index 5999bb30a5..c31a3dd64a 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -86,7 +86,7 @@ export default defineConfig({ }, reuseExistingServer: !process.env.CI, - timeout: 15000, + timeout: 120 * 1000, }, ], }); From 91192a07e7c537e6126625051290050aecc591d4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 09:55:17 -0300 Subject: [PATCH 10/41] Update page URLs in end-to-end tests --- .../tests/end-to-end/codeAreaModalComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/dropdownComponent.spec.ts | 6 +++--- src/frontend/tests/end-to-end/floatComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/flowPage.spec.ts | 4 ++-- src/frontend/tests/end-to-end/inputComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/intComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/keyPairListComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/langflowShortcuts.spec.ts | 2 +- src/frontend/tests/end-to-end/nestedComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/promptModalComponent.spec.ts | 2 +- src/frontend/tests/end-to-end/toggleComponent.spec.ts | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts index 1ee611fc44..56cbb61a53 100644 --- a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts +++ b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("CodeAreaModalComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/dropdownComponent.spec.ts b/src/frontend/tests/end-to-end/dropdownComponent.spec.ts index 52f8da0a10..2f840b7a42 100644 --- a/src/frontend/tests/end-to-end/dropdownComponent.spec.ts +++ b/src/frontend/tests/end-to-end/dropdownComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("dropDownComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); @@ -255,6 +255,6 @@ class AmazonBedrockComponent(CustomComponent): `; await page.locator("textarea").fill(emptyOptionsCode); - await page.getByRole('button', { name: 'Check & Save' }).click(); + await page.getByRole("button", { name: "Check & Save" }).click(); await page.getByText("No parameters are available for display.").isVisible(); -}) +}); diff --git a/src/frontend/tests/end-to-end/floatComponent.spec.ts b/src/frontend/tests/end-to-end/floatComponent.spec.ts index ec4363b388..039e653c14 100644 --- a/src/frontend/tests/end-to-end/floatComponent.spec.ts +++ b/src/frontend/tests/end-to-end/floatComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("FloatComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/flowPage.spec.ts b/src/frontend/tests/end-to-end/flowPage.spec.ts index 69f812f8a3..d72e70c20d 100644 --- a/src/frontend/tests/end-to-end/flowPage.spec.ts +++ b/src/frontend/tests/end-to-end/flowPage.spec.ts @@ -6,12 +6,12 @@ test.beforeEach(async ({ page }) => { test.describe("Flow Page tests", () => { async function goToFlowPage(page: Page) { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.getByRole("button", { name: "New Project" }).click(); } test("save", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/inputComponent.spec.ts b/src/frontend/tests/end-to-end/inputComponent.spec.ts index 002a0e0cbb..dddc4f5688 100644 --- a/src/frontend/tests/end-to-end/inputComponent.spec.ts +++ b/src/frontend/tests/end-to-end/inputComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("InputComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/intComponent.spec.ts b/src/frontend/tests/end-to-end/intComponent.spec.ts index c591cab51e..e74c550593 100644 --- a/src/frontend/tests/end-to-end/intComponent.spec.ts +++ b/src/frontend/tests/end-to-end/intComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("IntComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts b/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts index 53d4543592..7f7b39a2ca 100644 --- a/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts +++ b/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("KeypairListComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts b/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts index e3d2e39163..f8812e7ffc 100644 --- a/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts +++ b/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts @@ -13,7 +13,7 @@ test("LangflowShortcuts", async ({ page }) => { control = "Meta"; } - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(1000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/nestedComponent.spec.ts b/src/frontend/tests/end-to-end/nestedComponent.spec.ts index 3eed92059f..347c8e4896 100644 --- a/src/frontend/tests/end-to-end/nestedComponent.spec.ts +++ b/src/frontend/tests/end-to-end/nestedComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("NestedComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/promptModalComponent.spec.ts b/src/frontend/tests/end-to-end/promptModalComponent.spec.ts index cadf3a0889..98ff674449 100644 --- a/src/frontend/tests/end-to-end/promptModalComponent.spec.ts +++ b/src/frontend/tests/end-to-end/promptModalComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("PromptTemplateComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); diff --git a/src/frontend/tests/end-to-end/toggleComponent.spec.ts b/src/frontend/tests/end-to-end/toggleComponent.spec.ts index 7875261a41..f6b4cf2f7d 100644 --- a/src/frontend/tests/end-to-end/toggleComponent.spec.ts +++ b/src/frontend/tests/end-to-end/toggleComponent.spec.ts @@ -4,7 +4,7 @@ test.beforeEach(async ({ page }) => { test.setTimeout(120000); }); test("ToggleComponent", async ({ page }) => { - await page.goto("http://localhost:3000/"); + await page.goto("/"); await page.waitForTimeout(2000); await page.locator('//*[@id="new-project-btn"]').click(); From 48f9f5e1bb9ad30ed9988c23ec830d7b656e3368 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:13:10 -0300 Subject: [PATCH 11/41] Update GitHub Actions workflow and Playwright configuration --- .github/workflows/typescript_test.yml | 51 ++++++++++++++++++++++----- src/frontend/playwright.config.ts | 27 +++----------- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 97930a1b80..fec8a59888 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -7,9 +7,13 @@ on: env: POETRY_VERSION: "1.8.2" jobs: - test: + playwright-tests: runs-on: ubuntu-latest - + strategy: + fail-fast: false + matrix: + shardIndex: [1, 2, 3, 4] + shardTotal: [4] steps: - name: Checkout code uses: actions/checkout@v4 @@ -17,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "21" + node-version: 21 - name: Install Node.js dependencies run: | @@ -48,11 +52,42 @@ jobs: - name: Run tests run: | cd src/frontend - npx playwright test --reporter=list + run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - - uses: actions/upload-artifact@v4 + - name: Upload blob report to GitHub Actions Artifacts if: always() + uses: actions/upload-artifact@v4 + with: + name: blob-report-${{ matrix.shardIndex }} + path: blob-report + retention-days: 1 + merge-reports: + # Merge reports after playwright-tests, even if some shards have failed + if: always() + needs: [playwright-tests] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 21 + - name: Install dependencies + run: npm ci + + - name: Download blob reports from GitHub Actions Artifacts + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: blob-report-* + merge-multiple: true + + - name: Merge into HTML Report + run: npx playwright merge-reports --reporter html ./all-blob-reports + + - name: Upload HTML report + uses: actions/upload-artifact@v4 with: - name: playwright-report - path: src/frontend/playwright-report/ - retention-days: 15 + name: html-report--attempt-${{ github.run_attempt }} + path: playwright-report + retention-days: 14 diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index c31a3dd64a..f37c990d0a 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -20,9 +20,10 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 2 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: [ - ["html", { open: "never", outputFolder: "playwright-report/test-results" }], - ], + // reporter: [ + // ["html", { open: "never", outputFolder: "playwright-report/test-results" }], + // ], + reporter: process.env.CI ? "blob" : "html", /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ @@ -52,26 +53,6 @@ export default defineConfig({ // name: "webkit", // use: { ...devices["Desktop Safari"] }, // }, - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, ], /* Run your local dev server before starting the tests */ webServer: [ From 2504550b14caf37ab6b69a1f60fd3b712a45e22e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:29:49 -0300 Subject: [PATCH 12/41] Update TypeScript test workflow --- .github/workflows/typescript_test.yml | 72 ++++++++++++++++----------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index fec8a59888..2bb16d19cc 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -1,13 +1,20 @@ -name: Run frontend tests +name: Run Frontend Tests on: pull_request: paths: - "src/frontend/**" + env: POETRY_VERSION: "1.8.2" + NODE_VERSION: "21" + PYTHON_VERSION: "3.10" + # Define the directory where Playwright browsers will be installed. + # Adjust if your project uses a different path. + PLAYWRIGHT_BROWSERS_PATH: "~/.cache/ms-playwright" + jobs: - playwright-tests: + setup-and-test: runs-on: ubuntu-latest strategy: fail-fast: false @@ -21,38 +28,48 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 21 + node-version: ${{ env.NODE_VERSION }} + cache: "npm" - name: Install Node.js dependencies run: | cd src/frontend npm ci - # Added step to install Poetry - - name: Install poetry - run: pipx install poetry==$POETRY_VERSION + - name: Cache Playwright browsers + uses: actions/cache@v4 + with: + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-playwright- + + - name: Install playwright browsers + run: npx playwright install --with-deps - # Added step to set up Python - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.10" # Specify your Python version + python-version: ${{ env.PYTHON_VERSION }} cache: "poetry" - # Assuming you have Python dependencies to install via Poetry + - name: Install Poetry + run: pip install "poetry==${{ env.POETRY_VERSION }}" + + - name: Cache Poetry virtualenv + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} + restore-keys: ${{ runner.os }}-poetry- + - name: Install Python dependencies run: | poetry install - # Running tests as before - - - name: Install playwright browsers - run: npx playwright install --with-deps - - - name: Run tests + - name: Run Playwright Tests run: | cd src/frontend - run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - name: Upload blob report to GitHub Actions Artifacts if: always() @@ -61,29 +78,28 @@ jobs: name: blob-report-${{ matrix.shardIndex }} path: blob-report retention-days: 1 - merge-reports: - # Merge reports after playwright-tests, even if some shards have failed - if: always() - needs: [playwright-tests] + merge-reports: + needs: setup-and-test runs-on: ubuntu-latest + if: always() steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v3 with: - node-version: 21 - - name: Install dependencies - run: npm ci + node-version: ${{ env.NODE_VERSION }} - name: Download blob reports from GitHub Actions Artifacts uses: actions/download-artifact@v4 with: path: all-blob-reports - pattern: blob-report-* - merge-multiple: true - name: Merge into HTML Report - run: npx playwright merge-reports --reporter html ./all-blob-reports + run: | + npx playwright merge-reports --reporter html ./all-blob-reports - name: Upload HTML report uses: actions/upload-artifact@v4 From 9e560830e524eb022ef8e60c9536fdf5b49d0cc1 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:32:11 -0300 Subject: [PATCH 13/41] Add pattern and merge-multiple options to artifact download --- .github/workflows/typescript_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 2bb16d19cc..2b95092475 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -96,6 +96,8 @@ jobs: uses: actions/download-artifact@v4 with: path: all-blob-reports + pattern: blob-report-* + merge-multiple: true - name: Merge into HTML Report run: | From bc7d2c32df211f38f156342b2420442177c2cec4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:35:17 -0300 Subject: [PATCH 14/41] Update TypeScript test workflow to install Poetry --- .github/workflows/typescript_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 2b95092475..c674360cd2 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -46,15 +46,15 @@ jobs: - name: Install playwright browsers run: npx playwright install --with-deps + - name: Install Poetry + run: pipx install "poetry==${{ env.POETRY_VERSION }}" + - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} cache: "poetry" - - name: Install Poetry - run: pip install "poetry==${{ env.POETRY_VERSION }}" - - name: Cache Poetry virtualenv uses: actions/cache@v4 with: From 801cd7e9cacf09b65bcfa090917ba7f20a0b12b4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:42:28 -0300 Subject: [PATCH 15/41] Add cache steps for Playwright and Poetry --- .github/workflows/typescript_test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index c674360cd2..78c4aeca1b 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -38,6 +38,7 @@ jobs: - name: Cache Playwright browsers uses: actions/cache@v4 + id: playwright-cache with: path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} @@ -45,6 +46,7 @@ jobs: - name: Install playwright browsers run: npx playwright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' - name: Install Poetry run: pipx install "poetry==${{ env.POETRY_VERSION }}" @@ -57,6 +59,7 @@ jobs: - name: Cache Poetry virtualenv uses: actions/cache@v4 + id: poetry-cache with: path: ~/.cache/pypoetry key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} @@ -65,6 +68,7 @@ jobs: - name: Install Python dependencies run: | poetry install + if: steps.poetry-cache.outputs.cache-hit != 'true' - name: Run Playwright Tests run: | From de44e95e8bc42b6739fdc372e99dbb72c081bc3f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 10:47:33 -0300 Subject: [PATCH 16/41] Update PLAYWRIGHT_BROWSERS_PATH in TypeScript test workflow --- .github/workflows/typescript_test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 78c4aeca1b..9905e2c887 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -11,7 +11,7 @@ env: PYTHON_VERSION: "3.10" # Define the directory where Playwright browsers will be installed. # Adjust if your project uses a different path. - PLAYWRIGHT_BROWSERS_PATH: "~/.cache/ms-playwright" + PLAYWRIGHT_BROWSERS_PATH: "ms-playwright" jobs: setup-and-test: @@ -45,7 +45,9 @@ jobs: restore-keys: ${{ runner.os }}-playwright- - name: Install playwright browsers - run: npx playwright install --with-deps + run: | + cd src/frontend + npx playwright install --with-deps if: steps.playwright-cache.outputs.cache-hit != 'true' - name: Install Poetry From 408cdac9805bdcd267da4f6ae0880b62b4dbb62b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:01:13 -0300 Subject: [PATCH 17/41] Add 'stuff/' to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a2ff9a8837..110961fbde 100644 --- a/.gitignore +++ b/.gitignore @@ -262,3 +262,4 @@ src/backend/base/langflow/frontend/ .docker scratchpad* chroma*/* +stuff/* \ No newline at end of file From 010b3d5a6b284c8027f9f91ee0493056b7ec03ab Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:04:13 -0300 Subject: [PATCH 18/41] Remove caching of Poetry virtualenv --- .github/workflows/typescript_test.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 9905e2c887..873ff01b62 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -59,18 +59,9 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} cache: "poetry" - - name: Cache Poetry virtualenv - uses: actions/cache@v4 - id: poetry-cache - with: - path: ~/.cache/pypoetry - key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} - restore-keys: ${{ runner.os }}-poetry- - - name: Install Python dependencies run: | poetry install - if: steps.poetry-cache.outputs.cache-hit != 'true' - name: Run Playwright Tests run: | From 50184b6f63008caffcb3b082daf520a6e3e035b4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:04:19 -0300 Subject: [PATCH 19/41] Update frontend tests to use Playwright for UI testing --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cb8991f563..bad35eef38 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,9 @@ run_frontend: tests_frontend: ifeq ($(UI), true) - cd src/frontend && ./run-tests.sh --ui + cd src/frontend && npx playwright test --ui --project=chromium else - cd src/frontend && ./run-tests.sh + cd src/frontend && npx playwright test --project=chromium endif run_cli: From d08c29b8f698e0e39d45618a8799092d1ed1dd0b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:44:58 -0300 Subject: [PATCH 20/41] Add global teardown for removing temp database --- src/frontend/playwright.config.ts | 6 ++---- src/frontend/tests/globalTeardown.ts | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index f37c990d0a..e323a8225f 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -33,6 +33,8 @@ export default defineConfig({ trace: "on-first-retry", }, + globalTeardown: require.resolve("./tests/globalTeardown.ts"), + /* Configure projects for major browsers */ projects: [ { @@ -44,10 +46,6 @@ export default defineConfig({ name: "firefox", use: { ...devices["Desktop Firefox"] }, }, - { - name: "cleanup db", - testMatch: /global\.Teardown\.ts/, - }, // { // name: "webkit", diff --git a/src/frontend/tests/globalTeardown.ts b/src/frontend/tests/globalTeardown.ts index af9655373a..110978d426 100644 --- a/src/frontend/tests/globalTeardown.ts +++ b/src/frontend/tests/globalTeardown.ts @@ -1,11 +1,24 @@ // tests/globalTeardown.ts -import { unlinkSync } from "fs"; -import { resolve } from "path"; + +import fs from "fs"; +import path from "path"; export default async () => { try { - unlinkSync(resolve(__dirname, "../temp")); - console.log("Successfully removed the temp database"); + console.log("Removing the temp database"); + // Check if the file exists in the path + // this file is in src/frontend/tests/globalTeardown.ts + // temp is in src/frontend/temp + const tempDbPath = path.join(__dirname, "..", "temp"); + console.log("tempDbPath", tempDbPath); + // Remove the temp database + fs.rmSync(tempDbPath); + // Check if the file is removed + if (!fs.existsSync(tempDbPath)) { + console.log("Successfully removed the temp database"); + } else { + console.error("Error while removing the temp database"); + } } catch (error) { console.error("Error while removing the temp database:", error); } From 78269f8a6487a971013d0a22b9d423a885734661 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:53:42 -0300 Subject: [PATCH 21/41] Add cache-hit condition to setup-node and setup-python steps --- .github/workflows/typescript_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 873ff01b62..a662571501 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -27,6 +27,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 + id: setup-node with: node-version: ${{ env.NODE_VERSION }} cache: "npm" @@ -35,6 +36,7 @@ jobs: run: | cd src/frontend npm ci + if: ${{ steps.setup-node.outputs.cache-hit != 'true' }} - name: Cache Playwright browsers uses: actions/cache@v4 @@ -48,13 +50,14 @@ jobs: run: | cd src/frontend npx playwright install --with-deps - if: steps.playwright-cache.outputs.cache-hit != 'true' + if: ${{ steps.playwright-cache.outputs.cache-hit != 'true' }} - name: Install Poetry run: pipx install "poetry==${{ env.POETRY_VERSION }}" - name: Set up Python uses: actions/setup-python@v5 + id: setup-python with: python-version: ${{ env.PYTHON_VERSION }} cache: "poetry" @@ -62,6 +65,7 @@ jobs: - name: Install Python dependencies run: | poetry install + if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} - name: Run Playwright Tests run: | From 2c23bc0d2bd7e2c8800d6c0af6a42d50de02fc40 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:56:25 -0300 Subject: [PATCH 22/41] Add new file to .gitignore and update ignored files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 110961fbde..fb5586bc52 100644 --- a/.gitignore +++ b/.gitignore @@ -262,4 +262,5 @@ src/backend/base/langflow/frontend/ .docker scratchpad* chroma*/* -stuff/* \ No newline at end of file +stuff/* +src/frontend/playwright-report/index.html From 090da0e90b4f1d48a902621cd1407f3a55c4607f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 11:59:48 -0300 Subject: [PATCH 23/41] Update playwright cache key in TypeScript test workflow --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index a662571501..ab1f4f2177 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -43,7 +43,7 @@ jobs: id: playwright-cache with: path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_BROWSERS_PATH }}-${{ hashFiles('src/frontend/package-lock.json') }} restore-keys: ${{ runner.os }}-playwright- - name: Install playwright browsers From c76056e492b9ac93512429673e692af17df44cfa Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 12:45:29 -0300 Subject: [PATCH 24/41] Update path for blob-report in GitHub workflow --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index ab1f4f2177..492e182aac 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -77,7 +77,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: blob-report-${{ matrix.shardIndex }} - path: blob-report + path: src/frontend/blob-report retention-days: 1 merge-reports: From 5b1057ded7718325ea8c7d91f805e43bc72311a8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 12:48:19 -0300 Subject: [PATCH 25/41] Update path for playwright cache --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 492e182aac..cc7352cf0c 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -42,7 +42,7 @@ jobs: uses: actions/cache@v4 id: playwright-cache with: - path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + path: src/frontend/${{ env.PLAYWRIGHT_BROWSERS_PATH }} key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_BROWSERS_PATH }}-${{ hashFiles('src/frontend/package-lock.json') }} restore-keys: ${{ runner.os }}-playwright- From ca53dde7dcc5816bfec5b02ea53e94747bd01ee4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 12:52:51 -0300 Subject: [PATCH 26/41] Update dependency installation in workflows --- .github/workflows/test.yml | 4 +++- .github/workflows/typescript_test.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 629633f23d..4a70c2300d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,9 @@ jobs: python-version: ${{ matrix.python-version }} cache: "poetry" - name: Install dependencies - run: poetry install + run: | + poetry env use ${{ matrix.python-version }} + poetry install - name: Run unit tests run: | make tests diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index cc7352cf0c..3e47314333 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -64,6 +64,7 @@ jobs: - name: Install Python dependencies run: | + poetry env use ${{ env.PYTHON_VERSION }} poetry install if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} From 621a2a27add583ced977851779232d4d2e946f79 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 12:58:02 -0300 Subject: [PATCH 27/41] Update baseURL in playwright.config.ts --- src/frontend/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index e323a8225f..dc739f8978 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://127.0.0.1:3000", + baseURL: "http://localhost:3000", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", From 47a99ed6aae1e0fe433da0f369463f8d56f46440 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 13:09:36 -0300 Subject: [PATCH 28/41] Update baseURL in playwright.config.ts --- src/frontend/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index dc739f8978..bd5558125b 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://localhost:3000", + baseURL: "http://localhost:3000/", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", From ebda6d684bb21078574e912b6a8333c14361bd3e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 13:49:08 -0300 Subject: [PATCH 29/41] Refactor test timeouts --- src/frontend/playwright.config.ts | 4 +++- src/frontend/tests/end-to-end/auto_login.spec.ts | 4 ++-- src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/dragAndDrop.spec.ts | 4 ++-- src/frontend/tests/end-to-end/dropdownComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/floatComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/flowPage.spec.ts | 4 ++-- src/frontend/tests/end-to-end/group.spec.ts | 4 ++-- src/frontend/tests/end-to-end/inputComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/intComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/keyPairListComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/langflowShortcuts.spec.ts | 4 ++-- src/frontend/tests/end-to-end/nestedComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/promptModalComponent.spec.ts | 4 ++-- src/frontend/tests/end-to-end/saveComponents.spec.ts | 4 ++-- src/frontend/tests/end-to-end/toggleComponent.spec.ts | 4 ++-- 16 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index bd5558125b..f18b2a9d98 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -12,7 +12,7 @@ import { defineConfig, devices } from "@playwright/test"; export default defineConfig({ testDir: "./tests", /* Run tests in files in parallel */ - fullyParallel: false, + fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retry on CI only */ @@ -20,6 +20,7 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 2 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + timeout: 120 * 1000, // reporter: [ // ["html", { open: "never", outputFolder: "playwright-report/test-results" }], // ], @@ -63,6 +64,7 @@ export default defineConfig({ LANGFLOW_AUTO_LOGIN: "true", VITE_PROXY_TARGET: "http://127.0.0.1:7860", }, + stdout: "ignore", reuseExistingServer: !process.env.CI, timeout: 120 * 1000, diff --git a/src/frontend/tests/end-to-end/auto_login.spec.ts b/src/frontend/tests/end-to-end/auto_login.spec.ts index 2828e35536..582e52bb81 100644 --- a/src/frontend/tests/end-to-end/auto_login.spec.ts +++ b/src/frontend/tests/end-to-end/auto_login.spec.ts @@ -1,7 +1,7 @@ import { test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(16000); - test.setTimeout(140000); + // await page.waitForTimeout(16000); + // test.setTimeout(140000); }); test.describe("Auto_login tests", () => { test("auto_login sign in", async ({ page }) => { diff --git a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts index 56cbb61a53..2dac888acf 100644 --- a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts +++ b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(2000); - test.setTimeout(120000); + // await page.waitForTimeout(2000); + // test.setTimeout(120000); }); test("CodeAreaModalComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/dragAndDrop.spec.ts b/src/frontend/tests/end-to-end/dragAndDrop.spec.ts index d6830d003d..144835cd0a 100644 --- a/src/frontend/tests/end-to-end/dragAndDrop.spec.ts +++ b/src/frontend/tests/end-to-end/dragAndDrop.spec.ts @@ -1,8 +1,8 @@ import { expect, test } from "@playwright/test"; import { readFileSync } from "fs"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(3000); - test.setTimeout(120000); + // await page.waitForTimeout(3000); + // test.setTimeout(120000); }); test.describe("drag and drop test", () => { /// diff --git a/src/frontend/tests/end-to-end/dropdownComponent.spec.ts b/src/frontend/tests/end-to-end/dropdownComponent.spec.ts index 2f840b7a42..a0995a3e0c 100644 --- a/src/frontend/tests/end-to-end/dropdownComponent.spec.ts +++ b/src/frontend/tests/end-to-end/dropdownComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(4000); - test.setTimeout(120000); + // await page.waitForTimeout(4000); + // test.setTimeout(120000); }); test("dropDownComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/floatComponent.spec.ts b/src/frontend/tests/end-to-end/floatComponent.spec.ts index 039e653c14..2e0a2a8ad9 100644 --- a/src/frontend/tests/end-to-end/floatComponent.spec.ts +++ b/src/frontend/tests/end-to-end/floatComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(5000); - test.setTimeout(120000); + // await page.waitForTimeout(5000); + // test.setTimeout(120000); }); test("FloatComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/flowPage.spec.ts b/src/frontend/tests/end-to-end/flowPage.spec.ts index d72e70c20d..a5e628a537 100644 --- a/src/frontend/tests/end-to-end/flowPage.spec.ts +++ b/src/frontend/tests/end-to-end/flowPage.spec.ts @@ -1,7 +1,7 @@ import { Page, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(6000); - test.setTimeout(120000); + // await page.waitForTimeout(6000); + // test.setTimeout(120000); }); test.describe("Flow Page tests", () => { diff --git a/src/frontend/tests/end-to-end/group.spec.ts b/src/frontend/tests/end-to-end/group.spec.ts index 7335026c93..f563bc1fe4 100644 --- a/src/frontend/tests/end-to-end/group.spec.ts +++ b/src/frontend/tests/end-to-end/group.spec.ts @@ -1,8 +1,8 @@ import { expect, test } from "@playwright/test"; import { readFileSync } from "fs"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(7000); - test.setTimeout(120000); + // await page.waitForTimeout(7000); + // test.setTimeout(120000); }); test.describe("group node test", () => { /// diff --git a/src/frontend/tests/end-to-end/inputComponent.spec.ts b/src/frontend/tests/end-to-end/inputComponent.spec.ts index dddc4f5688..c702da4f5e 100644 --- a/src/frontend/tests/end-to-end/inputComponent.spec.ts +++ b/src/frontend/tests/end-to-end/inputComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(8000); - test.setTimeout(120000); + // await page.waitForTimeout(8000); + // test.setTimeout(120000); }); test("InputComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/intComponent.spec.ts b/src/frontend/tests/end-to-end/intComponent.spec.ts index e74c550593..a802e898a5 100644 --- a/src/frontend/tests/end-to-end/intComponent.spec.ts +++ b/src/frontend/tests/end-to-end/intComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(9000); - test.setTimeout(120000); + // await page.waitForTimeout(9000); + // test.setTimeout(120000); }); test("IntComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts b/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts index 7f7b39a2ca..1ef6eeb2f9 100644 --- a/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts +++ b/src/frontend/tests/end-to-end/keyPairListComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(20000); - test.setTimeout(120000); + // await page.waitForTimeout(20000); + // test.setTimeout(120000); }); test("KeypairListComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts b/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts index f8812e7ffc..157fc44593 100644 --- a/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts +++ b/src/frontend/tests/end-to-end/langflowShortcuts.spec.ts @@ -1,8 +1,8 @@ import { expect, test } from "@playwright/test"; import uaParser from "ua-parser-js"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(11000); - test.setTimeout(120000); + // await page.waitForTimeout(11000); + // test.setTimeout(120000); }); test("LangflowShortcuts", async ({ page }) => { const getUA = await page.evaluate(() => navigator.userAgent); diff --git a/src/frontend/tests/end-to-end/nestedComponent.spec.ts b/src/frontend/tests/end-to-end/nestedComponent.spec.ts index 347c8e4896..053c72db23 100644 --- a/src/frontend/tests/end-to-end/nestedComponent.spec.ts +++ b/src/frontend/tests/end-to-end/nestedComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(12000); - test.setTimeout(120000); + // await page.waitForTimeout(12000); + // test.setTimeout(120000); }); test("NestedComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/promptModalComponent.spec.ts b/src/frontend/tests/end-to-end/promptModalComponent.spec.ts index 98ff674449..f0d118094f 100644 --- a/src/frontend/tests/end-to-end/promptModalComponent.spec.ts +++ b/src/frontend/tests/end-to-end/promptModalComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(13000); - test.setTimeout(120000); + // await page.waitForTimeout(13000); + // test.setTimeout(120000); }); test("PromptTemplateComponent", async ({ page }) => { await page.goto("/"); diff --git a/src/frontend/tests/end-to-end/saveComponents.spec.ts b/src/frontend/tests/end-to-end/saveComponents.spec.ts index 79e731a54c..772894b5a8 100644 --- a/src/frontend/tests/end-to-end/saveComponents.spec.ts +++ b/src/frontend/tests/end-to-end/saveComponents.spec.ts @@ -1,8 +1,8 @@ import { Page, expect, test } from "@playwright/test"; import { readFileSync } from "fs"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(14000); - test.setTimeout(120000); + // await page.waitForTimeout(14000); + // test.setTimeout(120000); }); test.describe("save component tests", () => { async function saveComponent(page: Page, pattern: RegExp, n: number) { diff --git a/src/frontend/tests/end-to-end/toggleComponent.spec.ts b/src/frontend/tests/end-to-end/toggleComponent.spec.ts index f6b4cf2f7d..cb29b6627f 100644 --- a/src/frontend/tests/end-to-end/toggleComponent.spec.ts +++ b/src/frontend/tests/end-to-end/toggleComponent.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; test.beforeEach(async ({ page }) => { - await page.waitForTimeout(15000); - test.setTimeout(120000); + // await page.waitForTimeout(15000); + // test.setTimeout(120000); }); test("ToggleComponent", async ({ page }) => { await page.goto("/"); From f2bdd3589e0e275fcca4914d963a3d2bfea99fcd Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 13:49:17 -0300 Subject: [PATCH 30/41] Remove playwright-report index.html file --- src/frontend/playwright-report/index.html | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/frontend/playwright-report/index.html diff --git a/src/frontend/playwright-report/index.html b/src/frontend/playwright-report/index.html deleted file mode 100644 index 131efdcae9..0000000000 --- a/src/frontend/playwright-report/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Document - - - - - From b908cf0ef818f700ee22bde71957d37cc3e6295a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 13:56:30 -0300 Subject: [PATCH 31/41] Add npm run start command to playwright.config.ts --- src/frontend/playwright.config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index f18b2a9d98..2857f95be1 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -62,12 +62,18 @@ export default defineConfig({ env: { LANGFLOW_DATABASE_URL: "sqlite:///./temp", LANGFLOW_AUTO_LOGIN: "true", - VITE_PROXY_TARGET: "http://127.0.0.1:7860", }, stdout: "ignore", reuseExistingServer: !process.env.CI, timeout: 120 * 1000, }, + { + command: "npm run start", + port: 3000, + env: { + VITE_PROXY_TARGET: "http://127.0.0.1:7860", + }, + }, ], }); From ed55ffc6f7364ae75abab8de5f513d83c9700c16 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 13:57:20 -0300 Subject: [PATCH 32/41] Update npm start command in playwright.config.ts --- src/frontend/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index 2857f95be1..59f30c4bae 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -69,7 +69,7 @@ export default defineConfig({ timeout: 120 * 1000, }, { - command: "npm run start", + command: "npm start", port: 3000, env: { VITE_PROXY_TARGET: "http://127.0.0.1:7860", From b3513f6106a15c301556f25ae9a3af3bc75f76b7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:00:28 -0300 Subject: [PATCH 33/41] Update Playwright browser caching and installation --- .github/workflows/typescript_test.yml | 36 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 3e47314333..1047ce47f9 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -38,19 +38,33 @@ jobs: npm ci if: ${{ steps.setup-node.outputs.cache-hit != 'true' }} - - name: Cache Playwright browsers - uses: actions/cache@v4 + # Attempt to restore the correct Playwright browser binaries based on the + # currently installed version of Playwright (The browser binary versions + # may change with Playwright versions). + # Note: Playwright's cache directory is hard coded because that's what it + # says to do in the docs. There doesn't appear to be a command that prints + # it out for us. + - uses: actions/cache@v3 id: playwright-cache with: - path: src/frontend/${{ env.PLAYWRIGHT_BROWSERS_PATH }} - key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_BROWSERS_PATH }}-${{ hashFiles('src/frontend/package-lock.json') }} - restore-keys: ${{ runner.os }}-playwright- - - - name: Install playwright browsers - run: | - cd src/frontend - npx playwright install --with-deps - if: ${{ steps.playwright-cache.outputs.cache-hit != 'true' }} + path: "~/.cache/ms-playwright" + key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package.json') }}" + # As a fallback, if the Playwright version has changed, try use the + # most recently cached version. There's a good chance that at least one + # of the browser binary versions haven't been updated, so Playwright can + # skip installing that in the next step. + # Note: When falling back to an old cache, `cache-hit` (used below) + # will be `false`. This allows us to restore the potentially out of + # date cache, but still let Playwright decide if it needs to download + # new binaries or not. + restore-keys: | + ${{ runner.os }}-playwright- + + # If the Playwright browser binaries weren't able to be restored, we tell + # paywright to install everything for us. + - name: Install Playwright's dependencies + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: npx playwright install --with-deps - name: Install Poetry run: pipx install "poetry==${{ env.POETRY_VERSION }}" From daf447a15ce6324f730a4e3297d30be35dcf36f9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:03:01 -0300 Subject: [PATCH 34/41] Update playwright cache path --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 1047ce47f9..cc764bb941 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/cache@v3 id: playwright-cache with: - path: "~/.cache/ms-playwright" + path: "./ms-playwright" key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package.json') }}" # As a fallback, if the Playwright version has changed, try use the # most recently cached version. There's a good chance that at least one From 933e3ec8e207a55a231dc06f6fc36e98473f08ec Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:05:52 -0300 Subject: [PATCH 35/41] Update playwright cache path --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index cc764bb941..15728cc254 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/cache@v3 id: playwright-cache with: - path: "./ms-playwright" + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package.json') }}" # As a fallback, if the Playwright version has changed, try use the # most recently cached version. There's a good chance that at least one From e34cad047d8ec1081b781d61452b4a4955313927 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:08:35 -0300 Subject: [PATCH 36/41] Update actions/cache version to v4 --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 15728cc254..401eda6459 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -44,7 +44,7 @@ jobs: # Note: Playwright's cache directory is hard coded because that's what it # says to do in the docs. There doesn't appear to be a command that prints # it out for us. - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: playwright-cache with: path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} From e3df4e02fd4f9e6628b6d2f1e78a72667aa22781 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:11:11 -0300 Subject: [PATCH 37/41] Update Playwright cache key to use package-lock.json --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 401eda6459..400cc88090 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -48,7 +48,7 @@ jobs: id: playwright-cache with: path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package.json') }}" + key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }}" # As a fallback, if the Playwright version has changed, try use the # most recently cached version. There's a good chance that at least one # of the browser binary versions haven't been updated, so Playwright can From fa575d9822f6a1e82de37abed1a4009df329bd7c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:15:30 -0300 Subject: [PATCH 38/41] Update Playwright cache and install dependencies --- .github/workflows/typescript_test.yml | 48 ++++++++++++++++++--------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 400cc88090..7fb4786113 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -44,27 +44,43 @@ jobs: # Note: Playwright's cache directory is hard coded because that's what it # says to do in the docs. There doesn't appear to be a command that prints # it out for us. - - uses: actions/cache@v4 + # - uses: actions/cache@v4 + # id: playwright-cache + # with: + # path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + # key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }}" + # # As a fallback, if the Playwright version has changed, try use the + # # most recently cached version. There's a good chance that at least one + # # of the browser binary versions haven't been updated, so Playwright can + # # skip installing that in the next step. + # # Note: When falling back to an old cache, `cache-hit` (used below) + # # will be `false`. This allows us to restore the potentially out of + # # date cache, but still let Playwright decide if it needs to download + # # new binaries or not. + # restore-keys: | + # ${{ runner.os }}-playwright- + - name: Cache playwright binaries + uses: actions/cache@v4 id: playwright-cache with: - path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - key: "${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }}" - # As a fallback, if the Playwright version has changed, try use the - # most recently cached version. There's a good chance that at least one - # of the browser binary versions haven't been updated, so Playwright can - # skip installing that in the next step. - # Note: When falling back to an old cache, `cache-hit` (used below) - # will be `false`. This allows us to restore the potentially out of - # date cache, but still let Playwright decide if it needs to download - # new binaries or not. - restore-keys: | - ${{ runner.os }}-playwright- + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }} + - run: npm ci + - run: | + cd src/frontend + npxplaywright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + - run: | + cd src/frontend + npx playwright install-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' # If the Playwright browser binaries weren't able to be restored, we tell # paywright to install everything for us. - - name: Install Playwright's dependencies - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: npx playwright install --with-deps + # - name: Install Playwright's dependencies + # if: steps.playwright-cache.outputs.cache-hit != 'true' + # run: npx playwright install --with-deps - name: Install Poetry run: pipx install "poetry==${{ env.POETRY_VERSION }}" From 18a77ebf6a2839c01817cf9a47c237764ba74539 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:16:39 -0300 Subject: [PATCH 39/41] Fix typo in Playwright installation command --- .github/workflows/typescript_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 7fb4786113..f808e5c7fc 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -69,7 +69,7 @@ jobs: - run: npm ci - run: | cd src/frontend - npxplaywright install --with-deps + npx playwright install --with-deps if: steps.playwright-cache.outputs.cache-hit != 'true' - run: | cd src/frontend From bb81d24923f24d0f45a9e88f5f8606e8815d7d98 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:21:07 -0300 Subject: [PATCH 40/41] Fix npm ci command in TypeScript test workflow --- .github/workflows/typescript_test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index f808e5c7fc..39ed2f54bb 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -66,7 +66,9 @@ jobs: path: | ~/.cache/ms-playwright key: ${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }} - - run: npm ci + - run: | + cd src/frontend + npm ci - run: | cd src/frontend npx playwright install --with-deps From 3eb07250d422465464093e807a0a914c6a0d40fa Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 14:27:23 -0300 Subject: [PATCH 41/41] Update TypeScript test workflow --- .github/workflows/typescript_test.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 39ed2f54bb..a75327785f 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -66,14 +66,18 @@ jobs: path: | ~/.cache/ms-playwright key: ${{ runner.os }}-playwright-${{ hashFiles('src/frontend/package-lock.json') }} - - run: | + - name: Install Frontend dependencies + run: | cd src/frontend npm ci - - run: | + + - name: Install Playwright's browser binaries + run: | cd src/frontend npx playwright install --with-deps if: steps.playwright-cache.outputs.cache-hit != 'true' - - run: | + - name: Install Playwright's dependencies + run: | cd src/frontend npx playwright install-deps if: steps.playwright-cache.outputs.cache-hit != 'true'