Files
openobserve/.github/workflows/playwright.yml
T
Shrinath Rao 9329c12a0c test: updated merge logic for test dino upload (#8793)
### **PR Type**
Tests, Enhancement


___

### **Description**
- Use Playwright blob reporter on CI

- Merge shard reports via playwright merge-reports

- Streamline GitHub Actions artifacts and steps

- Update Node.js to 22 in merge job


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["Playwright tests (CI shards)"] -- "reporter: blob" --> B["blob-report artifacts"]
  B -- "download & merge" --> C["playwright merge-reports"]
  C -- "outputs" --> D["playwright-results/report.json + html-report"]
  D -- "tdpw upload" --> E["TestDino"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>playwright.config.js</strong><dd><code>Conditional blob
reporter for CI</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/playwright.config.js

<ul><li>CI uses <code>['blob']</code> reporter<br> <li> Local keeps HTML
and JSON reporters<br> <li> Enables cross-shard report merging</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8793/files#diff-91cb9615068914b2e4f5d66fcbed50d3e9771ea2d882f8e8048bbe54eab3c414">+6/-4</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>playwright.yml</strong><dd><code>Artifact flow: blob
upload, merge, TestDino upload</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

.github/workflows/playwright.yml

<ul><li>Comment out many test matrices<br> <li> Remove per-matrix
JSON/HTML upload steps<br> <li> Upload blob reports; merge with
Playwright<br> <li> New job merges and uploads to TestDino; Node 22</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8793/files#diff-7afcd2d8f7b49bda74843f209eefb7b2da45f7e7803bf2e4bd636699b76aa2d3">+117/-236</a></td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-10-13 21:16:29 +05:30

406 lines
13 KiB
YAML

name: Playwright UI Tests
on:
push:
branches:
- "main"
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
env:
COLUMNS: 150
ZO_ROOT_USER_EMAIL: root@example.com
ZO_ROOT_USER_PASSWORD: Complexpass#123
ZO_BASE_URL: http://localhost:5080
WS_ZO_BASE_URL: ws://localhost:5080
ZO_BASE_URL_SC: http://localhost:5080
ZO_BASE_URL_SC_UI: http://localhost:5080
INGESTION_URL: http://localhost:5080
ORGNAME: default
ZO_QUICK_MODE_NUM_FIELDS: 100
ZO_QUICK_MODE_STRATEGY: first
ZO_ALLOW_USER_DEFINED_SCHEMAS: true
ZO_INGEST_ALLOWED_UPTO: 5
ZO_FEATURE_QUERY_EXCLUDE_ALL: false
ZO_USAGE_BATCH_SIZE: 200
ZO_USAGE_PUBLISH_INTERVAL: 2
ZO_USAGE_REPORTING_ENABLED: true
ZO_MIN_AUTO_REFRESH_INTERVAL: 5
ZO_STREAMING_ENABLED: true
ZO_COLS_PER_RECORD_LIMIT: "80000"
ZO_SMTP_ENABLED: true
ZO_FORMAT_STREAM_NAME_TO_LOWERCASE: false
ZO_CREATE_ORG_THROUGH_INGESTION: true
ZO_UTF8_VIEW_ENABLED: false
jobs:
build_binary:
name: build_binary
runs-on:
labels: repo-openobserve-standard-16
steps:
- name: Remove unused tools
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Clone the current repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-07-20
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
prefix-key: playwright
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "21.12"
- uses: actions/setup-node@v5
with:
node-version: 22
- name: Build frontend code
env:
NODE_OPTIONS: "--max-old-space-size=8192"
VITE_COVERAGE: "true"
COVERAGE: "true"
run: cd web && npm install && npm run build
- name: Build and run binary
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-binary
path: target/x86_64-unknown-linux-gnu/release/openobserve
retention-days: 1
ui_integration_tests:
name: e2e / ${{ matrix.testfolder }}
needs: [build_binary]
runs-on:
labels: repo-openobserve-standard-8
# container:
# image: mcr.microsoft.com/playwright:v1.50.0-jammy
# options: --user root
strategy:
matrix:
include:
- testfolder: "GeneralTests"
browser: "chrome"
run_files:
[
"sanity.spec.js",
"changeOrg.spec.js",
"enrichment.spec.js",
"schema.spec.js",
"schemaload.spec.js",
"serviceAccount.spec.js",
"usersOrg.spec.js",
"org.spec.js",
]
- testfolder: "Logs-Core"
browser: "chrome"
run_files:
[
"join.spec.js",
"logshistogram.spec.js",
"logspage.spec.js",
"logsquickmode.spec.js",
"pagination.spec.js",
"unflattened.spec.js",
"logstable.spec.js",
]
- testfolder: "Logs-Queries"
browser: "chrome"
run_files:
[
"logsDownloads.spec.js",
"logsqueries.spec.js",
"secondsPrecisionAdded.spec.js",
"logsqueries.cte.spec.js",
"logsqueries.matchall.spec.js",
"searchpartition.spec.js",
]
- testfolder: "Alerts"
browser: "chrome"
run_files:
[
"alerts-e2e-flow.spec.js",
"alerts-ui-operations.spec.js",
"alerts-import.spec.js",
]
- testfolder: "Dashboards-Core"
browser: "chrome"
run_files:
[
"dashboard.spec.js",
"dashboard2.spec.js",
"dashboardtype.spec.js",
"dashboard-folder.spec.js",
"dashboard-import.spec.js",
"maxquery.spec.js",
]
- testfolder: "Dashboards-Settings"
browser: "chrome"
run_files:
[
"dashboard-filter.spec.js",
"dashboard-general-setting.spec.js",
"dashboard-tabs-setting.spec.js",
"dashboard-variables-setting.spec.js",
"dashboard-transpose.spec.js",
]
- testfolder: "Dashboards-Charts"
browser: "chrome"
run_files: [
"custom-charts.spec.js",
"dashboard-geoMap.spec.js",
"dashboard-maps.spec.js",
"dashboard-multi-y-axis.spec.js",
"dashboard-html-chart.spec.js",
"visualize.spec.js",
# "visualization-vrl.spec.js"
]
- testfolder: "Dashboards-Streaming"
browser: "chrome"
run_files: ["dashboard-streaming.spec.js",]
- testfolder: "Pipelines"
browser: "chrome"
run_files: [
"pipelines.spec.js",
"pipeline-dynamic.spec.js",
"pipeline-core.spec.js",
# "remotepipeline.spec.js"
]
- testfolder: "Reports"
browser: "chrome"
run_files: [
"reportsUpdated.spec.js",
"reportsUpdated2.spec.js"
]
- testfolder: "Streams"
browser: "chrome"
run_files:
[
"multiselect-stream.spec.js",
"streamname.spec.js",
"streaming.spec.js",
]
steps:
- name: Clone the current repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v5
with:
name: release-binary
path: release-binary
- name: Start OpenObserve
run: chmod +x ./release-binary/openobserve && ./release-binary/openobserve > o2.log 2>&1 &
- name: Wait for start
run: sleep 60
- name: Ensure we are getting a reply from the server
run: curl http://localhost:5080/web/login
- name: Create coverage json folder
run: mkdir -p tests/ui-testing/.nyc_output
- uses: actions/setup-node@v5
with:
node-version: 22
- name: Install dependencies and run ui-tests
run: |
touch .env
echo "ZO_ROOT_USER_EMAIL=${ZO_ROOT_USER_EMAIL}" >> .env
echo "ZO_ROOT_USER_PASSWORD=${ZO_ROOT_USER_PASSWORD}" >> .env
echo "ZO_BASE_URL=${ZO_BASE_URL}" >> .env
echo "WS_ZO_BASE_URL=${WS_ZO_BASE_URL}" >> .env
echo "ZO_BASE_URL_SC=${ZO_BASE_URL_SC}" >> .env
echo "ZO_BASE_URL_SC_UI=${ZO_BASE_URL_SC_UI}" >> .env
echo "INGESTION_URL=${INGESTION_URL}" >> .env
echo "ORGNAME=${ORGNAME}" >> .env
echo "ZO_SMTP_ENABLED=${ZO_SMTP_ENABLED}" >> .env
mv .env tests/ui-testing
cd tests/ui-testing && npm ci
npx playwright install --with-deps chromium
# 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
# Map logical folder names to actual directories
case "${{ matrix.testfolder }}" in
"Logs-Core"|"Logs-Queries")
ACTUAL_FOLDER="Logs"
;;
"Dashboards-Core"|"Dashboards-Settings"|"Dashboards-Charts"|"Dashboards-Streaming")
ACTUAL_FOLDER="Dashboards"
;;
*)
ACTUAL_FOLDER="${{ matrix.testfolder }}"
;;
esac
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
# Run all specified files at once
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: Sanitize Test Folder Name
shell: bash
run: |
# Assign the matrix variable to a Bash variable
SANITIZED_FOLDERNAME="${{ matrix.testfolder }}"
# Export as a GitHub Actions environment variable
echo "SANITIZED_FOLDERNAME=$SANITIZED_FOLDERNAME" >> $GITHUB_ENV
- name: Upload Coverage Data
uses: actions/upload-artifact@v4
with:
name: playwright-coverage-${{ env.SANITIZED_FOLDERNAME }}
path: tests/ui-testing/.nyc_output
include-hidden-files: true
- name: Generate Coverage Report
run: cd tests/ui-testing && npx nyc report
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.testfolder }}
path: tests/ui-testing/blob-report
retention-days: 1
- name: Check OpenObserve logs
if: always()
run: cat o2.log
merge_and_upload_reports:
name: Merge Reports and Upload to TestDino
needs: [ui_integration_tests]
if: ${{ !cancelled() && needs.ui_integration_tests.result != 'skipped' }}
runs-on: ubuntu-latest
steps:
- name: Clone the current repo
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install project dependencies
run: cd tests/ui-testing && npm ci
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: tests/ui-testing/all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge Reports
run: |
cd tests/ui-testing
# Unset CI to use non-CI reporter config (html + json instead of blob)
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: Upload to TestDino
if: ${{ always() }}
run: |
cd tests/ui-testing
npx --yes tdpw upload playwright-results \
--json-report playwright-results/report.json \
--html-report playwright-results/html-report \
--upload-html \
--token="${{ secrets.TESTDINO_API_TOKEN }}"
generate_coverage_report:
name: Generate Coverage Report
needs: [build_binary, ui_integration_tests]
runs-on: repo-openobserve-standard-8
if: success() || failure()
steps:
- name: Clone the current repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download Playwright Coverage Data
uses: actions/download-artifact@v5
with:
pattern: playwright-coverage-* # Match all artifacts with this prefix
path: merged-coverage
merge-multiple: true
- name: Verify Downloaded Files
run: ls -R merged-coverage # Check the structure and contents
- name: Move Coverage Files to .nyc_output
run: |
mkdir -p tests/ui-testing/.nyc_output
mv merged-coverage/* tests/ui-testing/.nyc_output/ || echo "No files to move"
- name: Generate Coverage Report
run: cd tests/ui-testing && npm ci && npx nyc report
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: hashFiles('tests/ui-testing/coverage-report/**') != ''
with:
name: coverage-report
path: tests/ui-testing/coverage-report
retention-days: 7