DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 672 forks source link

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

Open wombatka opened 6 days ago

wombatka commented 6 days ago

What is your Scenario?

I cannot run my tests over http using native automation and chrome 130, I tried using workaround from: https://github.com/DevExpress/testcafe/issues/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 commented 6 days ago

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

github-actions[bot] commented 1 day ago

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.