garris / BackstopJS

Catch CSS curve balls.
http://backstopjs.org
MIT License
6.7k stars 604 forks source link

How do I setup backstop to run with Slimerjs on Windows 8? #311

Open disophisis opened 7 years ago

disophisis commented 7 years ago

So I've gone through a bunch of the issues relating to getting slimerjs working. I have gotten it to work fine under linux (by just following the instructions in the readme) but under Windows it has been kind of a bear.

I have backstop in C:\backstop.

I have installed slimerjs globally.

I have set an environment variable called SLIMERJS_EXECUTABLE and set it to the slimerjs path: C:\Users\appdata\roaming\npm\node_modules\slimerjs\lib\slimer

Changing the engine in backstop.json at this point and attempting to run my tests results in an error (could not find application.ini).

I read somewhere that copying over application.ini and omni.ja helps. I did so and slimerjs now appears to start but none of my tests will run. It just sits there: image

I read in some other issues that the path to casper_scripts has to be an absolute path, so I have updated that path in C:\backstop\backstop.json, but this doesn't seem to change anything.

I have also read that I need to add some paths to require.paths in slimerjs but I'm not exactly sure where I'm supposed to add those?

If anyone has a set of steps/paths/files to modify under Windows, or tell me what I'm missing above, some help would be great.

garris commented 7 years ago

One thing you can try as a sanity check is to do a separate install of Casper.js and slimer.js to make sure the will work together in your environment. If you can get that to work then we can rule out any dependency issue.

disophisis commented 7 years ago

Ah You reminded me. Yesterday I did manage to write a simple script using slimerjs and casperjs separate from this. It seemed to work just fine (and slimerjs rendered my web app nicely which is why I'm trying to stick with it; otherwise I'd just use phantomjs)

garris commented 7 years ago

Thanks. Please post your terminal output.

disophisis commented 7 years ago
C:\backstop>backstop reference

BackstopJS CWD:  C:\backstop
BackstopJS loading config:  C:\backstop\backstop.json

COMMAND | Executing core for `reference`
  clean | bitmaps_reference was cleaned.

Running CasperJS with:  [ 'C:\\Users\\i65414\\AppData\\Roaming\\npm\\node_modules\\backstopjs\\capture\\genBitmaps.js',
  '--engine=slimerjs' ]

Bitmap file generation completed.

Run `$ backstop test` to generate diff report.

COMMAND | Command `reference` sucessfully executed

C:\backstop>

It will stop at the "Running CasperJS" step and open the slimerjs window I pasted in the OP. Once that is closed the rest of the console output is displayed, stating it's successful, but there are no screenshots taken. (It completes very quickly)

garris commented 7 years ago

Thanks -- sorry, I forgot to also ask you to post the config file.

disophisis commented 7 years ago

No prob thank you for taking the time to look at this.

{
  "id": "dev",
  "viewports": [
    {
      "name": "desktop",
      "width": 1920,
      "height": 1080
    }
  ],
  "scenarios": [
    {
      "label": "Dev Create User",
      "url": "http://localhost:8000/src",
      "hideSelectors": [],
      "removeSelectors": [],
      "selectors": ["document"],
      "readyEvent": null,
      "delay": 10000,
      "misMatchThreshold" : 0.1,
      "onBeforeScript": "C:/backstop/backstop_data/casper_scripts/onBefore.js",
      "onReadyScript": "C:/backstop/backstop_data/casper_scripts/onReady.js"
    }
  ],
  "paths": {
    "bitmaps_reference": "C:/backstop/backstop_data/bitmaps_reference",
    "bitmaps_test": "C:/backstop/backstop_data/bitmaps_test",
    "casper_scripts": "C:/backstop/backstop_data/casper_scripts",
    "html_report": "C:/backstop/backstop_data/html_report",
    "ci_report": "C:/backstop/backstop_data/ci_report"
  },
  "casperFlags": [],
  "engine": "slimerjs",
  "report": ["browser"],
  "debug": true
}

As you can see I just went ahead and made all paths absolute.

garris commented 7 years ago

Ok. Everything looks fine with your paperwork. Does it work if you just use phantomjs?

disophisis commented 7 years ago

Yeah and that's what's kind of annoying... Phantom works great, but phantom has major issues rendering our web app for some reason.

garris commented 7 years ago

Yes. Phantom doesn't always do what it should do. I'll need to test it locally -- but I won't be able to get to it for a bit. The next thing I'd do is release a patch with casper verbose/debug mode enabled. If you can manage that on your own it would be a big help. We need to see if slimer.js is complaining about anything.

disophisis commented 7 years ago

I've been running it with the debug property set to true in the config, which if I'm reading genBitmaps.js correctly, should be setting casper's verbose mode to true as well. Is there another place I can get access to more logging? Because even with verbose on what I've pasted above is all I get. (or maybe there's a log somewhere?)

garris commented 7 years ago

There was a bug where the config.debug parameter was not getting written-- I believe it's fixed in trunk -- you can try installing this version...

$ npm install -g garris/backstopjs#master
garris commented 7 years ago

config.debug option is fixed in latest release. Please install npm install backstopjs -g and post console output -- there should be more information to look at. Thanks.

disophisis commented 7 years ago

Hmm yeah I updated to 2.05 (hopefully that is the latest version) and it doesn't seem to have changed my output at all. The original terminal output above is still what I'm seeing.

paradizex commented 7 years ago

Try using relative path for casper_scripts and absolute path for the rest

stevenbriscoeca commented 7 years ago

Is this issue still relevant?

I keep getting CasperJS: Fatal: The system cannot find the file specified; did you install slimerjs?

I installed it with npm install -g slimerjs

@garris

olee commented 7 years ago

Same problem here....

justin-parker commented 7 years ago

same issue here...

garris commented 7 years ago

oh sorry guys. 😔 I don't have a windows box and sadly can't put any effort here. Someone in the community will need to take this cause up. 📢 Help wanted!

As a consolation, I can tell you that I am in the process of integrating chrome-headless into backstop using chromy.js as the driver. It is already in beta (still buggy -- but mostly working). Feel free to try this out -- It's waaaay better than having to deal with phantom or slimer since all modern JS & CSS are handled. Also, performance is way better (screenshots are taken in parallel). https://github.com/garris/BackstopJS/tree/backstop-chromy npm install -g backstopjs@beta

Kenith commented 6 years ago

same issue here