使用remoteConnection选项时是否可以传递--allow-insecure-localhost
标志?
我的应用程序需要通过HTTPS,使用openssl-self-signed-certificate
时效果不佳。
const createTestCafe = require('testcafe');
let runner = null;
let testcafe = null;
const selfSignedSertificate = require('openssl-self-signed-certificate');
const sslOptions = {
key: selfSignedSertificate.key,
cert: selfSignedSertificate.cert
};
createTestCafe('localhost', 1337, 1338, sslOptions)
.then(tc => {
testcafe = tc;
runner = tc.createRunner();
return tc.createBrowserConnection();
})
.then(remoteConnection => {
/* ... */
// Outputs remoteConnection.url so that it can be visited from the . remote browser.
console.log(remoteConnection.url);
remoteConnection.once('ready', () => {
runner
.src('e2e/tests/group/')
.browsers(remoteConnection)
.run()
.then(failedCount => {
console.log(failedCount);
testcafe.close();
});
});
});
由于连接是远程的,因此TestCafe不负责启动浏览器。因此,您需要传递--allow-insecure-localhost
参数 - 只需使用标志启动浏览器并连接到远程URL。