Monday, 8 May 2017

Backstopjs [url changed to "about:blank"]

i'm having trouble to use scripts, i see this problem in another issues but i can't resolve it.

my application has a login page and when some one make a login it takes you to the first page localhost:3000/#/potenctial, and it's appears to occurs, but it take me back to the login page, and then to a blank page.

localhost:3000 is the login page and localhost:3000/#/potential is the first page after login success

  • Detail, it happens in any page who i try to login. like facebook

i was thinking it could be something with the installation, but i installed everything in other Ubuntu and same happens.

that is the terminal output

CasperJS:  Debug is enabled!
CasperJS:  [info] [phantom] Starting...
CasperJS:  #########################################################################
CasperJS: START SCRIPT
CasperJS: #########################################################################
CasperJS:  [info] [phantom] Starting...
CasperJS:  [info] [phantom] Running suite: 7 steps
CasperJS:  [debug] [phantom] opening url: http://localhost:3000/#/, HTTP GET
CasperJS:  [debug] [phantom] Navigation requested: url=http://localhost:3000/#/, type=Other, willNavigate=true, isMainFrame=true
CasperJS:  [debug] [phantom] url changed to "http://localhost:3000/#/"
CasperJS:  [error] [phantom] remote error > http://localhost:3000/styles/skin/skin.css failed to load (404)
CasperJS:  [error] [phantom] remote error > http://localhost:3000/styles/skin/skin.css failed to load (404)
CasperJS:  [error] [phantom] remote error > http://localhost:3000/templateCacheHtml.js failed to load (404)
CasperJS:  [error] [phantom] remote error > http://localhost:3000/templateCacheHtml.js failed to load (404)
CasperJS:  [debug] [phantom] Navigation requested: url=https://my.appcues.com/frame, type=Other, willNavigate=true, isMainFrame=false
CasperJS:  [error] [phantom] remote error > http://localhost:3003/one/1.0/myself?expand=groups failed to load (401)
CasperJS:  [error] [phantom] remote error > http://localhost:3003/one/1.0/myself?expand=groups failed to load (401)
CasperJS:  [debug] [phantom] Successfully injected Casper client-side utilities
CasperJS:  [info] [phantom] Step anonymous 2/7 http://localhost:3000/#/ (HTTP 200)
CasperJS:  #########################################################################
CasperJS: Form exists
CasperJS:  [debug] [phantom] Mouse event 'mousedown' on selector: input[id="inputUsername"]
CasperJS:  [debug] [phantom] Mouse event 'mouseup' on selector: input[id="inputUsername"]
CasperJS:  [debug] [phantom] Mouse event 'click' on selector: input[id="inputUsername"]
CasperJS:  [debug] [phantom] Mouse event 'mousedown' on selector: input[id="inputPassword"]
CasperJS:  [debug] [phantom] Mouse event 'mouseup' on selector: input[id="inputPassword"]
CasperJS:  [debug] [phantom] Mouse event 'click' on selector: input[id="inputPassword"]
CasperJS:  [debug] [phantom] Mouse event 'mousedown' on selector: xpath selector: //button[text()="Entrar"]
CasperJS:  [debug] [phantom] opening url: http://localhost:3000/#/, HTTP GET
CasperJS:  [debug] [phantom] Navigation requested: url=http://localhost:3000/#/, type=Other, willNavigate=true, isMainFrame=true
CasperJS:  [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
CasperJS:  [debug] [phantom] url changed to "about:blank"

Testing script failed with code: 1

An unexpected error occured. You may want to try setting the debug option to `true` in your config file.
COMMAND | Command `test` ended with an error
COMMAND | Error: An unexpected error occured. You may want to try setting the debug option to `true` in your config file.
              at ChildProcess.<anonymous> (/home/patrick/Repositorios/estudos/backstopJS/backstopJS_only/node_modules/backstopjs/core/util/createBitmaps.js:70:18)
              at emitTwo (events.js:106:13)
              at ChildProcess.emit (events.js:194:7)
              at maybeClose (internal/child_process.js:899:16)
              at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

npm ERR! Linux 4.4.0-75-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! backstopjs@2.6.11 test: `node ./cli/index.js test`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the backstopjs@2.6.11 test script 'node ./cli/index.js test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the backstopjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./cli/index.js test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs backstopjs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls backstopjs
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /home/patrick/.npm/_logs/2017-05-08T20_11_29_912Z-debug.log
➜  backstopjs 

the debug.log

debug.log.txt

this is the backstop.json

{
  "id": "prod_test",
  "viewports": [    
    {
      "name": "tablet_h",
      "width": 1024,
      "height": 768
    }
  ],
  "scenarios": [
    {
      "label": "BackstopJS ONE",
      "url": "http://localhost:3000/#/potential",
      "hideSelectors": [],
      "removeSelectors": [],
      "selectorExpansion": true,
      "selectors": [
        "body"
      ],
      "readyEvent": null,
      "delay": 500,
      "misMatchThreshold" : 0.1,
      "onBeforeScript": "onBefore.js",
      "onReadyScript": "onReady.js"
    }
  ],
  "paths": {
    "bitmaps_reference": "backstop_data/bitmaps_reference",
    "bitmaps_test": "backstop_data/bitmaps_test",
    "casper_scripts": "backstop_data/casper_scripts",
    "html_report": "backstop_data/html_report",
    "ci_report": "backstop_data/ci_report"
  },
  "casperFlags": [],
  "engine": "phantomjs",
  "report": ["browser"],
  "debug": true
}

and this is the onBefore.js

module.exports = function(casper, scenario, vp) {

console.log('#########################################################################');
  console.log('START SCRIPT');
  console.log('#########################################################################');
  casper.start("http://localhost:3000/#/",function(){

    if (this.exists('form.form-signin')) {

      console.log('#########################################################################');
      this.echo('Form exists');

      this.sendKeys('input[id="inputUsername"]', '< USER >');
      this.sendKeys('input[id="inputPassword"]', '< PASSWORD >');
      this.clickLabel('Entrar', 'button');

      // this.fill('form.form-signin', {
      //   'inputUsername': '< USER >',
      //   'inputPassword': '< PASSWORD >'
      // }, true);

      console.log('PASS!');
      console.log('#########################################################################');


    }
  }); 

};

  • node v7.10.0
  • backstopjs@2.6.11

backstopjs is installed locally.

Thank you, and just to be clear i'm new on node, so it maybe not even be a bug.



via Patrick

No comments:

Post a Comment