0

Almost new in using playwright. Exploring the things and checking what we can do with this tool.

I am trying to launch our Theia based electon app in Ubuntu 18.04 with below source.

const { _electron: electron } = require('playwright');
//const { _electron } = require('playwright');


//import { test, expect, Page } from '@playwright/test';

(async () => {
      // Launch Electron app.
      const electronApp = await electron.launch('./my_executable_file_path');
                                               //this executable is an artifact/packgae

})();

test.describe('New Todo', () => {
      test('should allow me to add todo items', async ({ page }) => {
      //let's not do anything before the app launch.
  });

});

In my package.json file, i have this already

 "devDependencies": {
        "@playwright/test": "^1.20.2",

I can successfully run test cases based on the browser but not able to launch the electron app.

electron.launch: Cannot find module 'electron/index.js'

We don't have this index.js in our jenkins generated artifact.

noor
  • 2,954
  • 2
  • 16
  • 29

1 Answers1

0

This is how I launched electron successfully

const electronApp = await _electron.launch({
        args: ['theia-electron-main.js'],
        cwd: 'cube-electron/apps/studio/electron/scripts'
     });