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

[Bug]: electron.launch: Process failed to launch on Bitbucket pipeline #30412

Closed
Aenardhil opened this issue Apr 18, 2024 · 4 comments
Closed

Comments

@Aenardhil
Copy link

Aenardhil commented Apr 18, 2024

Version

1.41.1

Steps to reproduce

  1. Push my repository with my .yml file with this content:
    `# Configuration for bitbucket pipeline testing
image: node:18.18.0

pipelines:
  default:
    - parallel:
        - step:
            name: Code test electron
            size: 2x
            script:
              - apt-get update && apt-get install -y curl libglib2.0-dev libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2-dev && apt-get clean 
              - cd electron-desktop
              - npm install
              - npm run electron:build
              - npm run test:debug:linux
            caches:
              - node
definitions:
  services:
    docker:
      memory: 7128`

test:debug:linux calls this: "test:debug:linux": "DEBUG=pw:browser npx playwright test", 

And the test:

import { ElectronApplication, _electron as electron } from 'playwright';
const { test, expect } = require('@playwright/test');

let electronApplication: ElectronApplication;

test.beforeAll(async () => {
	// set the CI environment variable to true
	process.env.CI = 'e2e';
});

test.beforeEach(async () => {
	try {
		electronApplication = await electron.launch({
			args: [ 'dist/main.js' ],
			env: {
				...process.env,
			} as any,
		});
	} catch (error) {
		// console.error('Error launching Electron application:', error);
	}

});

test('app should not be packaged', async () => {
	const isPackaged = await electronApplication.evaluate(async ({ app }) => {
		// This runs in Electrone's main process, parameter here is always
		// the result of the require('electron') in the main app script.
		return app.isPackaged;
	});
	expect(isPackaged).toBe(false);
});

test.afterEach(async () => {
	await electronApplication.close();
});
  1. wait until de execution of the steps in the pipline are finished

Expected behavior

The test has to be passed.

Actual behavior

> DEBUG=pw:browser npx playwright test
Running 4 tests using 1 worker
  pw:browser <launching> /opt/atlassian/pipelines/agent/build/electron-desktop/node_modules/electron/dist/electron -r /opt/atlassian/pipelines/agent/build/electron-desktop/node_modules/playwright-core/lib/server/electron/loader.js --no-sandbox --inspect=0 --remote-debugging-port=0 dist/main.js +0ms
  pw:browser <launched> pid=2510 +8ms
  pw:browser [pid=2510][err] [2510:0417/152446.821992:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory +66ms
  pw:browser [pid=2510][err] Debugger listening on ws://127.0.0.1:42529/f6329427-510a-4f9c-a49d-7d22e07004bf +41ms
  pw:browser [pid=2510][err] For help, see: https://nodejs.org/en/docs/inspector +0ms
  pw:browser <ws connecting> ws://127.0.0.1:42529/f6329427-510a-4f9c-a49d-7d22e07004bf +1ms
  pw:browser <ws connected> ws://127.0.0.1:42529/f6329427-510a-4f9c-a49d-7d22e07004bf +10ms
  pw:browser [pid=2510][err] Debugger attached. +0ms
  pw:browser [pid=2510][err] [2510:0417/152447.115131:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY +240ms
  pw:browser [pid=2510][err] [2510:0417/152447.115154:ERROR:env.cc(255)] The platform failed to initialize.  Exiting. +0ms
  pw:browser [pid=2510][err] Waiting for the debugger to disconnect... +1ms
  pw:browser <ws disconnecting> ws://127.0.0.1:42529/f6329427-510a-4f9c-a49d-7d22e07004bf +0ms
  pw:browser <ws disconnected> ws://127.0.0.1:42529/f6329427-510a-4f9c-a49d-7d22e07004bf code=1005 reason= +5ms
  pw:browser [pid=2510][err] The futex facility returned an unexpected error code. +0ms
  pw:browser [pid=2510] <process did exit: exitCode=null, signal=SIGABRT> +3ms
  pw:browser [pid=2510] starting temporary directories cleanup +0ms
  pw:browser [pid=2510] finished temporary directories cleanup +12ms
  
  1) pharmac.spec.ts:41:1 › app should not be packaged ─────────────────────────────────────────────
    TypeError: Cannot read properties of undefined (reading 'evaluate')
      40 |
      41 | test('app should not be packaged', async () => {
    > 42 | 	const isPackaged = await electronApplication.evaluate(async ({ app }) => {
         | 	                                             ^
      43 | 		// This runs in Electron's main process, parameter here is always
      44 | 		// the result of the require('electron') in the main app script.
      45 | 		return app.isPackaged;
        at /opt/atlassian/pipelines/agent/build/electron-desktop/testing/e2e-tests/pharmac.spec.ts:42:47
    TypeError: Cannot read properties of undefined (reading 'close')

1 failed
    pharmac.spec.ts:41:1 › app should not be packaged ──────────────────────────────────────────────`

Additional context

This is an electron application that uses static files from a vuejs project

Environment

System:
  OS: Debian GNU/Linux 12 (bookworm)
  CPU: (8) arm64
Binaries:
  Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
  npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
npmPackages:
  @playwright/test: 1.41.1 => 1.41.1
@mxschmitt
Copy link
Member

pw:browser [pid=2510][err] [2510:0417/152447.115131:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY +240ms

Try doing xvfb-run npm run test:debug:linux since Electron asks for an X server but there is none.

@Aenardhil
Copy link
Author

Aenardhil commented Apr 18, 2024

With this xvfb-run i got this new error instead:

xvfb-run npm run test:debug:linux
>  test:debug:linux
> DEBUG=pw:browser npx playwright test
Running 4 tests using 1 worker
  pw:browser <launching> /opt/atlassian/pipelines/agent/build/electron-desktop/node_modules/electron/dist/electron -r /opt/atlassian/pipelines/agent/build/electron-desktop/node_modules/playwright-core/lib/server/electron/loader.js --no-sandbox --inspect=0 --remote-debugging-port=0 dist/main.js +0ms
  pw:browser <launched> pid=2736 +7ms
  pw:browser [pid=2736][err] [2736:0418/094503.439891:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory +99ms
  pw:browser [pid=2736][err] Debugger listening on ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 +42ms
  pw:browser [pid=2736][err] For help, see: https://nodejs.org/en/docs/inspector +0ms
  pw:browser <ws connecting> ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 +1ms
  pw:browser <ws connected> ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 +11ms
  pw:browser [pid=2736][err] Debugger attached. +1ms
  pw:browser [pid=2736][err] [2736:0418/094503.842482:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory +347ms
  pw:browser [pid=2736][err] [2736:0418/094503.842528:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory +1ms
  pw:browser [pid=2736][err] [2736:0418/094503.844131:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") +1ms
  pw:browser [pid=2736][err] [2736:0418/094503.844174:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") +0ms
  pw:browser [pid=2736][err] [2736:0418/094503.844192:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") +0ms
  pw:browser [pid=2736][err] [2736:0418/094503.844208:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") +0ms
  pw:browser [pid=2736][err] [2736:0418/094503.846820:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 2762: Permission denied (13) +2ms
  pw:browser [pid=2736][err]  +2ms
  pw:browser [pid=2736][err] DevTools listening on ws://127.0.0.1:33243/devtools/browser/87b6840c-fc33-4a06-8872-560463a9ccc0 +0ms
  pw:browser <ws connecting> ws://127.0.0.1:33243/devtools/browser/87b6840c-fc33-4a06-8872-560463a9ccc0 +0ms
  pw:browser [pid=2736][err] [2736:0418/094503.856285:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type:  +8ms
  pw:browser <ws connected> ws://127.0.0.1:33243/devtools/browser/87b6840c-fc33-4a06-8872-560463a9ccc0 +2ms
  pw:browser [pid=2736][err] [2736:0418/094503.893148:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") +36ms
  pw:browser [pid=2736][err] [2736:0418/094503.896732:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 2779: Permission denied (13) +2ms
  pw:browser <ws disconnecting> ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 +65ms
  pw:browser [pid=2736][err] Waiting for the debugger to disconnect... +5ms
  pw:browser [pid=2736][err] [2762:0418/094503.966560:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization +0ms
  pw:browser <ws disconnecting> ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 +1ms
  pw:browser <ws disconnected> ws://127.0.0.1:44091/2ef4c5be-737d-418f-a336-eff3528a93f2 code=1005 reason= +3ms
  pw:browser <ws disconnected> ws://127.0.0.1:33243/devtools/browser/87b6840c-fc33-4a06-8872-560463a9ccc0 code=1006 reason= +23ms
  pw:browser [pid=2736] <process did exit: exitCode=0, signal=null> +18ms
  pw:browser [pid=2736] starting temporary directories cleanup +1ms
  pw:browser [pid=2736] finished temporary directories cleanup +15ms

@yury-s
Copy link
Member

yury-s commented Apr 18, 2024

With this xvfb-run i got this new error instead:

What exactly is not working?

Can you share complete reproduction, so that we could try it locally?

@yury-s
Copy link
Member

yury-s commented Apr 22, 2024

We need more information to act on this report. Please file a new one and link to this issue when you get back to it!

@yury-s yury-s closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants