diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index a75327785..0cb3213d8 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -19,8 +19,8 @@ jobs: strategy: fail-fast: false matrix: - shardIndex: [1, 2, 3, 4] - shardTotal: [4] + shardIndex: [1] + shardTotal: [1] steps: - name: Checkout code uses: actions/checkout@v4 @@ -38,27 +38,6 @@ jobs: npm ci if: ${{ steps.setup-node.outputs.cache-hit != 'true' }} - # 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@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 @@ -82,32 +61,26 @@ jobs: 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 Poetry - run: pipx install "poetry==${{ env.POETRY_VERSION }}" - - - name: Set up Python - uses: actions/setup-python@v5 - id: setup-python + - name: Set up Python ${{ env.PYTHON_VERSION }} + Poetry ${{ env.POETRY_VERSION }} + uses: "./.github/actions/poetry_caching" with: python-version: ${{ env.PYTHON_VERSION }} - cache: "poetry" - + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }} - name: Install Python dependencies run: | poetry env use ${{ env.PYTHON_VERSION }} poetry install - if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} + + - name: create .env + run: | + touch .env + echo "${{ secrets.ENV_VARS }}" > .env - name: Run Playwright Tests run: | cd src/frontend - npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + npx playwright test - name: Upload blob report to GitHub Actions Artifacts if: always() diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 971c9eee1..7b2e691b6 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -38,6 +38,7 @@ "clsx": "^1.2.1", "cmdk": "^1.0.0", "dompurify": "^3.0.5", + "dotenv": "^16.4.5", "esbuild": "^0.17.19", "framer-motion": "^11.0.6", "lodash": "^4.17.21", @@ -5671,6 +5672,17 @@ "tslib": "^2.0.3" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/src/frontend/package.json b/src/frontend/package.json index fd27d8bd6..6e3fbd344 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -33,6 +33,7 @@ "clsx": "^1.2.1", "cmdk": "^1.0.0", "dompurify": "^3.0.5", + "dotenv": "^16.4.5", "esbuild": "^0.17.19", "framer-motion": "^11.0.6", "lodash": "^4.17.21", diff --git a/src/frontend/playwright.config.ts b/src/frontend/playwright.config.ts index 649c42390..9535e0a15 100644 --- a/src/frontend/playwright.config.ts +++ b/src/frontend/playwright.config.ts @@ -1,14 +1,17 @@ import { defineConfig, devices } from "@playwright/test"; +import * as dotenv from "dotenv"; +import path from "path"; +dotenv.config(); +dotenv.config({ path: path.resolve(__dirname, "../../.env") }); /** * Read environment variables from file. * https://github.com/motdotla/dotenv */ -// require('dotenv').config(); - /** * See https://playwright.dev/docs/test-configuration. */ + export default defineConfig({ testDir: "./tests", /* Run tests in files in parallel */ @@ -18,7 +21,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ - workers: 3, + workers: 1, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ timeout: 120 * 1000, // reporter: [ @@ -40,24 +43,32 @@ export default defineConfig({ projects: [ { name: "chromium", - use: { ...devices["Desktop Chrome"] }, + use: { + ...devices["Desktop Chrome"], + contextOptions: { + // chromium-specific permissions + permissions: ["clipboard-read", "clipboard-write"], + }, + }, }, { name: "firefox", - use: { ...devices["Desktop Firefox"] }, + use: { + ...devices["Desktop Firefox"], + launchOptions: { + firefoxUserPrefs: { + "dom.events.asyncClipboard.readText": true, + "dom.events.testing.asyncClipboard": true, + }, + }, + }, }, - - // { - // name: "webkit", - // use: { ...devices["Desktop Safari"] }, - // }, ], - /* Run your local dev server before starting the tests */ webServer: [ { command: - "poetry run uvicorn --factory langflow.main:create_app --host 127.0.0.1 --port 7860", + "poetry run uvicorn --factory langflow.main:create_app --host 127.0.0.1 --port 7860 --loop asyncio", port: 7860, env: { LANGFLOW_DATABASE_URL: "sqlite:///./temp", @@ -65,7 +76,7 @@ export default defineConfig({ }, stdout: "ignore", - reuseExistingServer: !process.env.CI, + reuseExistingServer: true, timeout: 120 * 1000, }, { diff --git a/src/frontend/src/components/headerComponent/components/menuBar/index.tsx b/src/frontend/src/components/headerComponent/components/menuBar/index.tsx index 756143217..d61f64620 100644 --- a/src/frontend/src/components/headerComponent/components/menuBar/index.tsx +++ b/src/frontend/src/components/headerComponent/components/menuBar/index.tsx @@ -83,7 +83,9 @@ export const MenuBar = ({ diff --git a/src/frontend/src/controllers/API/api.tsx b/src/frontend/src/controllers/API/api.tsx index 033a0e648..8084dfeb9 100644 --- a/src/frontend/src/controllers/API/api.tsx +++ b/src/frontend/src/controllers/API/api.tsx @@ -24,6 +24,9 @@ function ApiInterceptor() { async (error: AxiosError) => { if (error.response?.status === 403 || error.response?.status === 401) { if (!autoLogin) { + if (error?.config?.url?.includes("github")) { + return Promise.reject(error); + } const stillRefresh = checkErrorCount(); if (!stillRefresh) { return Promise.reject(error); diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx index b15b61df3..93a0db3c3 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx @@ -135,7 +135,12 @@ export default function ChatMessage({ alt={!chat.isSend ? "robot_image" : "male_technology"} /> - + {chat.sender_name} diff --git a/src/frontend/src/modals/shareModal/index.tsx b/src/frontend/src/modals/shareModal/index.tsx index 8272bddbe..f37c166f3 100644 --- a/src/frontend/src/modals/shareModal/index.tsx +++ b/src/frontend/src/modals/shareModal/index.tsx @@ -237,6 +237,7 @@ export default function ShareModal({ onCheckedChange={(event: boolean) => { setSharePublic(event); }} + data-testid="public-checkbox" />