iamchrismiller / grunt-casper Goto Github PK
View Code? Open in Web Editor NEWRun CasperJS Scripts/Functional Tests
License: Other
Run CasperJS Scripts/Functional Tests
License: Other
Hello
Please update the readme to add documentation for concurrent and parallel options.
Best regards
As far as I can tell SlimerJS is installed and working properly. However, when I change the engine
option in grunt-casper to slimerjs
I get an "Aborted due to warnings." message in the console with no error details. Here is What I'm seeing in the console:
Running "casper:functional" (casper) task
>>
Casper Task 'casper:functional' took ~1393ms to run
Warning: Task "casper:functional" failed. Use --force to continue.
Aborted due to warnings.
And here is what I have in my Gruntfile.js:
casper: {
options: {
test: true,
includes: './bower_components/jquery/dist/jquery.min.js',
engine: 'slimerjs'
},
functional: {
options: {
args: ['--rooturl=http://<%= connect.options.hostname %>:<%= connect.options.port %>/']
},
files: {
'test/results/functional-results.xml': [
'test/spec/**/*.js'
]
}
}
},
Any idea what might be happening?
I've stumbled on this issue when trying to fix an issue on https://github.com/mozilla/localForage which uses grunt-casper for tests.
Their tests are using arguments, and there is a Arguments not supported ins test mode
warning showing up from here : https://github.com/iamchrismiller/grunt-casper/blob/master/tasks/lib/casper.js#L121
I haven't found anything in the casper documentation that tells that arguments aren't available in test mode, so I've tried removing the condition and the arguments are passed successfully.
Thanks
I'm executing my tests with the version 0.2.0 and the result is:
[warning] [phantom] Loading resource failed with status=fail: https://www.example.com/
[warning] [phantom] Casper.waitFor() timeout
FAIL Waiting for login form
# type: fail
# file: test/casperjs/tests/wallet.js
# subject: false
[warning] [phantom] --fail-fast: aborted all remaining tests
⚠ --fail-fast: aborted all remaining tests
# Multiple bonus exchange.
FAIL 7 tests executed in 52.783s, 6 passed, 1 failed, 0 dubious, 0 skipped.
Details for the 1 failed test:
In test/casperjs/tests/wallet.js
Canceled bonus buying.
fail: Waiting for login form
>>
Casper Task 'casper:wallet' took ~53474ms to complete
Done, without errors.
$ echo $?
0
Executing the same tests with 0.1.4 the result was:
[warning] [phantom] Loading resource failed with status=fail: https://www.example.com/
[warning] [phantom] Casper.waitFor() timeout
FAIL Waiting for login form
# type: fail
# file: test/casperjs/tests/wallet.js
# subject: false
[warning] [phantom] --fail-fast: aborted all remaining tests
⚠ --fail-fast: aborted all remaining tests
# Multiple bonus exchange.
FAIL 7 tests executed in 42.106s, 6 passed, 1 failed, 0 dubious, 0 skipped.
Details for the 1 failed test:
In test/casperjs/tests/wallet.js
Canceled bonus buying.
fail: Waiting for login form
>>
Warning: Task "casper:wallet" failed. Use --force to continue.
Aborted due to warnings.
$ echo $?
3
I've encountered the same type of problem reported here: #55. I've also tried uninstalling & reinstalling grunt-casper fresh, but I'm still running into the same issue.
Running tests with phantomjs works fine, but with slimerjs I get:
Running "casper:fast" (casper) task
Casper Task 'casper:fast' took ~245ms to run
Warning: Task "casper:fast" failed. Use --force to continue.
Aborted due to warnings.
with no other description.
Any ideas or things to try? I would really like to be able to run my tests in both engines, thanks!
Edit - Here is the full output with --verbose:
Spawning casperjs with args: [ 'test',
'00-helpers.js',
'--engine=slimerjs',
'--showconsolelogs=false',
'--fail-fast=true',
'--ignore-ssl-errors=true',
'--pre=tests/pre-test.js',
'--user=casper_fast',
'--pass=casper' ]
Found PhantomJS Executable /Users/justin/Documents/Pathbrite/node_modules/grunt-casper/node_modules/phantomjs/lib/phantom/bin/phantomjs
Found SlimerJS Executable /Users/justin/Documents/Pathbrite/node_modules/grunt-casper/node_modules/slimerjs/lib/slimer/slimerjs
Found CasperJS Executable /Users/justin/Documents/Pathbrite/node_modules/grunt-casper/node_modules/casperjs/bin/casperjs>>
Casper Task 'casper:fast' took ~150ms to run
Warning: Task "casper:fast" failed. Use --force to continue.
Aborted due to warnings.
Be nice to be able to specify the paths to casper and phantom as options in the grunt file, rather than having to add them to the environment variable
Hey it would be great to add support for testing in parallel to 1.1. Our tests run about twice as fast in parallel. I was able to hack it in tasks/casper.js with a couple lines of code:
(outside this.files.forEach block)
var seriesOption = (opttions.parallel) ? '' : 'Series';
grunt.util.async['forEach' + seriesOption](file.src,function (srcFile, next) {
What would be the best way to incorporate this into grunt-casper? Should I contribute to 1.1? When is that going to be released? We are doing a pretty major project right now with a ton of developers, so updating grunt-casper is far superior to us than hacking into everyone's node_modules folder.
Got this error:
> [email protected] install /home/travis/build/sapegin/tamia/node_modules/phantomcss/node_modules/phantomjs
> node install.js
PhantomJS detected, but wrong version 1.9.8 @ /usr/local/phantomjs/bin/phantomjs.
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2
Receiving...
Error making request.
Error: CERT_UNTRUSTED
at SecurePair.<anonymous> (tls.js:1381:32)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:980:10)
at CleartextStream.read [as _read] (tls.js:472:13)
at CleartextStream.Readable.read (_stream_readable.js:341:10)
at EncryptedStream.write [as _write] (tls.js:369:25)
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at EncryptedStream.Writable.write (_stream_writable.js:183:11)
at write (_stream_readable.js:602:24)
Full log is here.
P. S. Why 1.9.8 is wrong? ;-)
I'm not sure if this is a grunt-casper issue versus a casperjs issue, but the CustomEvent method was not working for me through casper.evaluate:
casper.evaluate(function(){
var obj = document.createElement('div');
obj.addEventListener("cat", function(e) { console.log(e.detail) });
var event = new CustomEvent("cat", {"detail":{"hazcheeseburger":true}});
obj.dispatchEvent(event);
});
I finally got it to work by implementing this polyfill on the page I was testing:
(function () {
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
};
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
})();
I thought I'd point it out as this caused me a few hours of grief, and I'd thought it might save someone some time.
When looking for the casper bin, the modulePaths seem to only look for casper in the global install dir, or as a sibling to grunt-casper, and not as a local dependency.
Am I doing something wrong?
modulePaths : [
path.resolve(__dirname, '../../..'), //local
'/usr/local/lib/node_modules' //global
],
If casper is installed as a local dependency to grunt-casper shouldn't there be a modulePath like:
path.resolve(__dirname, '../../node_modules'), // local to grunt-casper
I feel like this is probably my error, so am opening an issue instead of issuing a PR.
Thanks chris!
It would be nice (and in our case really helpful ;) to be able to set the cwd when spawning the CasperJS process.
Please see this excerpt from my Gruntfile. This runs the test just fine however no xml file is generated. I've tried every variation in this repos README but none of them generate an xml file. Is this a bug or an error on my part?
casper: {
run: {
options: {
test: true,
'fail-fast': false
},
files: {
'xunit/ts_test.xml': ['build/tests/ts_test.js']
}
}
},
I had to revert back to 0.2.0. Am I doing something wrong in grunt?
casper : {
options : {
test : true,
includes: 'lib/test/setup.js',
parallel : true,
"fail-fast": false,
concurrency : 10,
'log-level' : 'warning',
},
files : {
src: [
"app/**/*.test.js",
// "app/entertainment/details/**/*.test.js",
]
}
},
I have a fork of the Casperjs repo which has some customized functions added to it. When using npm install, grunt-casper pulls in the newest version and uses that instead of the one I have installed on our build agents.
Right now I have a script that goes in and and modifies the grunt.util.spawn to run with the old 'casperjs' cmd which solves the issue.
Could we get functionally similar to phantomjs in which it looks for a currently installed version and uses that, then defaulting to the npm managed version if nothing is found in the path?
When I try to pass in templated args, Grunt is erroring out.
Ex: args : [ '--port=<%= test.port%>' ]
Produces this error:
An error occurred while processing a template (_ is not defined)
Hi,
I'm trying add --ignore-ssl-errors
to my options but it doesn't apply.. the script is stucking.
options:
options: { parallel: false, "ignore-ssl-errors":true },
my ssl is self-signed.
Chris, thanks for the update to get casper test execution working.
However, while the casper test works correctly, it only executes once, regardless of the number I use for the concurrency.
Scotts-MacBook-Pro-2:grunttest sh_snyder$ grunt --verbose casper:simpletest
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-casper" local Npm module tasks.
Reading /Users/sh_snyder/Documents/grunttest/node_modules/grunt-casper/package.json...OK
Parsing /Users/sh_snyder/Documents/grunttest/node_modules/grunt-casper/package.json...OK
Loading "casper.js" tasks...OK
+ casper
Loading "Gruntfile.js" tasks...OK
+ default
Running tasks: casper:simpletest
Running "casper:simpletest" (casper) task
Verifying property casper.simpletest exists in config...OK
Files: simple.js
Options: log-level="debug", test, parallel, concurrency=3
Arguments: (none)
Preparing casperjs spawn
Adding Option --log-level=debug
Spawning casperjs with args: test,simple.js,--verbose,--log-level=debug
Test file: simple.js
Opened page with title "Google"
Casper Task 'casper:simpletest' took ~3369ms to run
Done, without errors.
I was looking at the grunt-casper source and the call that is supposed to execute the calls in parallel "grunt.util.async.forEachLimit" is expecting an array of files as the first parameter. When I instrumented the async.forEachLimit call in async.js I see that once the initial call is made, the number of completed calls is compared to the file array length.
if (err) {
callback(err);
callback = function () {};
}
else {
completed += 1;
running -= 1;
if (completed === arr.length) {
callback();
}
else {
replenish();
}
}
Since that is 1, the function exits after one call. Perhaps there is another async call that is more appropriate.
Let me know if I can help with debugging.
Same issue as #61 though the mentioned fix of reinstalling grunt-casper didn't seem to help.
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Initializing config...OK
Registering "grunt-casper" local Npm module tasks.
Reading /Users/user/project/node_modules/grunt-casper/package.json...OK
Parsing /Users/user/project/node_modules/grunt-casper/package.json...OK
Loading "casper.js" tasks...OK
+ casper
Loading "Gruntfile.js" tasks...OK
+ test
Running tasks: test
Running "test" task
Running "casper:test" (casper) task
Verifying property casper.test exists in config...OK
Files: tests/browser/_util.js, tests/browser/basics.js -> tests/logs/browser.xml
Options: test, engine="slimerjs"
Arguments: (none)
Preparing casperjs spawn
Spawning casperjs with args: [ 'test',
'/Users/user/project/tests/browser/_util.js',
'/Users/user/project/tests/browser/basics.js',
'--engine=slimerjs',
'--xunit=tests/logs/browser.xml' ]
Found PhantomJS Executable /Users/user/project/node_modules/grunt-casper/node_modules/phantomjs/lib/phantom/bin/phantomjs
Found SlimerJS Executable /Users/user/project/node_modules/slimerjs/lib/slimer/slimerjs
Found CasperJS Executable /Users/user/project/node_modules/grunt-casper/node_modules/casperjs/bin/casperjs>>
Casper Task 'casper:test' took ~112ms to run
Warning: Task "casper:test" failed. Use --force to continue.
Aborted due to warnings.
package.json:
{
"devDependencies": {
"grunt-casper": "~0.4.2",
"grunt": "~0.4.5",
"slimerjs": "~0.9.5"
}
}
Any suggestions on how to debug? --verbose doesn't seem to reveal anything. Cheers!
Might be me rushing through docs, but I expected the task name and config to be 'casper' instead of 'casperjs' due to the name of the npm module.
'casperjs' totally makes sense though, so I might be way off base.
It would be great to get a summary of all the passing and failing tests across all the test files once grunt-casper completes its task. Right now you have to scroll through a bunch of output to see if anything failed. Any ideas on this?
I am trying to run all the .js files under smoke dir with grunt-casper, but sometimes it runs only 2 of the js files
grunt-casper config:
casper : {
smoke : {
options : {
test : true,
"fail-fast": true,
"log-level": "info",
"verbose": true,
"parallel": false,
},
files : {
'./smoke/casper-results.xml' : ['test/smoke/*.js']
}
}
}
Test code (the files share the same code to test out grunt-casper) I can't see anything wrong with it atm. I don't think it's related to the request to url, since the "running test" message is not even output for the missing test.
casper.test.begin(" test", 1, function(test) {
casper.start();
console.log("running test);
casper.open(url, {
method: 'head'
});
casper.then(function(response) {
test.done();
});
casper.run(function() {
casper.exit();
});
});
Is this a bug or is there an option to change the order that tests run in? I have a folder of tests like so:
/tests/01-testName.js
/tests/02-testName.js
And in Grunt:
casper: {
target: {
files: { 'path/to/results.xml' : ['tests/*.js'] }
}
}
Test 02-testName.js
is always executed before 01-testName.js
! I've also tried renaming them to A, B, etc, but they always seem to run in reverse alphabetical order. Any ideas?
Edit: the only workaround I found is a setup like this using array.reverse():
files: { path/to/results.xml' : [
'/tests/01-testName.js'
'/tests/02-testName.js'
].reverse()}
But this is not ideal because it requires me to manually list tests instead of using a wildcard *.js
Any thoughts?
I'm trying to use grunt-casper in a project. I installed it the common way: npm install grunt-casper --save-dev
.
I have the following configuration in my Gruntfile.coffee
:
casper:
functional:
options:
test: true
files:
'f.xml': ['.../tests']
When I run grunt functional
, I get the following output:
Running "casper:functional" (casper) task
>> CasperJS Binary Not Found, try `npm install`
Casper Task 'casper:functional' took ~1ms to run
Warning: Task "casper:functional" failed. Use --force to continue.
Aborted due to warnings.
I added a line manually in tasks/lib/casper.js
to print path.resolve(casperBin)
, and the path I got is just wrong. It prints:
$PROJECT_ROOT/node_modules/.bin/casperjs
while the binary can be found in the following paths:
> find $PROJECT_ROOT -name casperjs -type f -follow
$PROJECT_ROOT/node_modules/grunt-casper/node_modules/.bin/casperjs
$PROJECT_ROOT/node_modules/grunt-casper/node_modules/casperjs
$PROJECT_ROOT/node_modules/grunt-casper/node_modules/casperjs/rubybin/casperjs
The binary is searched in a path relative to the project root. It works when the project is grunt-casper, but not when the latter is just a dependency for another project.
Is this like this by design? Was it working correctly for all of you?
Tests for grunt-casper fail on the "spawnFailure" task when run on windows.
Steps to reproduce:
npm install
grunt
Expected:
All tests pass
Actual:
Running "spawnFailure" task
has 3 failed tests as the package
attr of the testsuite
node in the xml report contains an os specific absolute path. E.g. d:\projects\grunt-casper\test\fixtures\testFail
where the expected value is test/fixtures/testFail
I noticed you use grunt-lib-contrib.
It's deprecated and I would recommend you switch to the extracted modules instead:
stripPath
=> strip-path
minMaxInfo
=> maxmin
getNamespaceDeclaration
=> ticket
It seems that when running multiple tests suites for instance
{
files : {
'xunit/casper-results.xml' : ['product/test.js']
,'xunit/casper-results2.xml' : ['product/test2.js']
}
}
The grunt task completes when the first casperjs test suite complete, the other spawn still proceed but competes with the following grunt tasks.
You basically invoked taskComplete for each spawn instead of waiting for all spawns to complete and call it once.
When running casper through grunt casper with option verbose (and direct) - I see the output being displayed only after casper has finished running.
This is different from the intended outcome, as running casperjs with the same options, I see the logs & progress as it goes, and I don't have to wait for the spec to finish working.
Perhaps this is due to the fact you are creating casper as a spawn?
CasperJs version: 1.1.0-DEV
"grunt-casper": "0.1.3"
Windows 7
Latest GruntJs
I have
tests/integration
test1.js
test2.js
My options file is:
var casper = {
options: {
test: true,
'xunit_out': function(src) {
var file = src.split('/').pop();
return 'build/integration-xunit/' + file + '.xml';
},
//this doesn't work when set here.
//viewportSize: {width: 320, height: 500},
silentErrors: true,
'fail-fast' : false, //don't exit after a failure
},
integration: {
src: ['test/integration/*.js'],
}
};
module.exports = casper;
If there's a failure in test1.js, the test2.js suite doesn't run. the task exits after the first suite with:
Warning: Task "casper:integration" failed. Use --force to continue.
If I runt the task with --force
it still doesn't fix the behavior. Is there something that I'm missing?
I'm working with Casper-1.1.0-dev. The writing of the the xunit-Files is not working for me.
I would expect that I get a xml-File in my Project Folder. But nothing happens.
Any Idea?
casper : {
options : {
test : true,
includes: '<%=system.static.project.jsTest %>helper.js',
'log-level' : 'info'
},
smoketest : {
files : {
'casper-results.xml' : ['<%=system.static.project.jsTest %>smoketest.js']
}
}
}
I'm not too familiar with how Grunt runs tasks. I thought it would be in a synchronous fashion. However, it seems like we have a situation where grunt-casper starts but doesn't finish until grunt has already exited. This is happening on our build server where we are logging console output and performing other commands after Grunt runs. We are getting console output for Casper several seconds after Grunt exits which ultimately causes our test run to fail b/c it relies on a server that grunt turns on and off. Not only that, but the Casper test cases that do run are mixed with console output from other Grunt tasks. Note: Casper takes about 8 secs to execute all the tests.
Would you have any clue to why this would be happening?
Right now the task proceeds without running tests
Running "casperjs:test" (casperjs) task
Error: not found: casperjs
Done, without errors.
The README says you can override the Casper/Phantom binaries like this:
process.env.PHANTOMJS_EXECUTABLE = '/path/to/phantomjs';
process.env.CASPERJS_EXECUTABLE = '/path/to/casperjs';
This works for Casper JS and it is obvious from the code that this will work.
It doesn't seem to work for Phantom JS though and the code looks like it will only fall back on the binary if the node module is not found.
I quickly hacked tasks/lib/casper.js like below, which worked, but probably a better way:
//npm install wrapper
if (process.env["PHANTOMJS_EXECUTABLE"] && fs.existsSync(process.env["PHANTOMJS_EXECUTABLE"])) {
var phantomjs = process.env["PHANTOMJS_EXECUTABLE"];
} else {
var phantomjs = require('phantomjs');
}
It would be great if this could be fixed so that you can specify the binary as an override and not a fallback. As a bonus it would be good if SlimerJS could be overwritten too.
I can't get any log output unless a test throws an error. I'm trying to get output of tests that are passing and any other test.info() calls. Here's the options I'm using:
options: {
test: true,
direct: true,
'log-level': 'info',
'fail-fast': false
}
It would be nice if the plugin would also work with a non-global installation of phantomjs and casperjs. When I use the casperjs/phantomjs version I installed with --save-dev
I get this error:
Error: Task "casper:test" failed.
at Task.<anonymous> (/xxx/node_modules/grunt/lib/util/task.js:197:15)
at null._onTimeout (/xxx/node_modules/grunt/lib/util/task.js:225:33)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Aborted due to warnings.
I’m getting the following error referenced from this issue on casperjs/casperjs#728.
casper: {
options: {
test: true,
includes: 'app/shared/test/setup.js',
parallel: true,
concurrency: 10,
'fail-fast': true
},
files: [
'app/module/*.test.js',
]
}
Running "casper:files" (casper) task
>> Test file: app/module/module.test.js
>> Fatal: you can't override the preconfigured casper instance in a test environment.
>> Docs: http://docs.casperjs.org/en/latest/testing.html#test-command-args-and-options
Warning: Task "casper:files" failed. Use --force to continue.
The option load-images is set to 'no'. But phantomjs still serves all images.
options : {
test : true,
'log-level' : 'warning',
'ignore-ssl-errors' : 'yes',
'load-images': 'no'
},
We should probably do this somewhere else, but my workaround was to set casperBin to casperjs.exe
//Local casperjs dependency path
//var casperBin = "./node_modules/.bin/casperjs";
var casperBin = "./node_modules/grunt-casper/node_modules/casperjs/bin/casperjs.exe";
Used 0.3.1
Hi,
I defined the engine option onto the grunt task. However, I can see the followwing error:
>> Engine phantomjs not available. [phantomjs,slimerjs]
When we look into the casper.js file, we can see the following code:
if (self.supportedEngines.indexOf(options['engine'])) {
spawnOpts.push('--engine=' + options['engine']);
} else {
grunt.log.warn('Engine ' + options['engine'] + ' not available. [' + self.supportedEngines.join(',') + ']');
}
if the 'indexOf' returns 0, the condition will fail (like '', null, undefined, false). So, we have to replace with the following code:
if (self.supportedEngines.indexOf(options['engine']) >= 0) {
spawnOpts.push('--engine=' + options['engine']);
} else {
grunt.log.warn('Engine ' + options['engine'] + ' not available. [' + self.supportedEngines.join(',') + ']');
}
Thank for you feedbacks
Cheers
Julien Roche
casperjs suppoers --no-colors even when running in test mode
https://github.com/n1k0/casperjs/issues/130
EDIT: this bug can only be reproduced by using 'slimerjs' as your engine option
Hey all,
I'm running into an issue where grunt reports "Done, without issues" even through my tests fail. I'm trying to set up a deployment flow where grunt wont allow you to deploy unless some casper tests pass.
Here's the test I'm using:
casper.start('http://www.google.com').then(function(){ this.test.assert(false, 'test fail'); }).run(function() { this.test.done(); });
And my grunt-casper setup:
casper: { options: { test: true, engine : 'slimerjs' }, test: { src: ['tests/_fast/00-helpers.js'] } }
And the output after running the grunt command grunt casper:test
...
FAIL test fail
type: assert
file: .../00-helpers.js
subject: false
FAIL 1 test executed in 0.69s, 0 passed, 1 failed, 0 dubious, 0 skipped.
Details for the 1 failed test:
In .../00-helpers.js
Untitled suite in .../00-helpers.js
assert: test fail
Casper Task 'casper:test' took ~1411ms to run
Done, without errors.
Any ideas or advice would be greatly appreciated - if this issue is resolved it will really help improve the workflow for my application. Thanks!
Versions:
Casper: 1.1.0-beta3
grunt-casper: 0.4.1
grunt: 0.4.5
Hey there,
I have an array of 3 paths and was wondering if there's a way to run them all in one casper test command.
Here's what my config looks like:
casper: {
options : {
test : true,
includes: 'bootstrap.js',
pre: 'login.js',
post: 'logout.js',
'fail-fast' : true
},
main: {
src: [
'tests/create',
'tests/modify',
'tests/delete'
]
}
}
Hi
I have the following configuration :
casper: {
options: {
test : true
},
files: [
'test/integration/**/ouverture.js'
]
}
When I run grunt casper
I have the following error :
"Fatal: you can't override the preconfigured casper instance in a test environment.
Docs: http://docs.casperjs.org/en/latest/testing.html#test-command-args-and-options"
Can you enable support for passing arguments for tests as CasperJS supports this?
Hello,
Using Global options and custom destination with Parallel to false make input to be an Arrray.
casper: {
options: {
test: true,
parallel : false,
concurrency : 1,
'log-level' : 'error',
'fail-fast' : false,
concise : false,
engine : 'phantomjs'
},
advancedTest: {
src: ['tests/test_*.js'],
dest : function(input) {
grunt.log.write(Array.isArray(input)); //Will log true
str = input.replace('tests/', '');
return 'tests/results/'+str.replace(/\.js$/,'phs.xml');
}
},
},
Herve-M
Setting the test attribute to true in either casper:options or within the test itself does not run the casperjs script in test mode.
Test always fails on casper reference which is supposed to be defined within capserjs itself when running in test mode.
$ grunt casper:simpletest
Running "casper:simpletest" (casper) task
ReferenceError: Can't find variable: casper
simpletest.js:6
Hint: you may want to use the `casperjs test` command.
explicitly requiring casper results in failure in finding casper.test object.
Here is my casper stanza:
casper: {
options: {
'log-level' : 'debug',
},
simpletest: {
options : {
test : true,
parallel : true,
concurrency : 1
},
src: ['simpletest.js'],
}
}
Versions:
$ phantomjs --version
1.9.6
$ casperjs --version
1.1.0-beta3
and grunt-casper version 0.2.3 on the Mac running 10.9
Is there something other than specifying "test" in the task options to have the capserjs script run in test mode?
-- Scott
Hi,
As you said, grunt-casper ignores options in test mode.
However, I try passing option to casperjs in test mode, and it seems to work well.
I need to run it with grunt, so is there any workaround or do you think about adding this possibility with your plug-in?
Is it possible to run all the tests even when one of the tests fail?
--force does not seem to work ...
... because lib/casper.js checks options.test.length if the options object has members.
As options.test is supposed to be a (optional) boolean object member this fails wheter it's set or not.
Additionally testOnlyOptions is not member of _helpers but of the parent objectt, so this has to be changed too.
fix:
line 100
line 120
Another point: you should allow to use some arguments (as --ignore-ssl-errors to be passed to phantomjs) in test mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.