Skip to content

No working workaround for : Native Automation requires https protocol #8330

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

Closed
wombatka opened this issue Oct 31, 2024 · 16 comments
Closed

No working workaround for : Native Automation requires https protocol #8330

wombatka opened this issue Oct 31, 2024 · 16 comments
Labels
HAS WORKAROUND STATE: Issue accepted An issue has been reproduced. STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@wombatka
Copy link

What is your Scenario?

I cannot run my tests over http using native automation and chrome 130,
I tried using workaround from: #8133
The url seems to be loaded via http but it is not which can be seen in the browser console
image

What is the Current behavior?

automatic redirect to https occurs and page is not loaded

What is the Expected behavior?

page should be loaded via http

What is the public URL of the test page? (attach your complete example)

example.js:

import {Selector, t} from "testcafe";

fixture('MWE')
test('Website served only by HTTP is tried to be opened with HTTPS', async () => {
await t.navigateTo('http://www.testingmcafeesites.com/')
await t.debug()
})

What is your TestCafe test code?

example.js:

import {Selector, t} from "testcafe";

fixture('MWE')
test('Website served only by HTTP is tried to be opened with HTTPS', async () => {
await t.navigateTo('http://www.testingmcafeesites.com/')
await t.debug()
})

package.json

{
"name": "testcafeexample",
"version": "1.0.0",
"description": "",
"main": "example.js",
"scripts": {
"test": "testcafe chrome example.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"testcafe": "3.7.0-rc.2"

}
}

customRequestHook.js

const RequestHook = require('testcafe').RequestHook
class CustomRequestHook extends RequestHook {
constructor (requestFilterRules) {
super(requestFilterRules);
}

onRequest(e) {
    console.log("Changing protocol")
    e.requestOptions.protocol = 'http:';
}

.testcaferc.cjs

let CustomRequestHook = require('./customRequestHook.js').CustomRequestHook
const hook = new CustomRequestHook(/https?://.*/);
module.exports = {
hooks: {
request: hook
},
skipJsErrors : true
}

onResponse(e) {
}

}

module.exports = {
CustomRequestHook
}

Your complete configuration file

let CustomRequestHook = require('./customRequestHook.js').CustomRequestHook
const hook = new CustomRequestHook(/https?://.*/);
module.exports = {
hooks: {
request: hook
},
skipJsErrors : true
}

Your complete test report

No response

Screenshots

image

Steps to Reproduce

1.run test
2.open browser console
3.you will see that requet was sent with https not http

TestCafe version

3.7.0-rc.2

Node.js version

21.7.1

Command-line arguments

npm test

Browser name(s) and version(s)

chrome 130

Platform(s) and version(s)

Ubuntu 22.04.2 LTS

Other

No response

@wombatka wombatka added the TYPE: bug The described behavior is considered as wrong (bug). label Oct 31, 2024
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Oct 31, 2024
@wombatka
Copy link
Author

you can see in network console that origin is set to url with https, despite custom hook i used
image

@Bayheck Bayheck added STATE: Issue accepted An issue has been reproduced. and removed STATE: Need response An issue that requires a response or attention from the team. labels Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

@wombatka
Copy link
Author

wombatka commented Jan 7, 2025

Any updates here? We cannot update chrome because of this issue..

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 7, 2025
@aleks-pro
Copy link
Contributor

Hello @wombatka ,

We are researching the issue. We will update this thread once we have news.

@testcafe-need-response-bot testcafe-need-response-bot bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jan 9, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Jan 13, 2025

Hello,

I researched the issue further, and here is what I found.

For some reason, the HTTP request event fails to arrive quickly enough to execute the customHook onRequest method. To address this, I introduced a delay before changing the protocol, and everything now works as expected.

You can verify the origin of the page in the DevTools console by checking either window.location.origin or window.location.protocol.

This is the updated workaround for your case:

async onRequest(e) {    
    await new Promise(resolve => setTimeout(resolve, 5000)); //you can increase this value if issue persists.

    e.requestOptions.protocol = 'http:';
}

Please try this solution and let us know your results.

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 13, 2025
@Bayheck Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Jan 13, 2025
@wombatka
Copy link
Author

Hi. I checked - introducing a delay of minimum 1s works for me. however delay on each request makes the whole test run ( we have over 1500 tests) significanlty slower

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 14, 2025
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label Jan 14, 2025
@wombatka
Copy link
Author

Additionally download files does not work over http- chrome shows insecure download warning and there is no way to switch it off (previously working flags were removed)

@Bayheck
Copy link
Collaborator

Bayheck commented Jan 14, 2025

Additionally download files does not work over http- chrome shows insecure download warning

Hello, could you please share an example of this behavior so we can reproduce it on our side?

@Bayheck Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Jan 14, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Jan 16, 2025

Hello, I have found a flag that seems to cause the issue.

Try to run your tests with the following command:

testcafe "chrome --disable-features=HttpsUpgrades" test.js

With this feature disabled, you do not need the custom hook workaround.

Please try running your test with this flag and let us know your results.

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 16, 2025
@wombatka
Copy link
Author

Hi. This flag works without a custom hook for me , thank's!
I also found a solution for the download confirm dialog that shows when you download from an http domain:
--unsafely-treat-insecure-origin-as-secure=yourDomain
There used to be a feature flag to disable the warning dialog- --disable-features=InsecureDownloadWarnings but in Chrome 130 it is removed

@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label Jan 16, 2025
@wombatka
Copy link
Author

wombatka commented Jan 16, 2025

Additionally download files does not work over http- chrome shows insecure download warning

Hello, could you please share an example of this behavior so we can reproduce it on our side?

Unfortunatelly i cannot share a link to our test installation as it is our internal network. I am not sure whether you can find an example domain to reproduce it- this issue occurs when you click some action that downloads a file from a http domain other than localhost on chrome 130.
Instead of downloading a file automaticaly- unconfirmed download dialog appears, asking if you want to keep the file or not
In older chrome you could swith this dialog off now you cannot

@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label Jan 20, 2025
@EmilIfrim
Copy link

EmilIfrim commented Apr 22, 2025

Seems that chrome --disable-features=HttpsUpgrades has been removed. Is there a workaround for this?

https://superuser.com/questions/1836968/google-chrome-has-now-removed-the-https-upgrades-flag-how-do-you-prevent-http

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Apr 22, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Apr 24, 2025

Hello,

I did not manage to reproduce the issue with this workaround.

Could you please confirm that you are able to reproduce the issue with "--disable-features=HttpsUpgrades"?

@Bayheck Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Apr 24, 2025
@EmilIfrim
Copy link

Sorry, my bad. i cannot repoduce it either, but I was expectingto see this flag under :

  1. chrome://flags/
  2. https://peter.sh/experiments/chromium-command-line-switches/

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Apr 24, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Apr 28, 2025

Hello,
While the flag is not listed, it must exist internally. Otherwise, the workaround won't work.
Please open a separate ticket if any issues arise with HTTP.

@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label Apr 28, 2025
Copy link

github-actions bot commented May 4, 2025

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

@github-actions github-actions bot closed this as completed May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HAS WORKAROUND STATE: Issue accepted An issue has been reproduced. STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

4 participants