tests: organize playwright tests by feature suites and optimize CI runtime (#4687)
* starting realocating components FE * tagging tests * 📝 (.github/workflows/typescript_test.yml): remove unnecessary comment before the Playwright test execution step to improve readability and maintainability * 📝 (.github/changes-filter.yaml): Update paths in changes-filter.yaml to categorize different sections of the project for testing purposes 🔧 (.github/workflows/typescript_test.yml): Refactor workflow to use paths-filter action for determining test suites based on changes in different project sections * ✨ (changes-filter.yaml): reorganize and update paths for test categories, starter projects, components, workspace, api, and database ✨ (components): add new components for GradientWrapper, pageLayout, and paginatorComponent 🔧 (MainPage): update import path for PageLayout component 🔧 (SettingsPage): update import path for PageLayout component 🔧 (StorePage): update import path for PageLayout component * ✨ (frontend): Update import paths for components to use common directory instead of core directory for better organization and consistency 🔧 (frontend): Remove duplicate import of PaginatorComponent in various files and import it from the common directory to reduce redundancy and improve maintainability * 🔧 (changes-filter.yaml): remove unnecessary release section from changes-filter.yaml 🔧 (typescript_test.yml): refactor workflow to support input suites and release flag for test runs * 📝 (changes-filter.yaml): remove unnecessary entries from components section and add missing entries to workspace section for better organization and filtering of changes 🔧 (changes-filter.yaml): update changes-filter.yaml to include missing utils files in the frontend/src/utils directory 🔧 (typescript_test.yml): remove redundant code block that sets SUITES variable to default values as it is no longer needed due to changes in the changes-filter.yaml file * ✨ (actionsMainPage-shard-1.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (store-shard-2.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (generalBugs-shard-4.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (generalBugs-shard-9.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (deleteComponents.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (deleteFlows.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity ✨ (dragAndDrop.spec.ts): Refactor drag and drop test to improve readability and maintainability ✨ (flowPage.spec.ts): Refactor save test in Flow Page to improve readability and maintainability ✨ (store-shard-0.spec.ts): Refactor Store test to improve readability and maintainability ✨ (store-shard-1.spec.ts): Refactor Store test to improve readability and maintainability ✨ (store-shard-3.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency ✨ (userSettings.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency ✨ (general-bugs-shard-3909.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency 📝 (frontend): Update test tags in regression tests to remove unnecessary tags for better organization and clarity 📝 (frontend): Update test file paths in tsconfig.json to match the new file structure for consistency and maintainability * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * Update paths-filter action to v3 and adjust filter configuration file * Add logging to matrix setup in TypeScript test workflow * Refactor decisionFlow.spec.ts to improve test setup and execution flow * Refactor import paths for genericIconComponent and shadTooltipComponent in PlaygroundButton component * feat: add release input to CI workflows for enhanced deployment control * Fix: Correct 'release' input type in CI workflow configuration * [autofix.ci] apply automated fixes * Refactor Blog Writer test: streamline setup and interaction steps * Refactor test cases to improve modal handling and streamline API key input logic * Add test grep pattern to GitHub Actions workflow for targeted test execution - Introduced `test_grep` output in the `determine-test-suite` job to generate a grep pattern based on changed files or input suites. - Updated Playwright test execution to use the generated grep pattern, allowing for more targeted test runs. - Enhanced the `Set Matrix` step to include tag processing for test filtering. * Enhance tag filtering in test workflow with regex lookaheads * Fix syntax for default suite input in GitHub Actions workflow * Update GitHub Actions to handle empty suite input for release builds * Escape regex lookaheads and quotes for GitHub Actions in test workflow * Update regex pattern and quote escaping in TypeScript test workflow * Use single quotes for echo command in GitHub Actions script * Refactor tag handling in GitHub Actions to use OR logic for grep patterns * 🔧 (FlowPage/index.tsx): Remove unnecessary empty line to improve code readability and consistency * 📝 (FlowPage/index.tsx): add missing line break for better code readability * Refactor import path and reorder CSS classes for consistency in UpdateAllComponents component * [autofix.ci] apply automated fixes * Update import path for PaginatorComponent in AdminPage index.tsx * ✨ (logs.spec.ts): introduce a new variable 'modalCount' to keep track of the number of modals opened in the test suite * 📝 (filterSidebar.spec.ts): remove unnecessary test steps related to filter removal and sidebar interactions to simplify and improve test focus on main functionality * ✅ (logs.spec.ts): add tests to ensure proper interaction with logs feature in the frontend application * ✅ (similarity.spec.ts): add a test tag for release and components to categorize the test case 💡 (similarity.spec.ts): add a comment to explain the purpose of the test case and the condition for skipping the test * ✅ (decisionFlow.spec.ts): add missing newline before async function declaration to improve code readability * ✅ (textInputOutput.spec.ts): skip the test for TextInputOutputComponent to exclude it from the test suite temporarily --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
1b3785ee95
commit
989cefd0ac
331 changed files with 10386 additions and 9694 deletions
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
|
|
@ -13,6 +13,11 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
default: "tests/core"
|
||||
release:
|
||||
description: "Release"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
|
|
@ -89,6 +94,7 @@ jobs:
|
|||
uses: ./.github/workflows/typescript_test.yml
|
||||
with:
|
||||
tests_folder: ${{ inputs.frontend-tests-folder }}
|
||||
release: ${{ inputs.release || false }}
|
||||
secrets:
|
||||
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
|
||||
STORE_API_KEY: "${{ secrets.STORE_API_KEY }}"
|
||||
|
|
@ -99,6 +105,7 @@ jobs:
|
|||
name: Lint Backend
|
||||
uses: ./.github/workflows/lint-py.yml
|
||||
|
||||
|
||||
test-docs-build:
|
||||
needs: path-filter
|
||||
if: ${{ needs.path-filter.outputs.docs == 'true' }}
|
||||
|
|
|
|||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
|
@ -49,6 +49,7 @@ jobs:
|
|||
with:
|
||||
python-versions: "['3.10', '3.11', '3.12']"
|
||||
frontend-tests-folder: "tests"
|
||||
release: true
|
||||
|
||||
release-base:
|
||||
name: Release Langflow Base
|
||||
|
|
|
|||
130
.github/workflows/typescript_test.yml
vendored
130
.github/workflows/typescript_test.yml
vendored
|
|
@ -8,6 +8,16 @@ on:
|
|||
STORE_API_KEY:
|
||||
required: true
|
||||
inputs:
|
||||
suites:
|
||||
description: "Test suites to run (JSON array)"
|
||||
required: false
|
||||
type: string
|
||||
default: '["starter-projects", "components", "workspace", "api", "database"]'
|
||||
release:
|
||||
description: "Whether this is a release build"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
tests_folder:
|
||||
description: "(Optional) Tests to run"
|
||||
required: false
|
||||
|
|
@ -19,6 +29,16 @@ on:
|
|||
type: string
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
suites:
|
||||
description: "Test suites to run (JSON array)"
|
||||
required: false
|
||||
type: string
|
||||
default: '["starter-projects", "components", "workspace", "api", "database"]'
|
||||
release:
|
||||
description: "Whether this is a release build"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
tests_folder:
|
||||
description: "(Optional) Tests to run"
|
||||
required: false
|
||||
|
|
@ -33,9 +53,114 @@ env:
|
|||
PLAYWRIGHT_BROWSERS_PATH: "ms-playwright"
|
||||
|
||||
jobs:
|
||||
determine-test-suite:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
suites: ${{ steps.set-matrix.outputs.matrix }}
|
||||
test_grep: ${{ steps.set-matrix.outputs.test_grep }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref || github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Paths Filter
|
||||
id: filter
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: .github/changes-filter.yaml
|
||||
|
||||
- name: Set Matrix and Test Grep
|
||||
id: set-matrix
|
||||
run: |
|
||||
# Start with input suites if provided, otherwise empty array
|
||||
SUITES='${{ inputs.suites }}'
|
||||
echo "Initial suites: $SUITES"
|
||||
TEST_GREP=""
|
||||
|
||||
RELEASE="${{ inputs.release || 'false' }}"
|
||||
echo "Release build: $RELEASE"
|
||||
|
||||
if [[ "$RELEASE" == "true" || "$SUITES" == "[]" ]]; then
|
||||
SUITES='["release"]'
|
||||
echo "Release build detected - setting suites to: $SUITES"
|
||||
# No grep pattern for release - run all tests
|
||||
TEST_GREP=""
|
||||
else
|
||||
# If input suites were not provided, determine based on changes
|
||||
if [[ "$SUITES" == "[]" ]]; then
|
||||
echo "No input suites provided - determining from changes"
|
||||
TAGS=()
|
||||
# Add suites and tags based on changed files
|
||||
if [[ "${{ steps.filter.outputs.components }}" == "true" ]]; then
|
||||
SUITES=$(echo $SUITES | jq '. += ["components"]')
|
||||
TAGS+=("@components")
|
||||
echo "Added components suite"
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.starter-projects }}" == "true" ]]; then
|
||||
SUITES=$(echo $SUITES | jq '. += ["starter-projects"]')
|
||||
TAGS+=("@starter-projects")
|
||||
echo "Added starter-projects suite"
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.workspace }}" == "true" ]]; then
|
||||
SUITES=$(echo $SUITES | jq '. += ["workspace"]')
|
||||
TAGS+=("@workspace")
|
||||
echo "Added workspace suite"
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.api }}" == "true" ]]; then
|
||||
SUITES=$(echo $SUITES | jq '. += ["api"]')
|
||||
TAGS+=("@api")
|
||||
echo "Added api suite"
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.database }}" == "true" ]]; then
|
||||
SUITES=$(echo $SUITES | jq '. += ["database"]')
|
||||
TAGS+=("@database")
|
||||
echo "Added database suite"
|
||||
fi
|
||||
|
||||
# Create grep pattern if we have tags
|
||||
if [ ${#TAGS[@]} -gt 0 ]; then
|
||||
# Join tags with | for OR logic
|
||||
REGEX_PATTERN=$(IFS='|'; echo "${TAGS[*]}")
|
||||
TEST_GREP="--grep=\"${REGEX_PATTERN}\""
|
||||
fi
|
||||
else
|
||||
# Process input suites to tags
|
||||
TAGS=()
|
||||
if echo "$SUITES" | jq -e 'contains(["components"])' > /dev/null; then
|
||||
TAGS+=("@components")
|
||||
fi
|
||||
if echo "$SUITES" | jq -e 'contains(["starter-projects"])' > /dev/null; then
|
||||
TAGS+=("@starter-projects")
|
||||
fi
|
||||
if echo "$SUITES" | jq -e 'contains(["workspace"])' > /dev/null; then
|
||||
TAGS+=("@workspace")
|
||||
fi
|
||||
if echo "$SUITES" | jq -e 'contains(["api"])' > /dev/null; then
|
||||
TAGS+=("@api")
|
||||
fi
|
||||
if echo "$SUITES" | jq -e 'contains(["database"])' > /dev/null; then
|
||||
TAGS+=("@database")
|
||||
fi
|
||||
|
||||
if [ ${#TAGS[@]} -gt 0 ]; then
|
||||
# Join tags with | for OR logic
|
||||
REGEX_PATTERN=$(IFS='|'; echo "${TAGS[*]}")
|
||||
TEST_GREP="--grep=\"${REGEX_PATTERN}\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Final test suites to run: $SUITES"
|
||||
echo "Test grep pattern: $TEST_GREP"
|
||||
echo "matrix=$SUITES" >> $GITHUB_OUTPUT
|
||||
echo "test_grep=$TEST_GREP" >> $GITHUB_OUTPUT
|
||||
|
||||
setup-and-test:
|
||||
name: Playwright Tests - Group ${{ matrix.shardIndex }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: determine-test-suite
|
||||
if: ${{ fromJson(needs.determine-test-suite.outputs.suites)[0] != null }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
@ -120,8 +245,9 @@ jobs:
|
|||
max_attempts: 2
|
||||
command: |
|
||||
cd src/frontend
|
||||
npx playwright test ${{ inputs.tests_folder }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
|
||||
npx playwright test ${{ inputs.tests_folder }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2
|
||||
echo 'Running tests with pattern: ${{ needs.determine-test-suite.outputs.test_grep }}'
|
||||
npx playwright test ${{ inputs.tests_folder }} ${{ needs.determine-test-suite.outputs.test_grep }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
|
||||
npx playwright test ${{ inputs.tests_folder }} ${{ needs.determine-test-suite.outputs.test_grep }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2
|
||||
|
||||
- name: Upload blob report to GitHub Actions Artifacts
|
||||
if: always()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue