-
Notifications
You must be signed in to change notification settings - Fork 181
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
src/utils/url.ts parseUrl does not recognize Authentication #1990
Comments
Hello. If you use HTTP Basic or Windows (NTLM) authentication in your project, you need to use the approach described in HTTP Authentication. I tried to run the following test using the HTTP Authentication, and it was successful: import { Selector } from 'testcafe';
fixture `My Fixture`
.page `http://www.httpwatch.com/httpgallery/authentication/`;
test
.httpAuth({
username: 'httpwatch',
password: 'httpwatch123',
})
('test', async (t) => {
await t
.click(Selector('#displayImage'))
.debug();
}); |
Sorry, I fear "question" is the wrong tag for this ticket. My setup is like the following, in contrast to our internal servers, it works fine with httpbin: /* global fixture, test */
import { Role } from 'testcafe';
const userRegular = Role(
'https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fbasic-auth%2Ftest%2Fsecret',
async t => {
await t
// Do some login procedure
}
);
fixture `My Fixture`
.page `https://httpbin.org/status/200`
.httpAuth({
username: 'user',
password: 'secret',
})
test ('test', async (t) => {
await t
.useRole(userRegular)
.navigateTo(`https://httpbin.org/status/200`)
;
}); The role "userRegular" is processing a cookie based authentication and returns a redirect. This works fine on a development machine. On our integration server called "preview", there is an HTTP authentication. If I login into the app with the cookie authentication combined with HTTP authentication, I get a response with a location header looking like this: I do not know, if hammerhead, a used application library or our load balancer is responsible for the URL with the credentials, but the test fails with the described DNS failure message. Since authentication in an URL is a common pattern, it would be nice if hammerhead would support it. And the source code looks like it would be no big change, since the returned type has already a username/password property. As a side effect, configuration between different test servers with and without http authentication would be easier to configure. So I would be grateful, if this ticket receives at least a "feature request". |
Thank you for the additional details. |
…ress#1990)" This reverts commit c7d89fb.
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow. |
The method parseUrl does not recognize the authentication part in an URL like https://test:[email protected]/test/
As result, a
parsed.host = "test:[email protected]"
is returned resulting in a DNS failure using testcafe.Expected would be a type ParsedUrl
I found this error when I used testcafes user roles with http authentication in combination. The role initializer gets an URL with the authentication part. This outputs the
cantResolveUrl
message:Hopefully this testcafe-hammerhead repo is the right place to fix this issue. If not, I would open an issue in the testcafe repo with a more generalized error report.
The text was updated successfully, but these errors were encountered: