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

Basic HTTP auth doesn't work with Chrome native automation #8192

Open
anthonyferroHU opened this issue May 14, 2024 · 9 comments
Open

Basic HTTP auth doesn't work with Chrome native automation #8192

anthonyferroHU opened this issue May 14, 2024 · 9 comments
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@anthonyferroHU
Copy link

anthonyferroHU commented May 14, 2024

What is your Scenario?

Tests that run with .httpAuth can't run on Chrome with native automation

What is the Current behavior?

All of my tests require basic auth to access apps in lower environments. After updating Testcafe to version 3+, these tests get stuck and hang forever because basic auth no longer works. They only run correctly when adding the --disable-native-automation flag.

What is the Expected behavior?

According to the Testcafe docs, it's expected that the NTLM protocol will not work with native automation, but there is no mention of limitations on basic http auth, therefore I expect basic auth to work with native automation.

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

no public URLs, hence the need for basic auth

What is your TestCafe test code?

.httpAuth({
username: authUsername,
password: authPwd,
});

^ basic auth username & password is set at the fixture level of all tests

Your complete configuration file

{
"src": "*-spec.js",
"concurrency": 1,
"debugOnFail": false,
"skipJsErrors": true,
"disableMultipleWindows": true,
"screenshots": {
"path": "./testscreenshots",
"takeOnFails": true,
"thumbnails": false
}
}

Your complete test report

no reports; the test hangs until I manually have to kill it

Screenshots

Screenshot 2024-05-14 at 1 52 24 PM

Steps to Reproduce

Run tests that require basic HTTP auth in Chrome 124 / Testcafe 3.6.0 with native automation enabled. Issue is same with headless and non-headless chrome.

TestCafe version

3.6.0

Node.js version

18.14

Command-line arguments

testcafe chrome -c 1 tests/path/to/test.js --skip-js-errors --skip-uncaught-errors

Browser name(s) and version(s)

Chrome 124.0.0.0

Platform(s) and version(s)

Locally on macOS Ventura 13 and also on Amazon Linux- aws/codebuild/amazonlinux2-x86_64-standard:5.0

Other

No response

@anthonyferroHU anthonyferroHU added the TYPE: bug The described behavior is considered as wrong (bug). label May 14, 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 May 14, 2024
@Bayheck Bayheck added STATE: Need simple sample A simple sample is required to examine the issue. and removed STATE: Need response An issue that requires a response or attention from the team. labels May 17, 2024
Copy link

Thank you for submitting a bug report. We would love to help you investigate the issue. Please share a simple code example that reliably reproduces the bug. For more information, read the following article: How To Create a Minimal Working Example When You Submit an Issue. We look forward to your response.

@github-actions github-actions bot added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need simple sample A simple sample is required to examine the issue. labels May 17, 2024
@anthonyferroHU
Copy link
Author

anthonyferroHU commented May 17, 2024

@Bayheck you can't try to run any test on any page that requires basic auth with the testcafe/node/chrome versions I provided?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 17, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label May 17, 2024
@Bayheck
Copy link
Collaborator

Bayheck commented May 20, 2024

Hello, I tried to emulate your usage scenario and did not encounter any issues with

httpAuth

That is why I am asking for a minimal working example.

@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 May 20, 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.

@anthonyferroHU
Copy link
Author

anthonyferroHU commented May 30, 2024

@Bayheck I found a some more info when comparing my app's basic auth with this sample page that does work with Testcafe. Sample page: https://authenticationtest.com/HTTPAuth/ (Username= user, Password= pass)

  1. The sample page returns a body, the app I'm testing does not
$ curl -s https://authenticationtest.com/HTTPAuth/ | wc -c
2933
 
$ curl -s https://my.app.io/ | wc -c
0
  1. The sample page has an uppercase header to prompt for basic auth, passes in a realm and has a response message; the app I'm testing has a lowercase header, no realm and no response message
$ curl -sI https://authenticationtest.com/HTTPAuth/ | grep uth
HTTP/1.0 401 Unauthorized
WWW-Authenticate: Basic 
realm="u=User,p=Pass"

$ curl -sI https://my.app.io/
HTTP/2 401
server: CloudFront
date: Mon, 20 May 2024 15:16:19 GMT
content-length: 0
www-authenticate: Basic

The actual basic auth headers do work the same though

$ echo -n user:pass | base64
dXNlcjpwYXNz
$ curl -Is -H "Authorization: Basic dXNlcjpwYXNz" https://authenticationtest.com/HTTPAuth/
HTTP/1.1 302 Found

$ echo -n hu-dev:c31b32 | base64
aHUtZGV2OmMzMWIzMg==
$ curl -sI -H "Authorization: Basic aHUtZGV2OmMzMWIzMg==" https://my.app.io/
HTTP/2 200

Hopefully this helps. Again, Testcafe's basic auth setting works perfectly with my app's basic auth when running with native automation disabled.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 30, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label May 30, 2024
@github-actions github-actions bot reopened this May 30, 2024
@Bayheck
Copy link
Collaborator

Bayheck commented May 31, 2024

Thank you for the information. Unfortunately, it's difficult to determine the exact cause of the issue without reproducing it. Please share a minimal working example that illustrates the issue.

@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 May 31, 2024
@anthonyferroHU
Copy link
Author

anthonyferroHU commented May 31, 2024

@Bayheck do you mind checking the Testcafe source code around native .httpAuth to see if Testcafe expects (or doesn't expect) either of the things I mentioned while I work on building an example?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 31, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label May 31, 2024
@Bayheck
Copy link
Collaborator

Bayheck commented Jun 3, 2024

Thank you for your understanding. I will get back to this issue once we have a working example. 

@Bayheck Bayheck added STATE: Need simple sample A simple sample is required to examine the issue. and removed STATE: Need response An issue that requires a response or attention from the team. labels Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

Thank you for submitting a bug report. We would love to help you investigate the issue. Please share a simple code example that reliably reproduces the bug. For more information, read the following article: How To Create a Minimal Working Example When You Submit an Issue. We look forward to your response.

@github-actions github-actions bot added the STATE: Need clarification An issue lacks information for further research. label Jun 3, 2024
@github-actions github-actions bot removed the STATE: Need simple sample A simple sample is required to examine the issue. label Jun 3, 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: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants