-
Notifications
You must be signed in to change notification settings - Fork 669
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run testcafe with https protocol #1985
Comments
Hello @edoardocavazza! It's a useful feature, because some browser API's (e.g. Apple Pay) are available only on HTTPS pages, and TestCafe HTTP end-point prevents access to them. Right now, you can configure stunnel to encrypt traffic from TestCafe to browser. You can check "TLS front-end to a web server" on https://www.stunnel.org/config_windows.html for an example configuration. |
Requires Safari on macOS or iOS.
|
Reproduced in Safari 11.0.2. InvalidAccessError (DOM Exception 15): Trying to call an ApplePaySession API from an insecure document. |
+1 |
+1 We use |
+1 I'm really struggling with the value of an end-to-end testing framework that doesn't support https. This essentially limits it to running on localhost, which is not end-to-end. |
@AndreyBelym, could you please review the pull requests and help me with tests and documentation. Thank you. #2359 This changes works properly for me. Tests and documentation are needed to be designed. |
Hi @intermike, thanks for contributing. Let's focus first on |
According strange expressionconst originalProtocol = opts && opts.proxyProtocol || location['proto' + 'col'];
About tests.I actually do not know how to design tests in this case. I don't mean easy checks (like https,wss protocols in all urls). |
I'm not sure I 100% understand this issue, or the proposed changes. Will these changes allow TestCafe to run locally against a remote https endpoint? This use case was the one I was struggling with: to enable smoke testing from our build server against our Integration and UAT environments. Thanks for the progress. |
Hi @AndreyBelym Lint error/testcafe-hammerhead/src/client/utils/url.js Lint ruleRule is described in https://github.com/LavrovArtem/eslint-plugin-hammerhead/blob/master/lib/index.js Please advise what should I do with |
@awithy, what do you mean by
You can test websites served over HTTPS as easy as websites served over HTTP, since our proxy accepts both HTTPS and HTTP as input. However all websites regardless their original protocol are served over HTTP in testing session, because our proxy supports only HTTP output. The proposed changes enable HTTPS output for proxy, so connection during testsing session will be encrypted. |
@intermike, I think it's ok to disable this check here with
|
@AndreyBelym Thanks for the guide. Pushed into PR. |
It's time to discuss API, because //Programming Interface
createTestCafe (hostname, port1, port2, sslOptions)
sslOptions.key - <Buffer> - private key in PEM format
sslOptions.cert - <Buffer> - cert in PEM format
//Command line
testcafe chrome my-tests --ssl-key test/key/agent2-key.pem --ssl-cert test/key/agent2-cert.pem
--ssl-key - <string> path to key file
--ssl-cert - <string> path to cert file |
I believe |
Nodejs api is polymorphically for this option. It takes In my opinion, const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, (req, res) => {
res.writeHead(200);
res.end('hello world\n');
}).listen(8000); |
@miherlosev createTestCafe('localhost', 1337, 1338) // We need to pass certificates here
.then(tc => {
testcafe = tc;
const runner = testcafe.createRunner(); // But runner is created only here
return runner
.src(['tests/fixture1.js', 'tests/func/fixture3.js'])
.browsers(['chrome', 'safari'])
.run();
})
.then(failedCount => {
console.log('Tests failed: ' + failedCount);
testcafe.close();
}); |
ping @AndreyBelym |
Yes you are right. |
We already have such options syntax for browser providers' options.
|
After discussing with @AndreyBelym, we introduce the following API: Programming interface createTestCafe (hostname, port1, port2, sslOptions)
Command-line interface testcafe --ssl pfx=path/to/some.pfx;rejectUnauthorized=true;...
For the @kirovboris Take a look please |
Hi @intermike We've updated the See an API description in #1985 (comment). |
Affirmative, @miherlosev. |
Working on docs |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow. |
…1985) (DevExpress#2540) * implement a possibility to run TestCafe over https * update text * update option description * fix review issues
Are you requesting a feature or reporting a bug?
Requesting a feature (maybe)
What is the current behavior?
I am unable to start testcafe using https protocol
What is the expected behavior?
Testcafe should run with ssl certificate (if provided)
Specify your
The text was updated successfully, but these errors were encountered: