Files
openobserve/.github/workflows/playwright.yml
T
Shrinath RaoandClaude cabbacf970 test: e2e logs downloads test cases (#8001)
### **PR Type**
Tests, Enhancement


___

### **Description**
- Add comprehensive logs download E2E tests

- Implement download utilities in logs page

- Add ingestion via fetch with basic auth

- Update CI to run new tests


___

### Diagram Walkthrough


```mermaid
flowchart LR
  Tests["Playwright tests: logsDownloads.spec.js"]
  Page["LogsPage: download + ingestion utilities"]
  CI["CI workflow: include logsDownloads"]
  App["Logs UI (existing)"]

  Tests -- "uses" --> Page
  CI -- "runs" --> Tests
  Page -- "ingests data, verifies CSVs" --> App
```



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

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>logsPage.js</strong><dd><code>Add ingestion and CSV
download utility methods</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/pages/logsPages/logsPage.js

<ul><li>Add ingestion via page-evaluated fetch with Basic auth.<br> <li>
Add download helpers: setup, cleanup, wait, verify.<br> <li> Add UI
actions for download menus and SQL editor clear.<br> <li> Import fs/path
and minor selector utilities.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8001/files#diff-8045b343491d8943869c1af74cdafab204dc49c02a70294417e73f47d35e0b59">+149/-2</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>logsDownloads.spec.js</strong><dd><code>Add
comprehensive logs CSV download tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/playwright-tests/Logs/logsDownloads.spec.js

<ul><li>Add E2E tests for CSV downloads (normal/custom).<br> <li> Verify
row counts for multiple custom ranges.<br> <li> Add SQL mode LIMIT 2000
download test.<br> <li> Manage temp download directory per test
run.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8001/files#diff-90f04cfe53caddf683cc4466e9e97af96d7eb90d636bf6b0f5cdc4b76dc395ac">+265/-0</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>playwright.yml</strong><dd><code>Update CI to run new
download tests</code>&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>

.github/workflows/playwright.yml

<ul><li>Include logsDownloads.spec.js in Logs-Queries suite.<br> <li>
Re-enable visualize.spec.js in Dashboards-Charts.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8001/files#diff-7afcd2d8f7b49bda74843f209eefb7b2da45f7e7803bf2e4bd636699b76aa2d3">+2/-1</a>&nbsp;
&nbsp; &nbsp; </td>

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

</details>

___

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-05 19:04:16 +05:30

347 lines
11 KiB
YAML

name: Playwright UI Tests
on:
push:
branches:
- "main"
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
# paths:
# - "web/**"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
# paths:
# - "web/**"
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: ubicloud-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
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-05-20
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "21.12"
- uses: actions/setup-node@v4
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: debug-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: ubicloud-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",
]
- 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: "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
- name: Download artifacts
uses: actions/download-artifact@v5
with:
name: debug-binary
path: debug-binary
- name: Start OpenObserve
run: chmod +x ./debug-binary/openobserve && ./debug-binary/openobserve > o2.log 2>&1 &
- name: Wait for start
run: sleep 15
- 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@v4
with:
node-version: lts/*
- 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
# 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")
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 Playwright Report
uses: actions/upload-artifact@v4
if: always() && hashFiles('playwright-report/**') != ''
with:
name: playwright-report-${{ matrix.testfolder }}
path: playwright-report/
retention-days: 30
- name: Check OpenObserve logs
if: always()
run: cat o2.log
generate_coverage_report:
name: Generate Coverage Report
needs: [build_binary, ui_integration_tests]
runs-on: ubicloud-standard-8
if: always()
steps:
- name: Clone the current repo
uses: actions/checkout@v5
- 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