Files
openobserve/tests/ui-testing/playwright.config.js
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

106 lines
3.8 KiB
JavaScript

// @ts-check
const { defineConfig, devices } = require('@playwright/test');
const dotenv = require('dotenv');
// Load environment variables from .env file
try {
dotenv.config();
console.log('✅ Environment variables loaded from .env file');
} catch (error) {
console.warn('⚠️ dotenv not available, using system environment variables');
}
// Check if essential environment variables are set
if (!process.env.ZO_BASE_URL || !process.env.ZO_ROOT_USER_EMAIL || !process.env.ZO_ROOT_USER_PASSWORD) {
console.warn('⚠️ Essential environment variables not found. Make sure to set ZO_BASE_URL, ZO_ROOT_USER_EMAIL, and ZO_ROOT_USER_PASSWORD');
}
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: './playwright-tests',
/* Output directory for test artifacts */
outputDir: './test-results',
/* Exclude archived tests from all test runs */
testIgnore: ['**/test-archives/**', '**/*_old.js'],
/* Global setup and teardown */
globalSetup: './playwright-tests/utils/global-setup.js',
globalTeardown: './playwright-tests/utils/global-teardown.js',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry failed tests: 2 times on CI, 1 time locally */
retries: process.env.CI ? 5 : 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 5 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI
? [['blob']] // Use blob reporter in CI for merging across shards
: [
['html', { outputFolder: 'playwright-results/html-report', open: 'never' }], // HTML reporter
['json', { outputFile: 'playwright-results/report.json' }] // JSON reporter for TestDino
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env["ZO_BASE_URL"],
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Navigation and action timeouts for CI stability */
navigationTimeout: process.env.CI ? 60000 : 30000,
actionTimeout: process.env.CI ? 30000 : 15000,
/* Capture screenshots and videos on failure for CI debugging */
screenshot: process.env.CI ? 'only-on-failure' : 'off',
video: process.env.CI ? 'retain-on-failure' : 'off',
},
/* Test timeout: 3 minutes locally, 5 minutes in CI */
timeout: process.env.CI ? 5 * 60 * 1000 : 3 * 60 * 1000,
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], viewport: { width: 1500, height: 1024 }, },
},
// {
// name: 'webkit', // Safari/WebKit configuration
// use: {
// ...devices['Desktop Safari'], // Uses Playwright's pre-defined device settings for Safari
// viewport: { width: 1500, height: 1024 },
// },
// },
// }
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// }
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});