使用HTTPS和remoteConnection选项

问题描述 投票:3回答:1

使用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();
         });
      });
  });
automated-tests e2e-testing testcafe
1个回答
1
投票

由于连接是远程的,因此TestCafe不负责启动浏览器。因此,您需要传递--allow-insecure-localhost参数 - 只需使用标志启动浏览器并连接到远程URL。

© www.soinside.com 2019 - 2024. All rights reserved.