[英]How to set CasperJS page options from within a test in test environment?
我使用test
命令以及--ssl-protocol=any
和--ignore-ssl-errors=true
標志運行大多數CasperJS測試。
如果它們在測試環境中,是否可以將這兩個標志添加到測試本身中? 我知道,如果您使用casper模塊(如var casper = require('casper').create({
,則可以設置頁面選項,但這不是我的測試設置方式。
我也知道你可以做類似的事情
casper.options.verbose = true;
casper.options.logLevel = "debug";
...但是casper.options.ignoreSslProtocol=true
似乎不起作用。
這是我的登錄測試的一部分-
var config = require('../../config'),
x = require('casper').selectXPath;
casper.test.comment('basic login test!');
casper.start(config.base_url);
casper.test.begin('test basic login functionality', function (test) {
casper.then(function() {
this.click('.js-flip_box');
test.info('logging in');
this.fill('#login_form', {
'email': config.email,
'password': config.password
}, true);
});
casper.then(function () {
test.assertVisible ('.home_bar', 'nav bar visible');
});
casper.run(function() {
test.done();
});
});
...我使用casperjs --ssl-protocol=any --ignore-ssl-errors=true test login.js
運行casperjs --ssl-protocol=any --ignore-ssl-errors=true test login.js
(滿口)
我注定了嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.