bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Improvements in Playwright setup and added tests for running bruno-testbench

Open ramki-bruno opened this issue 7 months ago • 2 comments

  • Trace will capture UI snapshots now.
    • Trace is on in local by default and will be captured during retry when a test fails in CI.
    • UI snapshots gives the ability to inspect the page while viewing the traces. Helps with debugging failed tests and finding better locators.
  • Improved test Fixtures
    • Use a tempdir for userData for all instances of the app during test run.
    • Added ability to run tests with user-data presets(preferences, security settings, etc.) using pageWithUserData Fixture.
      • For a given folder inside e2e-tests, if there is a folder named init-user-data, all the files within it will get copied to the userData location of a dedicated Bruno Electron app instance.
      • That dedicated app instance will be used for all the tests in that folder that uses pageWithUserData fixture({pageWithUserData: page}).
      • {{projectRoot}}(literal text) within those files(e.g. preferences.json) will get replaced with the absolute path of the current project/repo's path. This will be useful to make it env agnostic whether its between contributors or its running in CI.
    • createTmpDir Fixture can be used to create temporary folder which can be provided as Location to create collections.
    • Ability to create tests with fresh user-data(newPage Fixture).
  • Improved logging
    • All electron logs will be prefixed with [Electron #<worker id>] | to differentiate the logs.
  • Improved the env vars to customize the Electron userData path.
    • ELECTRON_USER_DATA_PATH env var can now be used modify the Electron userData path.

ramki-bruno avatar May 16 '25 11:05 ramki-bruno

Test Results

  1 files  ±0  112 suites  ±0   1m 3s ⏱️ +24s 172 tests ±0  172 ✅ +2  0 💤 ±0  0 ❌  - 2  230 runs  ±0  229 ✅ +2  1 💤 ±0  0 ❌  - 2 

Results for commit 6b380dc0. ± Comparison against base commit 7c07488e.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar May 16 '25 11:05 github-actions[bot]

CLI Test Results

  1 files  113 suites   36s ⏱️ 175 tests 175 ✅ 0 💤 0 ❌ 233 runs  232 ✅ 1 💤 0 ❌

Results for commit a006fe82.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar May 20 '25 14:05 github-actions[bot]

if time permits, please add the following eslint config

...
const playwright = require('eslint-plugin-playwright');
...
  {
    files: ["e2e-tests/**/*.{js,ts}"],
    ignores: ["**/*.config.js"],
    extends: [playwright.configs['flat/recommended']],
    languageOptions: {
      globals: {
        ...globals.node
      }
    },
    rules: {
      "no-undef": "error",
      "indent": ["error", 2],
      "no-unused-vars": "error",
      // Common test-friendly rules
      "no-unused-expressions": "off",
      "max-lines-per-function": "off",
      "no-await-in-loop": "off", // Playwright tests often need sequential awaits
      "no-restricted-syntax": "off", // Allow for...of loops which are common in Playwright
      "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0, "maxBOF": 0 }],
      "padding-line-between-statements": [
        "error",
        // Add blank line before return statements
        { blankLine: "always", prev: "*", next: "return" },
      ]
    }
  }

skipping this since its not in the scope of this PR

ramki-bruno avatar May 30 '25 08:05 ramki-bruno