Skip to content

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

Closed
@wombatka

Description

@wombatka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions