twolfson / karma-electron

Karma launcher and preprocessor for Electron
The Unlicense
59 stars 21 forks source link

How to write unit test on app environment ? #26

Closed ghost closed 7 years ago

ghost commented 7 years ago
    this.electron  = window ? window['electron'] : null;
    this.listener$ = this.replaySubject.asObservable();

    if (!this.electron) {
      console.log('Developing with web browser...');

    } else {
      this.ipcRenderer.on(
        ELECTRON_CH.BRIDGE.CLIENT,
        (event, message) => {
          console.log('ipcRenderer event:', event);
          this.replaySubject.next(message);
        });
    }

When I run the application, it alway running on the web browser, not an app! How can I config application for run like app

twolfson commented 7 years ago

We only support testing in the renderer portion of Electron -- similar to testing in a Chrome browser. To test the other portions of an Electron application (e.g. main, end to end), we recommend using Electron's recommendation of Selenium and its webdriver:

https://github.com/electron/electron/blob/v1.3.6/docs/tutorial/using-selenium-and-webdriver.md

ghost commented 7 years ago

@twolfson thank you !