I need to test my script at different viewport sizes. In my tests I'd like to change the viewport size of PhantomJS by setting page.viewportSize. I'm running my tests through grunt-contrib-qunit and PhantomJS isn't accessible in my test code. Is there a way to gain access to it?
Setting PhantomJS viewportSize in QUnit test
Asked Answered
I didn't catch this question when I was writing mine, but I realise we're after the same thing... (in case I get an answer and you found nothing): #17467824 –
Velate
It's not possible now on the dist version.
grunt-contrib-qunit depends on grunt-lib-phantomjs, which don't allow this feature. But, an interesting commit (6 days ago) from bdowling on github is available. For sure, this will help you.
You can get this commit by yourself end edit the qunit task to try it.
Patience, my young Padawan. Patience!
It's possible to do this now. Here's what my Gruntfile.js
looks like:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
qunit: {
src: ['tests/test.html'],
options: {
page : {
viewportSize : { width: 1280, height: 800 }
}
}
},
});
I can't find this documented anywhere, but it works! Thanks. –
Teshatesla
© 2022 - 2024 — McMap. All rights reserved.