doron
doron

Reputation: 1538

Using HTTPS with remoteConnection option

Is it possible to pass the --allow-insecure-localhost flag when using the remoteConnection option?

My app needs to be over HTTPS and when using openssl-self-signed-certificate it doesn't work well.

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();
         });
      });
  });

Upvotes: 3

Views: 156

Answers (1)

Alex Kamaev
Alex Kamaev

Reputation: 6318

Since the connection is remote, TestCafe is not responsible for starting browsers. So you need to pass the --allow-insecure-localhost argument - just start the browser with the flag and connect to a remote url.

See also: Start a Browser With Arguments

Upvotes: 1

Related Questions