Skip to content
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

Native Automation requires https protocol #8133

Closed
czarekeltonjohn opened this issue Jan 30, 2024 · 8 comments
Closed

Native Automation requires https protocol #8133

czarekeltonjohn opened this issue Jan 30, 2024 · 8 comments
Assignees
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: enhancement The accepted proposal for future implementation.

Comments

@czarekeltonjohn
Copy link

What is your Scenario?

We have web applications deployed on internal k8s cluster available by http protocol. Is there any configuration or flag that will allow testcafe v.3.5.0 with native automation enabled to reach such web app using http protocol. We can omit ssl certificate errors using chrome flag, but it seems testcafe is allowing only https (which in my case is always unreachable). Even if I explicetely set page as "http://" in testcafe browser it is "https://"

What are you suggesting?

Configuration change or flag that will allow native automation using http protocol

What alternatives have you considered?

No response

Additional context

No response

@czarekeltonjohn czarekeltonjohn added the TYPE: enhancement The accepted proposal for future implementation. label Jan 30, 2024
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 30, 2024
@PavelMor25
Copy link
Collaborator

Hello @czarekeltonjohn,

TestCafe allows you to open HTTPS and HTTP/2 websites in Native Automation mode out of the box. Please share a minimal working example so that the TestCafe team can research the issue and help you.

@PavelMor25 PavelMor25 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 Feb 5, 2024
@czarekeltonjohn
Copy link
Author

czarekeltonjohn commented Feb 6, 2024

Hi, let me share with you with my minimal working example.

.testcaferc configured to ignore ssl errors and enable native automation for sure

{
  "browsers": "chrome --ignore-certificate-errors",
  "disableNativeAutomation": false
}

test.ts with test of navigating to website served only by http, site cannot be opened because testcafe browser tries to open it by https

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()
})
image

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Feb 6, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label Feb 6, 2024
@PavelMor25 PavelMor25 added the STATE: Issue accepted An issue has been reproduced. label Feb 9, 2024
Copy link

github-actions bot commented Feb 9, 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.

@github-actions github-actions bot removed STATE: Need response An issue that requires a response or attention from the team. STATE: Issue accepted An issue has been reproduced. labels Feb 9, 2024
@PavelMor25 PavelMor25 self-assigned this Mar 5, 2024
@PavelMor25
Copy link
Collaborator

Hello @czarekeltonjohn,

We have investigated this issue and found a workaround for it. Since requests in Chrome are automatically upgraded to HTTPS in Native automation, you can create a custom request hook that will intercept request and change the protocol back to HTTP. Then, you can either define it globally in the configuration file or use it at the fixture or test level.

customRequestHookFile.js:

import { RequestHook } from 'testcafe';
 
export default class CustomRequestHook extends RequestHook {
    constructor (requestFilterRules) {
        super(requestFilterRules);
    }

    onRequest(e) {
        e.requestOptions.protocol = 'http:';
    }

    onResponse(e) {
    }
}

configuration file:

import CustomRequestHook from './hook.js'

const hook = new CustomRequestHook(/https?:\/\/www.testingmcafeesites.com/)

module.exports = {
    hooks: {
        request: hook
    }
}

Please let us know your results.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 12, 2024
@PavelMor25 PavelMor25 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 Mar 12, 2024
Copy link

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.

@wombatka
Copy link

wombatka commented Oct 31, 2024

I have the same issue- tried using you workaround but it does not work fully- my url is opened via http - which is ok, but after i login to the application ( I am using Roles) - nothing is loaded- please provide a working workaround. It is critical for me - currenrly all our tests are failing
In console I can see:
image
But the page was loaded via http so something is not ok here

@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
@PavelMor25
Copy link
Collaborator

Hello @wombatka,

Could you please create a separate ticket for the issue and share a minimal working example? This will help the TestCafe team investigate the issue in greater detail.

@PavelMor25 PavelMor25 removed the STATE: Need response An issue that requires a response or attention from the team. label Oct 31, 2024
@wombatka
Copy link

Hello @wombatka,

Could you please create a separate ticket for the issue and share a minimal working example? This will help the TestCafe team investigate the issue in greater detail.

created new issue: #8330

@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
@PavelMor25 PavelMor25 removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: enhancement The accepted proposal for future implementation.
Projects
None yet
Development

No branches or pull requests

3 participants