Использование HTTPS с опцией remoteConnection - PullRequest
3 голосов
/ 18 марта 2019

Возможно ли передать флаг --allow-insecure-localhost при использовании опции remoteConnection?

Мое приложение должно работать по протоколу 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();
         });
      });
  });

1 Ответ

1 голос
/ 19 марта 2019

Поскольку подключение удаленное, TestCafe не несет ответственности за запуск браузеров.Поэтому вам нужно передать аргумент --allow-insecure-localhost - просто запустите браузер с флагом и подключитесь к удаленному URL.

...