Closed onlynone closed 5 months ago
And just for reference, if you run the exact same code, but with a local browser not through saucelabs with: yarn testcafe chrome tests/index-test.js --app "node server.js" --hostname=localhost
it succeeds.
Hi @onlynone
Could you please share the server.js
file?
@miherlosev The PR was a clone of testcafe-example-running-tests-using-travis-and-saucelabs so it is using the stock server.js from that project, a copy of which can be found here: https://github.com/onlynone/testcafe-example-running-tests-using-travis-and-saucelabs/blob/secure_apis/server.js
Hi, @onlynone and @NeoPhi Thank you for the shared information. I've reproduced the issue.
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.
What is your Scenario?
I'd like to test a site that uses secure browser APIs like
SubtleCrypto
with testcafe in saucelabs.What is the Current behavior?
I'm able to use the
--hosname=localhost
option as suggested here: https://testcafe.io/documentation/402839/guides/advanced-guides/test-https-features-and-http2-websites#test-https-websites in order for the browser to allow secure javascript APIs when running testcafe with local browsers. But there doesn't appear to be any way to do this when running inside saucelabs. It looks like the IP address used for the testcafe reverse-proxy in saucelabs isn't 127.0.0.1, so the--hostname=localhost
trick doesn't work.What is the Expected behavior?
There should be some way to test sites that use secure javascript APIs with testcafe and saucelabs, either through the
--hostname=localhost
or other options.What is your public website URL? (or attach your complete example)
I wasn't sure where to create a PR/issue because it looks like the
examples/running-tests-using-travis-and-saucelabs
directory was extracted from thetestcafe
repo to create thetestcafe-example-running-tests-using-travis-and-saucelabs
repo. I created a branch/PR of that repo that demonstrates it failing:https://github.com/DevExpress/testcafe-example-running-tests-using-travis-and-saucelabs/pull/1
The actual html being tested is:
What is your TestCafe test code?
It's also in the referenced PR, but this is it:
Your complete configuration file
N/A
Your complete test report
When run without
--hostname=localhost
:When run with
--hostname=localhost
:Screenshots
No response
Steps to Reproduce
testcafe-example-running-tests-using-travis-and-saucelabs
repo referenced in the PR mentioned aboveyarn test
yarn test --hostname=localhost
TestCafe version
1.20.1
Node.js version
v14.15.4
Command-line arguments
testcafe "saucelabs:Chrome@beta:Windows 10" tests/index-test.js --app "node server.js" [--hostname=localhost]
Browser name(s) and version(s)
chrome=105.0.5195.52
Platform(s) and version(s)
Windows 10
Other
No response