Skip to content
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

Test Electron app with k6 browser #4270

Open
ankur22 opened this issue Jan 22, 2025 · 0 comments
Open

Test Electron app with k6 browser #4270

ankur22 opened this issue Jan 22, 2025 · 0 comments
Labels

Comments

@ankur22
Copy link
Contributor

ankur22 commented Jan 22, 2025

Feature Description

At the moment there is no way to run k6 browser against an electron app. We can start a websocket devtools connection, and connect to it, but there is no way to retrieve the current browserContext or page that the electron app is displaying.

Steps to reproduce the current state are:

  1. Clone https://github.com/electron/electron-quick-start
  2. npm install
  3. Add the lines from https://github.com/electron/electron/blob/main/docs/api/command-line-switches.md
  4. npm start
  5. Copy the ws connection that is printed
  6. try to run a simple k6 browser test, it soon becomes clear that we won't be able to retrieve the existing page that the electron app is displaying. e.g. K6_BROWSER_WS_URL=ws://127.0.0.1:8315/devtools/browser/b62d813a-97b6-4307-adb2-69f2c5c86f53 k6 run electron.js
import { browser } from 'k6/browser'

export const options = {
  scenarios: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
          type: 'chromium',
        },
      },
    },
  },
}

export default async function () {
  const page = await browser.newPage()
  await page.close()
}

Suggested Solution (optional)

Take a look at how PW is experimenting with testing a electron app: https://playwright.dev/docs/api/class-electron.

Already existing or connected issues / PRs (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant