Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

ramki-bruno
Copy link
Collaborator

@ramki-bruno ramki-bruno commented May 16, 2025

  • 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.

Copy link

github-actions bot commented May 16, 2025

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 6b380dc. ± Comparison against base commit 7c07488.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 20, 2025

CLI Test Results

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

Results for commit a006fe8.

♻️ This comment has been updated with latest results.

@ramki-bruno ramki-bruno force-pushed the feature/playwright branch 2 times, most recently from 36778ec to b8feedd Compare May 20, 2025 14:23
@ramki-bruno ramki-bruno changed the title Added Playwright test for bruno-testbench, few sanity tests and improvements Improvements in Playwright setup, few sanity tests and tests for bruno-testbench May 21, 2025
@ramki-bruno ramki-bruno changed the title Improvements in Playwright setup, few sanity tests and tests for bruno-testbench Improvements in Playwright setup and added tests for running bruno-testbench May 21, 2025
Copy link
Collaborator

@maintainer-bruno maintainer-bruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" },
      ]
    }
  }

…vements

- Trace will capture snapshots now
- Added ability to add init Electron user-data, preferences and other
  app settings.
- Improved test Fixtures
  - Use tempdir for Electron user-data
  - Ability to reuse app instance for a given init user-data by placing
    them in a folder(`pageWithUserData` Fixture)
  - Ability to create tests with fresh user-data(`newPage` Fixture)
- Improved logging
- Improved the env vars to customize the Electron user-data-path
Currently the test-results and annotations form jobs are getting added
to random Workflow and there is no fix for it right now
Ref: EnricoMi/publish-unit-test-result-action#12
Also Playwright tests have the same triggers as Tests, so no need to
keep it separate.
@ramki-bruno
Copy link
Collaborator Author

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

@lohit-bruno lohit-bruno merged commit 223f79a into main Jun 4, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants