diff --git a/.github/workflows/playwright_regression.yml b/.github/workflows/playwright_regression.yml index a07322d0f4..31c15fd7ea 100644 --- a/.github/workflows/playwright_regression.yml +++ b/.github/workflows/playwright_regression.yml @@ -71,7 +71,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - shared-key: playwright-regression-ci + shared-key: playwright-release-ci save-if: ${{ github.ref == 'refs/heads/main' }} - name: Install Protoc @@ -111,7 +111,7 @@ jobs: if-no-files-found: error ui_integration_tests: - name: e2e / ${{ matrix.spec }} + name: e2e / ${{ matrix.testfolder }} needs: [build_binary] runs-on: labels: ubicloud-standard-8 @@ -121,17 +121,49 @@ jobs: fail-fast: false matrix: include: - - spec: "logs-regression.spec.js" - - spec: "logs-regression-bugs.spec.js" - - spec: "logs-9754.spec.js" - - spec: "streams-regression.spec.js" - - spec: "enrichment-regression.spec.js" - - spec: "ui-regression.spec.js" - - spec: "pipeline-regression.spec.js" - - spec: "alerts-stream-switching-regression.spec.js" - - spec: "metrics-regression.spec.js" - - spec: "traces-regression.spec.js" - - spec: "dashboard-regression.spec.js" + - testfolder: "Logs-Regression" + run_files: + [ + "logs-regression.spec.js", + "logs-regression-bugs.spec.js", + "logs-9754.spec.js", + ] + - testfolder: "Alerts-Regression" + run_files: + [ + "alerts-stream-switching-regression.spec.js", + ] + - testfolder: "Dashboard-Regression" + run_files: + [ + "dashboard-regression.spec.js", + ] + - testfolder: "Streams-Regression" + run_files: + [ + "streams-regression.spec.js", + ] + - testfolder: "Pipelines-Regression" + run_files: + [ + "enrichment-regression.spec.js", + "pipeline-regression.spec.js", + ] + - testfolder: "Traces-Regression" + run_files: + [ + "traces-regression.spec.js", + ] + - testfolder: "Metrics-Regression" + run_files: + [ + "metrics-regression.spec.js", + ] + - testfolder: "GeneralTests-Regression" + run_files: + [ + "ui-regression.spec.js", + ] steps: - name: Clone the current repo @@ -189,15 +221,35 @@ jobs: cd tests/ui-testing && npm ci npx playwright install --with-deps chromium - SPEC_FILE="./playwright-tests/RegressionSet/${{ matrix.spec }}" - echo "Running: $SPEC_FILE" - npx playwright test "$SPEC_FILE" + # Get list of files to run using join function + FILE_LIST="${{ join(matrix.run_files, ' ') }}" + echo "DEBUG: FILE_LIST = $FILE_LIST" + echo "DEBUG: matrix.testfolder = ${{ matrix.testfolder }}" + + if [ -n "$FILE_LIST" ]; then + ACTUAL_FOLDER="RegressionSet" + + echo "DEBUG: ACTUAL_FOLDER = $ACTUAL_FOLDER" + + # Build file paths + FILE_PATHS="" + for file in $FILE_LIST; do + FILE_PATH="./playwright-tests/$ACTUAL_FOLDER/$file" + echo "DEBUG: Will run file: $FILE_PATH" + FILE_PATHS="$FILE_PATHS $FILE_PATH" + done + + echo "DEBUG: Final command: npx playwright test $FILE_PATHS" + npx playwright test $FILE_PATHS + else + echo "No files specified to run for ${{ matrix.testfolder }} folder" + fi - name: Upload blob report to GitHub Actions Artifacts if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: blob-report-${{ matrix.spec }}-${{ github.run_attempt }} + name: blob-report-${{ matrix.testfolder }}-${{ github.run_attempt }} path: tests/ui-testing/blob-report retention-days: 1 @@ -235,34 +287,103 @@ jobs: merge-multiple: true - name: Merge Reports + env: + GH_TOKEN: ${{ github.token }} run: | cd tests/ui-testing if [ ! -d "all-blob-reports" ] || [ -z "$(ls -A all-blob-reports 2>/dev/null)" ]; then - echo "::warning::No blob reports found to merge. Creating empty report." - mkdir -p playwright-results/html-report - START_TIME=$(date -u +%Y-%m-%dT%H:%M:%S.000Z) - echo '{"config":{},"suites":[],"errors":[],"stats":{"startTime":"'"$START_TIME"'","duration":0,"expected":0,"unexpected":0,"flaky":0,"skipped":0}}' > playwright-results/report.json - echo "

No test reports found

" > playwright-results/html-report/index.html - exit 0 + echo "::warning::No blob reports found to merge." + + echo "::group::Investigating why no blob reports exist" + + JOBS_RESPONSE=$(curl -s -H "Authorization: token $GH_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs") + + SUCCEEDED=$(echo "$JOBS_RESPONSE" | jq -r '[.jobs[] | select(.name | startswith("e2e /")) | select(.conclusion == "success")] | length') + FAILED=$(echo "$JOBS_RESPONSE" | jq -r '[.jobs[] | select(.name | startswith("e2e /")) | select(.conclusion == "failure")] | length') + TOTAL=$(echo "$JOBS_RESPONSE" | jq -r '[.jobs[] | select(.name | startswith("e2e /"))] | length') + + echo "::notice::Test job results: $SUCCEEDED succeeded, $FAILED failed, $TOTAL total" + + if [ "$SUCCEEDED" -gt 0 ] && [ "$FAILED" -eq 0 ]; then + echo "::notice::✅ All test jobs succeeded - they likely skipped because tests already passed" + echo "::notice::Creating empty report structure for downstream jobs" + mkdir -p playwright-results/html-report + START_TIME=$(date -u +%Y-%m-%dT%H:%M:%S.000Z) + echo '{"config":{},"suites":[],"errors":[],"stats":{"startTime":"'"$START_TIME"'","duration":0,"expected":0,"unexpected":0,"flaky":0,"skipped":0}}' > playwright-results/report.json + echo "

No tests executed - all shards skipped

All test shards exited early because tests had already passed in a previous attempt.

" > playwright-results/html-report/index.html + echo "::endgroup::" + exit 0 + else + echo "::error::❌ Some/all test jobs failed but no blob reports were found" + echo "::error::This indicates a problem with test execution or blob reporter" + echo "::error::Failed jobs: $FAILED, Succeeded jobs: $SUCCEEDED" + echo "::endgroup::" + exit 1 + fi fi unset CI npx playwright merge-reports --config playwright.config.js ./all-blob-reports + echo "Contents of playwright-results:" + ls -la playwright-results/ + echo "Contents of html-report:" + ls -la playwright-results/html-report/ + echo "Checking report.json:" + ls -lh playwright-results/report.json + + - name: Cache test failures to TestDino + if: ${{ needs.ui_integration_tests.result == 'failure' }} + env: + TESTDINO_TOKEN: ${{ secrets.TESTDINO_API_TOKEN }} + run: | + cd tests/ui-testing + echo "::group::Caching test failure metadata to TestDino" + if [ -f "playwright-results/report.json" ]; then + echo "::notice::JSON report found at playwright-results/report.json" + ls -lh playwright-results/report.json + + mkdir -p ../../playwright-results + cp playwright-results/report.json ../../playwright-results/ + + cd ../../playwright-results + BRANCH_NAME=$(echo "${{ github.ref_name }}" | sed 's/\//_/g') + CACHE_ID="gh_openobserve_${BRANCH_NAME}_${{ github.run_id }}" + echo "::notice::Using cache ID: $CACHE_ID" + + if CACHE_OUTPUT=$(npx tdpw cache --cache-id "$CACHE_ID" 2>&1); then + SUCCESS_MSG=$(echo "$CACHE_OUTPUT" | grep "Cache data submitted successfully" || echo "") + if [ -n "$SUCCESS_MSG" ]; then + echo "::notice::✅ Successfully cached test failure metadata to TestDino cloud" + else + echo "::notice::✅ Cache command completed" + fi + else + echo "::warning::⚠️ Failed to cache test metadata to TestDino" + echo "::warning::Rerun optimization may not work properly" + echo "$CACHE_OUTPUT" + fi + else + echo "::notice::Skipping cache - no report.json found (tests may have been skipped due to rerun optimization)" + fi + echo "::endgroup::" + - name: Upload to TestDino - continue-on-error: true - if: ${{ (success() || failure()) && env.UPLOAD_TO_TESTDINO == 'true' }} + if: ${{ needs.ui_integration_tests.result == 'failure' && env.UPLOAD_TO_TESTDINO == 'true' }} run: | cd tests/ui-testing if [ ! -f "playwright-results/report.json" ]; then - echo "::notice::Skipping TestDino upload - no report.json found" + echo "::notice::Skipping TestDino upload - no report.json found (tests may have been skipped due to rerun optimization)" exit 0 fi START_TIME=$(jq -r '.stats.startTime // empty' playwright-results/report.json) if [ -n "$START_TIME" ] && [[ "$START_TIME" =~ ^[0-9]+$ ]]; then + echo "Converting startTime from Unix timestamp to ISO 8601 string" jq '.stats.startTime = (.stats.startTime / 1000 | strftime("%Y-%m-%dT%H:%M:%S.000Z"))' playwright-results/report.json > playwright-results/report.json.tmp mv playwright-results/report.json.tmp playwright-results/report.json fi @@ -295,7 +416,7 @@ jobs: UI_OK=true fi - if [ "${{ needs.merge_and_upload_reports.result }}" == "success" ] || [ "${{ needs.merge_and_upload_reports.result }}" == "skipped" ]; then + if [ "${{ needs.merge_and_upload_reports.result }}" == "success" ] || [ "${{ needs.merge_and_upload_reports.result }}" == "skipped" ] || [ "${{ needs.merge_and_upload_reports.result }}" == "failure" ]; then MERGE_OK=true fi diff --git a/tests/ui-testing/playwright-tests/Logs/logs-autocomplete-suggestions.spec.js b/tests/ui-testing/playwright-tests/Logs/logs-autocomplete-suggestions.spec.js index 614bbab7bd..fee9e26a29 100644 --- a/tests/ui-testing/playwright-tests/Logs/logs-autocomplete-suggestions.spec.js +++ b/tests/ui-testing/playwright-tests/Logs/logs-autocomplete-suggestions.spec.js @@ -987,11 +987,13 @@ test.describe("Autocomplete Value Suggestions - Quoting Behavior", () => { await pm.logsPage.selectStream(streamName); await runQueryAndWaitForResults(page, pm); - // Find a numeric field (like 'code' which has HTTP status codes) - const codeFieldBtn = page.locator(pm.logsPage.fieldExpandButton('code')); - const codeFieldExists = await codeFieldBtn.count() > 0; - expect(codeFieldExists, 'Expected "code" field to exist for numeric quoting test').toBe(true); + // Search for the field in the field list search box first + await pm.logsPage.searchFieldByName('code'); + await page.waitForTimeout(1000); + // Find the field expand button for 'code' + const codeFieldBtn = page.locator(pm.logsPage.fieldExpandButton('code')); + await codeFieldBtn.waitFor({ state: 'visible', timeout: 5000 }); await codeFieldBtn.click(); await page.waitForTimeout(2000);