ronaldlokers / grunt-casperjs Goto Github PK
View Code? Open in Web Editor NEWGrunt task for casperjs
License: MIT License
Grunt task for casperjs
License: MIT License
I am having a issue that I cannot use other name for the tasks in my grunt file to execute. So, it means I cannot have multiple casperjs tasks in grunt file.
I want to have two casperjs tasks in my grunt file first task can login into the backend system and second task will perform remaining tasks. Reason for not using --pre option of casper because my tasks are dependent on command line argruments.
I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.
If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.
If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8"
as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0"
to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.
Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.
Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!
If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.
Thanks, we really appreciate your work!
I keep getting this error, i have phantomjs installed globally and locally for other tasks (karma/grunticon ect.) All of those seem to boot up phantom just fine but casperjs gives me the error
Running "casperjs:local" (casperjs) task
Verifying property casperjs.local exists in config...OK
Files: _Test/casperjs/index.js
Options: casperjsOptions=[]
Command: C:\Users\mmellor\Desktop\preprocess\node_modules\grunt-casperjs\node_modules\.bin\casperjs.cmd
Running tests from "_Test/casperjs/index.js":
Fatal: [Errno 2] No such file or directory; did you install phantomjs?
Here's my config
casperjs: {
options: {
casperjsOptions: [
]
},
local: {
src: ['_Test/casperjs/*.js']
}
}
If i run phantomjs -v from the same location it finds it
$ phantomjs -v
2.1.1
Any idea?
Since i updated to npm 2.0 i got this error when running npm install
.
So wouldn't it be better to point to a specific beta (1.1.0-beta3) or to the last stable version (1.0.4)
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.32
npm ERR! npm v2.0.0
npm ERR! code ETARGET
npm ERR! notarget No compatible version found: casperjs@'>=1.1.0 <1.2.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["1.1.0-beta2","1.1.0-beta3"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
I'm getting an error when running npm install grunt-casperjs
. That command outputs this error:
I am able to install other npm packages without error. Please see the log output below. I truncated to the end with the error as github has character limit.
1967 info install [email protected]
1968 verbose unsafe-perm in lifecycle true
1969 info [email protected] Failed to exec install script
1970 info c:\Users\kylee\dev\ZentiCasperTests\node_modules\grunt-casperjs unbuild
1971 info preuninstall [email protected]
1972 info uninstall [email protected]
1973 verbose true,c:\Users\kylee\dev\ZentiCasperTests\node_modules,c:\Users\kylee\dev\ZentiCasperTests\node_modules unbuild [email protected]
1974 info postuninstall [email protected]
1975 error [email protected] install: `node install.js`
1975 error Exit status 8
1976 error Failed at the [email protected] install script.
1976 error This is most likely a problem with the grunt-casperjs package,
1976 error not with npm itself.
1976 error Tell the author that this fails on your system:
1976 error node install.js
1976 error You can get their info via:
1976 error npm owner ls grunt-casperjs
1976 error There is likely additional logging output above.
1977 error System Windows_NT 6.2.9200
1978 error command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-casperjs" "--save"
1979 error cwd c:\Users\kylee\dev\ZentiCasperTests
1980 error node -v v0.10.22
1981 error npm -v 1.3.14
1982 error code ELIFECYCLE
1983 verbose exit [ 1, true ]
The change to isCasperInstalled function in dade238 does not work on Windows.
So i have npm'd the file into a current project
ls -l
casperjs -> /export/home/matthew/ourptojectname/web-client/node_modules/grunt-casperjs/lib/casperjs/casperjs-master/bin/casperjs
the problem is when i put it in our own git project (so that way other people on the team could use it) they're all pointing to matthew (me)
What is the proper way to use grunt with the casperJS xunit option?
http://docs.casperjs.org/en/latest/testing.html#xunit-report
I need Grunt to vary the xunit filename per test run, otherwise it will overwrite the xml file each time.
Right now, I am running casperjs using gruntjs and grunt-casperjs. Now I need to passed arguments to the grunt task for further processing. Is there a way to handle this work?
When using the async option, it would be great for the --pre
and --post
test options to be executed just once, instead of once for each test. I'm not sure how simple this would be to implement though.
Previously I used grunt-casperjs v1.0.6 and everything worked alright, but now it chokes (tried v1.0.9 and v1.0.10) when there are spaces in the path, e.g.:
If my project's in /Users/creynders/Projects/casperjs test
running the task results in:
Running "casperjs:e2e" (casperjs) task
Command: /Users/creynders/Projects/casperjs test/node_modules/grunt-casperjs/casperjs test test/fiware-ut-01.js
Running tests from "test/e2e-01.js":
Warning: Command failed: /bin/sh: /Users/creynders/Projects/casperjs: No such file or directory
If I'm not mistaken previously the called command was simply
casperjs test test/fiware-ut-01.js
which is why it didn't error out.
Grunt-CasperJS runs successfully, but I see a misleading error claiming CasperJS could not be found:
Running "casperjs:casperjs" (casperjs) task
>> CasperJS not found
Command: <project>/node_modules/grunt-casperjs/node_modules/.bin/casperjs
Running tests from ...
In reality, Grunt-CasperJS searched for CasperJS in several places and eventually found it.
The offending source:
var command = "./node_modules/.bin/casperjs";
if (!fs.existsSync(command)) {
grunt.log.error("CasperJS not found");
command = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'casperjs');
if (!fs.existsSync(command)) {
grunt.log.error("CasperJS not found");
command = path.join(__dirname, '..', '..', '..', 'casperjs', 'bin', 'casperjs');
}
}
From
grunt-casperjs/tasks/lib/casperjs.js
Line 9 in 1af7aba
When I install the grunt-casperjs, it gives me an error show: Error: EPERM, operation not permitted. I google a lot and cannot find the solution. Does anyone can give me some suggestion? Thanks
1816f15 introduces a change that causes env variables to disappear from system.env
array
Using on Windows, v2.2.0, node v5.5.0.
Running "casperjs:local" (casperjs) task
Command: ./node_modules/.bin/casperjs.cmd
Running tests from "_Test/casperjs/index.js":
Done, without errors.
mmellor@mmellor2-w7 MINGW64 ~/Desktop/Sites/portfolio (development)
$ Test file: _Test/casperjs/index.js
# Testing index
PASS Testing index (NaN test)
FAIL HTTP status code is: 200
# type: assertHttpStatus
# file: _Test/casperjs/index.js
# subject: false
# current: null
# expected: 200
PASS All resources found
FAIL 2 tests executed in 2.421s, 1 passed, 1 failed, 0 dubious, 0 skipped.
This is my test file which does execute but after grunt has ended so the servers closed so it fails.
casper.test.begin('Testing index', function suite(test) {
require('./modules/include.js')(test);
casper.start(url + 'index.html', function(){
test.assertHttpStatus(200);
});
casper.then(function() {
checkAllResourcesFound();
});
casper.run(function () {
test.done();
});
});
If you have a single target that runs multiple src files, and specifies an xunit path. The xunit file will be overwritten by each subsequent file that is run.
Thanks for putting this task together.
Do you plan on implementing support for the CasperJS command line options? Specifically, the --includes, --pre and --post would be very helpful if we could set them from the gruntjs config file.
registerHelpers will be deprecated in grunt 0.4.
To see how helpers will be handled in the future (using standard npm require), check out the following links:
https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/uglify.js#L15
https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/lib/min.js
Hi,
Great plugin! I was wondering how I would add "--ignore-ssl-errors=yes" as an option?
Thanks!
When installing the plugin (npm install grunt-casperjs --save-dev), I keep getting the following error, can you please advise?
npm WARN enoent ENOENT: no such file or directory, open '/Users/robin/project/node_modules/casperjs/package.json'
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "grunt-casperjs" "--save-dev"
npm ERR! node v4.2.6
npm ERR! npm v3.7.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
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 phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs phantomjs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
Detailed log of the build can be found at https://travis-ci.org/oaeproject/3akai-ux/builds/12561492
Reverting to grunt-casperjs 1.1.1 is a temporary fix until this gets patched.
I get an error when installing via NPM.
Error is:
/Users/blah/somefolder/node_modules/grunt-casperjs/node_modules/adm-zip/zipFile.js:66
throw Utils.Errors.INVALID_FORMAT;
^
Invalid or unsupported zip format. No END header found
npm ERR! [email protected] install: node install.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the grunt-casperjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls grunt-casperjs
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/blah/somefolder
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/blah/somefolder/npm-debug.log
npm ERR! not ok code 0
Here is the section from my gruntFile:
casperjs: {
options: {
async: {
parallel: false,
},
username: "myuser",
},
files: ['test/casper/**/test-casper*.js']
}
its correctly calling the right files, but username is not being passed via casper.cli.options
if i do a casperjs --username=whatever, i do get it via casper.cli.options.username
Any suggestions?
When I tried installing the newer version of grunt-casperjs (1.4.0) using npm, I get the below error:
Casperjs not installed. Installing.
Receiving 0K...
/Users/peter/Sites/node_modules/grunt-casperjs/node_modules/adm-zip/zipFile.js:66
throw Utils.Errors.INVALID_FORMAT;
^
Invalid or unsupported zip format. No END header found
...
In my package file I have:
"dependencies": {
...
"grunt-casperjs": "~1.4.0",
...
}
So nothing fancy. Any ideas?
I have a commit I want to push up that adds some extra functionality around defining pre/post hooks for setup and cleanup as well as a command line arg feature that allows specific test runs. Are pull requests still reviewed and accepted?
Hi everyone,
the contrib is awesome in the execution and very quick in use, but i found one issue with this:
In mi Gruntfile.js works good only or slimerjs or phatomjs (really normal):
casperjs: {
options: {
casperjsOptions: [ '--engine=slimerjs' ]
},
files: ['./test/atdd/**/*.js']
}
but my idea is for this:
casperjs: {
phatomjs:{
options: {
casperjsOptions: [ '--engine=phantomjs' ]
},
files: ['test/atdd/modules/*.js']
},
slimerjs:{
options: {
casperjsOptions: [ '--engine=slimerjs' ]
},
files: ['./test/atdd/**/*.js']
}
}
I tried but dont work :(
I'm getting
Fatal error: spawn ENOENTerror when running on windows.
I think the executable bat/exe file not found by node.
Getting the error EPERM, operation not permitted 'C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard\node_modul
es\grunt-casperjs\casperjs' from symlinking the casperjs executables.
PhantomJS is already installed at C:\Users\jcressatti\AppData\Roaming\npm\phantomjs.CMD.
> [email protected] install C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard\node_modules\grunt
-casperjs
> node install.js
Casperjs version 1.1.0-beta3 installed at C:/Users/jcressatti/Desktop/Energy_Dashboard/Energy_DashBoard/node_mo
dules/casperjs
fs.js:730
return binding.symlink(preprocessSymlinkDestination(destination, type),
^
Error: EPERM, operation not permitted 'C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard\node_modul
es\grunt-casperjs\casperjs'
at Object.fs.symlinkSync (fs.js:730:18)
at C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard\node_modules\grunt-casperjs\install.js:33:
20
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the grunt-casperjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls grunt-casperjs
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\np
m-cli.js" "install"
npm ERR! cwd C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\jcressatti\Desktop\Energy_Dashboard\Energy_DashBoard\npm-debug.log
npm ERR! not ok code 0
Hi, I would like to launch casper test file from grunt. I have create a config file (config.js) with all my var, if I launch this command in shell it works fine:
casperjs test app/Test/Frontend/casper/**/*.js --includes=app/Test/Frontend/config.js
but if I use grunt-casperjs inside my gruntfile return me this error:
execvp(): No such file or directory
Fatal error: spawn ENOENT
This is my task in grunt:
casperjs: {
options: {
casperjsOptions: ['--includes=app/Test/Frontend/config.js']
},
files: [
'app/Test/Frontend/casper/**/*.js'
]
},
how can I solve?
The recommended version of casper right now is 1.1.0-DEV, but install.js installs the 1.0.3 version upon installation. This causes all sorts of problems for casper code that is written to work with Casper 1.1.0+. For instance, my code. :)
I have 1.1.0-DEV installed locally, and my tests run correctly when I run them from the command line with casperjs test ./test.js
, but when I run the same test.js through grunt-casperjs, I get an error around require
calls, which I believe is caused by lack of support in older versions of Casper.
I highly recommend updating install.js to install 1.1.0 instead of 1.0.3, or at least checking for an existing casperjs installation before installing an outdated version.
I want to use jquery in casperjs and I am using grunt to pass command line arguments using casperjsOptions: ['--foo=bar', '--no-colors']. But when I try to pass the jquery url it donot recognise "$" in the casper script.
It's unclear to me why grunt-casper needs to download a zip from github.com to install casperjs. Can't this be achieved through npm's regular dependency system and the call to npm install
? Why wouldn't casperjs be specified as another dependency like all others?
Thanks!
Im running grunt-casperjs on Jenkins, here we already have an installed version of phantomjs, and we are setting the PHANTOMJS_EXECUTABLE enviroment variable before starting grunt-casperjs.
Please implement either configuration options for this, or add a check if PHANTOMJS_EXECUTABLE is undefined before setting it.
Line 30 ish in tasks/lib/casperjs.js
Thanks.
Especially the 2nd instruction: "Call grunt.loadNpmTasks('grunt-casperjs') in your gruntfile"
Please have a link to a demo grunt file.
Thanks
When a Casper test fails, I believe the Grunt task should fail and thus block further execution of other tasks and let Grunt return a non-zero status code.
Currently this is not the case, but I have been able to achieve this effect with a simple patch. In the file lib/casperjs.js I replaced the puts function with the following version:
function puts(error, stdout, stderr) {
grunt.log.write('\nRunning tests from "' + filepath + '":\n');
grunt.log.write(stdout);
if ( error !== null ) {
callback(error);
} else {
if (stdout.indexOf("FAIL") > -1) {
callback("Tests failed");
} else {
callback();
}
}
}
I'm not sure if this is really the best way to go about this, but please consider including this or a similar patch.
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.