These are chat archives for rosshinkley/nightmare

Feb 2017
Jón Brynjar Másson
Feb 13 2017 10:21
@johnferro, thanks for you reply. I have this package.json file
I would like that file to control the creation of my browser window, now I just get the title bar correct but no content gets rendered, how could I achieve this?
Also if the app is running locally wold to put in .goto() ?
       "name": "@nls/retailer-app",
       "main": "node_modules/@nls/ra-core/main.js",
       "window": {
       "kiosk": false,
       "width": 1024,
       "height": 600,
       "frame": true,
       "toolbar": true

my browser window gets created with this electron script,

const electron = require('electron')

const settings = require('./settings.json')
var packagePath = '../../../package.json'
if( {
  packagePath = '../' + + '/package.json'
const config = require(packagePath)

// Module to control application life.
const app =
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow () {
  if (process.env.NODE_ENV === "development") {
    config.window.kiosk = false;

  // Create the browser window.
  mainWindow = new BrowserWindow(config.window)

  // and load the index.html of the app.

  // Emitted when the window is closed.
  mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null

Here you see I'm using the package.json file for controlling the creation of the browser window, how do I let nightmare use that file?
Any help on this issue would be greatly appreciated.

Jón Brynjar Másson
Feb 13 2017 10:40
this is what my index.html file looks like
<!DOCTYPE html>
    <title>Retail Application</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link href="stylesheets/master.css" rel="stylesheet" media="screen">
    <link href="stylesheets/pageguide.min.css" rel="stylesheet" media="screen">
   <script type="text/javascript">
     window.$ = window.jQuery = require('./src/libs/jquery/jquery-2.1.4.min');
     window.ko = require('./src/libs/knockout/knockout-3.4.0');
     window.nodeRequire = require;
     delete window.require;
    <script data-main="src/app/require.config" src="src/libs/require/require.js"></script>
  <body data-bind="css: { 'logged-out': loggedOut(), 'trainingmode': trainingMode(), 'pageTransition': pageTransition() }">

    <nav id="js-side-nav" class="bw-side-navbar"></nav>
    <nav id="js-top-nav" class="bw-top-navbar no-line"></nav>

    <div id="js-pricebox" class="bw-price-box"></div>
    <div id="js-messagebox"></div>
    <div id="js-progressbar" class="nls-progressBar"></div>

    <div id="main" class="bw-main">
      <section id="js-section"></section>
    <div id="js-help"></div>
    <div id="js-modalcontainer" class="bw-modal modal hide"></div>

this file is located here node_modules/@nls/ra-core/
Feb 13 2017 22:05
@jonbr Ah I think I misread your first question. If you are making an actual electron app then I'm not sure if you really need nigthmare since you already have access to the underlying browserwindow and webcontents from within your electron script