Questions tagged [mocha-phantomjs]

Mocha is a feature-rich JavaScript test framework running on node and the browser.

The mocha-phantomjs project provides a mocha-phantomjs.coffee script file and extensions to drive PhantomJS while testing your HTML pages with Mocha from the console. The preferred usage is to install mocha-phantomjs via node's packaged modules and use the mocha-phantomjs binary wrapper.

57 questions
2
votes
0 answers

How can I pass arbitrary parameters to my mocha tests with mochaPhantomJS & gulp?

I'm using gulp & mochaPhantomJS. I'd like to use the same test html and run different tests against it. How can I pass arbitrary parameters (by which I mean not the phantom args) that I can retrieve from within my test JavaScript? var gulp =…
jwl
  • 10,268
  • 14
  • 53
  • 91
2
votes
1 answer

Script error (:0) when trying to run async test in mocha-phantomjs

i'm trying to test a piece of asynchronous code but sadly enough i'm getting an obscure error code and i cant seem to figure out what the issue is. The test runs fine in the browser but running it in phantomjs results in: Uncaught Script error.…
2
votes
1 answer

mocha-phantomjs error loading resource mocha.js

I try to run mocha-phantomjs and get this error: $ npm run test-phantom > selenium-test@0.0.5 test-phantom /path/to/project/ > mocha-phantomjs test/client.html Error loading resource file:///path/to/project//test/mocha.css (203). Details: Error…
fakedrake
  • 6,528
  • 8
  • 41
  • 64
2
votes
1 answer

Unit Testing Marionette.Behaviors with mocha

Here is my behavior: /** * @class Filter * @classdesc Holds filtering behavior for menu views * @extends Marionette.Behavior */ define(['marionette', 'eventer'], function (Marionette, eventer){ 'use strict'; var Filter =…
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
1
vote
0 answers

PhantomJS page.render blank white background image on 403

While performing screenshots of pages using PhantomJS, I noticed that it won't capture the screenshot if response status is 403 or Forbidden. Test1: var page = require('webpage').create(); page.open('http://github.com/', function() { …
Arbazz Hussain
  • 1,622
  • 2
  • 15
  • 41
1
vote
1 answer

Not able to click on popup allert message"OK or Cancel" with PhantomJS Selenium Java, working fine with IE

Below is the code that we are trying to click the first popup message after clicking on another popup also triggers and need to click that also. We are embedding java-script in JAVA and doing it with phantomJS. Not sure how to handle with javascript…
rin
  • 101
  • 1
  • 9
1
vote
0 answers

TeamCity & mocha-phantomjs: ReferenceError: Can't find variable: require

I need to run JS tests on CI server. Testing framework is mocha. I've found mocha-phantomjs but it gives me output like this: ReferenceError: Can't find variable: require at c:/w1/-----/---/Tests/RestApiTests/BasicTests.js:1 When I changed…
1
vote
0 answers

No test output from mocha-phantomjs

I'm having trouble getting the simplest mocha-phantomjs test to work on Windows, from the command-line. It seems to run the javascript - as I can see some output from console.log, but I'm not seeing any test output. I did npm install on the…
demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103
1
vote
0 answers

Node PhantomJs throwing errors for 75+ concurrent requests

Node PhantomJs throwing errors for 75+ concurrent requests , number of requests are bit irrelevant here.It's just issue is exposed at that point. I'm suspecting either requests are timing out or underlying sockets not playing well with nodeJs.I'm…
vishal8492
  • 11
  • 2
1
vote
1 answer

Karma-grunt test case failure with PhantomJS

I am running a test suite which uses karma to test a few capabilities of PhantomJS on Ubuntu 15.04. The test case takes a few JavaScript files, creates a bundle, and invokes PhantomJS to serve these scripts. I could trace the execution till the…
user4648417
1
vote
0 answers

Grunt.js Mocha task fails

When I run mocha task on grunt I get an error says "mocha was not initialized before the page finished loading. Make sure to include mocha.js as a direct script and call mocha.ui or mocha.setup." // mocha command exec: { mocha: { …
Ayberk
  • 50
  • 11
1
vote
1 answer

Problems with gulp-mocha-phantomjs after upgrade version 0.8.0

I have a few problems after having upgraded to gulp-mocha-phantomjs Version 0.8.0: 1) Error when running against remote by url: When running my tests against a remote URL, I get the following error: ReferenceError: Can't find variable: Mocha at…
doberkofler
  • 9,511
  • 18
  • 74
  • 126
1
vote
1 answer

mocha test when callback is run

I am testing an api which already has a callback inside a callback at the end of the function. I want to wrap this in a test to verify the object is correct but this doesn't seem to be working. callbackEnd() gets called but that's it. In the…
user1572796
  • 1,057
  • 2
  • 21
  • 46
1
vote
0 answers

How to integrate emberjs mocha-phantomjs tests with dom event listeners

In our mocha-phantomjs unit tests for our ember application, I'm adding some event listeners to a video element in the DOM: didInsertElement: function() { this._super(); var video = this.$('.video-review').get(0); var self = this; …
1
vote
1 answer

TypeError: 'undefined' is not an object (evaluating 'text.replace') - when testing backbone view

I am trying to write the tests for a Backbone app which uses twig and symphony to render the underscore templates, using mocha, chai and sinon, with blanket for code-coverage and phantomjs for browser simulation. I have managed to load the template…
hyprstack
  • 4,043
  • 6
  • 46
  • 89