0

In my application, when I am accessing the base url I need to pass in Authorization Token.

I have an Auth token generation endpoint that returns the Authorization token and then this token needs to be passed in the header of the base url of my tests.

Can someone please tell me or guide me on how this can be done? I read through the documentation and I am not able to use HTTP AUthentication as it does not supports passing in Authorization token.

Thanks !!

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Jn Neer
  • 245
  • 1
  • 14

1 Answers1

0

You can create a custom HTTP request hook by using the RequestHook API, which allows you to pass the authorization token. Please refer to the following help topic in the TestCafe documentation: https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/intercept-http-requests.html#create-a-custom-request-hook

Also, you might want to take a look at this TestCafe example, which demonstrates how to set a custom referrer for the specified requests during tests.

aleks-pro
  • 1,659
  • 4
  • 12