3

I am running testcafe tests on an authentication page and I can see that testcafe is modifying/removing/adding the headers when sending the requests to the website and this is blocking me to do 2FA on this page

As soon as I got the issue, I tried to do the automation with Selenium just to confirm it is testcafe issue. As selenium doesn't create a proxy to insert the js scripts and automate the website I could do the automation with selenium, but I want to use testcafe as the site is developed in react.

        await t.typeText(this.emailInput, config.userEmail)
               .click(this.nextButton)
               .typeText(this.passwordInput, config.userPassword)
               .click(this.nextButton)
               .click(this.otpOption)
               .typeText(this.otpInput, this.token)
               .click(this.signinButton)
       }

When clicking on the next button I should have the 2FA form asking for the code, but I got a page saying was not possible to do the authentication (Something wrong happened) and I saw the response code for the BeginAuth endpoint was 222 without any response instead of 200.

The URL is that I am using to authenticate looks like this one:

https://login.microsoftonline.com/client uuid/oauth2/authorize?response_type=code%20id_token&response_mode=form_post&client_id=client uuid&scope=openid&x-client-Ver=4.0.0

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
rafazzevedo
  • 390
  • 2
  • 12
  • 1
    - When I edit and resend the request I am able to get 200 and the response body, but I need to remove the headers: `x-hammerhead|xhr|request-marker: true` `x-hammerhead|xhr|origin: https://login.microsoftonline.com` and add the origin one: `Origin: https://login.microsoftonline.com` – rafazzevedo Jun 18 '19 at 13:02
  • 2
    This may be a bug in TestCafe. We will look for a solution in the context of the [github ticket](https://github.com/DevExpress/testcafe-hammerhead/issues/2052). – Artem Jun 19 '19 at 15:08
  • Thanks @Artem I forgot to add the comment here, but yeah it is a bug indeed, I have created the issue in the testcafe hammer-head github project and forgot to add the answer here – rafazzevedo Jul 17 '19 at 09:48

1 Answers1

2

Testcafe team found out this is a bug on testcafe-hammerhead, they have fixed and it is going to be included in the next release.

https://github.com/DevExpress/testcafe-hammerhead/issues/2052

For now I am generating the cookie in the automation and sending it in the header.

rafazzevedo
  • 390
  • 2
  • 12