o2platform / electrium

Browser automation based on Electron (similar to Selenium)
Apache License 2.0
1 stars 0 forks source link

Invalid path when consuming Electrium from npm #1

Open DinisCruz opened 8 years ago

DinisCruz commented 8 years ago

This is what happens when invoking start (the problem is that the .bin/electrium path is not found due to the fact that is exists on the top level node_modules folder (vs the electrium's node_module's folder)

image

here is a test that isolates the issue

image

here is a test that replicates the problem

  it 'open', (done)->

    Spectron_API = require('electrium').Spectron_API

    spectron = new Spectron_API();
    spectron.setup().start().catch (err)->
      err.message.assert_Contains "ENOENT: no such file or directory"
      done()

    return
DinisCruz commented 8 years ago

Here is a temp fix

  beforeEach ()->
    spectron = new Spectron_API();
    spectron.setup()
    spectron.options.path =spectron.options.path.remove('electrium/node_modules/')  # temp fix for https://github.com/o2platform/electrium/issues/1    
    spectron.app = new spectron.Application(spectron.options)
    spectron.start()
      .then ()->
        console.log 'spectron started'
      .catch (err)->
        console.log 'error: ' + err

or just

  beforeEach ()->
    using new Spectron_API(), ->
      spectron = @
      @.setup()
      @.options.path = @.options.path.remove('electrium/node_modules/')  # temp fix for https://github.com/o2platform/electrium/issues/1
      @.app = new @.Application(@.options)
      @.start()