Sending request header in nightwatchjs - nightwatch.js

I need to send a specific header called 'Test', and set it to value of true, within my nightwatchjs setup.
This is required so that each test uses this request header in order to work.
I'm wondering how I do this, in which config does it need to be set and how?
Any help would be much appreciated.
thanks

Related

Why is my HTTP request URL not being generated for a Logic App?

Good morning. I am new to logic apps and I am trying to figure out how I can trigger the execution based on a GET URL with three parameters. All the examples I've found on Google show the URL being generated once the JSON and relative path is entered, but that's not happening for me. Perhaps it's because I am creating the logic app in VS.
Here's what my "When a HTTP request is received" step looks like in the logic app.
I also tried removing the JSON and just using the parameters to pass the values to the function, as shown below. I'm just not sure the best way to do this.
All I really need to do is get the three parameters into the logic app so I can perform a function call with the parameters. Any suggestions would be greatly appreciated!
Why is my HTTP request URL not being generated for a Logic App?
You need to click save, and then the url will be automatically generated for the When a HTTP request is received trigger:
You can use this expression to accept values through GET parameters:
triggerOutputs()['queries']['parameter-name']
For example:
Note:
Queries need to pass parameters in the form of json.

Jmeter getHeaderManager() command adding too many headers to the request

I have a Jmeter test which accepts auth Token header and added to the http request using the below command
sampler.getHeaderManager().add(new Header("Authorization","Bearer " + vars.get("BEARER")));
Its working fine for first few requests and then failing with below error
HTTP Error 400. The size of the request headers is too long
When I checked the header, it was actually added around 100+ headers for Auth Token [:O]. Please see details below. Could some one help me on this.
I suspect, that you call HeaderManager#add over and over again. The method add adds a header. While what you really want to do, is to replace a header. Sadly there is no method on the HeaderManager to do so.
But you can emulate it. First remove all headers named Authorization from the header manager and after that re-add the header with the new value. The code in Groovy would look like this:
import org.apache.jmeter.protocol.http.control.Header
sampler.headerManager.removeHeaderNamed('Authorization')
sampler.headerManager.add(new Header('Authorization', 'Bearer ' + vars.get('BEARER')))
Most probably your JSR223 Preprocessor is placed in incorrect location.
JSR223 PreProcessor obeys JMeter Scoping Rules therefore if you put it at the same level as multiple Samplers it will be executed before each Sampler in its scope.
So you need to make the JSR223 PreProcessor a child of the Sampler which header you want to modify and it should resolve your problem.
By the way, you don't need any scripting, headers can be added using HTTP Header Manager.

How to define email address with Jmeter user defined variables?

Problem: In email address # replaced by %40.
http header manager:
user defined variables:
http request:
and result tree:
I have researched about this, and they say that, if http method is POST, then it should encoded automatically. But It does not encoded automatically. Any advice, how can I resolve this?
Note: Jmeter version : 3.1 and I am trying to test a rest service.
Please try sending data in Body data instead of sending it in parameters.
Change "Implementation" of your HTTP Request sampler to Java
If you need to change it for more than one sampler - it makes sense to define the setting using HTTP Request Defaults.
I found the answer. #PoorvajaDeshmukh's answer suggest me. Like following (correct defination of body data);
I also tried #DmitriT's suggestion, but I did not work. Thanks for advices...

Manipulate post body of httpsampler before request

I'm testing an Eclipse-RAP application with JMeter.
In RAP the client (javascript-framework in the browser) communicates with the server over a json-based protocol.
A message looks like this:
{"head":{"requestCounter":3,"uiSessionId":"832834"},"operations":[["set","w1",{"bounds": [0,0,1680,893],"cursorLocation":[1262,-1]}]]}
As you see there is a session-ID stored in uiSessionId. I extracted this id using a "Regular Expression Extractor" and stored it in a variable namedUI_SESSION_ID`.
Then i edited the raw "Post Body" of the recorded HTTP-Request:
{"head":{"requestCounter":3,"uiSessionId":"${UI_SESSION_ID}"},"operations":[["set","w1",{"bounds": [0,0,1680,893],"cursorLocation":[1262,-1]}]]}
and it works.
But i have to alter each Post-Body of each HTTP-Request which can be a lot.
After some research i thought using a "BeanShell PreProcessor" would be the right thing, but:
var sampler = ctx.getCurrentSampler();
would give me a HTTPSampler and i did not find any method which allows me to retrieve the post-body, replace the session-id with the variable and set the altered post-body.
JavaDoc: http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSampler.html
Do you know any way i can replace the uiSessionId with the variable without changing every request manually?
You don't have to. The uiSessionId header has been introduced in a milestone version in preparation for multiple browser-tab support in RAP, but it has been replaced by another mechanism that does not use this header parameter anymore.
As of RAP 2.1 RC1, the client now attaches a “connection id” to every POST request in a URL parameter cid. This parameter does not affect load tests, and you don't have to remove it from your recording. Since every jmeter thread gets its own HttpSession, it's not a problem that all threads have the same cid.
One reason for this change was the ability to load test RAP applications without the kind of problems that you've been struggling with.

Jmeter for pages having dynamic token

I am recording a set of pages using JMeter. Some of the pages have dynamically generated token stored in hidden field.
I retrieve this token using xpath extractor, query is
//input[#name='__RequestVerificationToken']/#value, store it in variable and use this variable for next request.
I don't know why this request is getting failed. I have checked the request value in View Results Tree. In raw tab the value is exactly the same as that of hidden field and on http tab "==" is missing at the end.
As mentioned by Andrey Bolatov, there is a visualization issue in Request HTTP Tab which has now been fixed (you can test using nightly build.
This does not explain you issue.
To debug, add a Debug Sampler to see what has been extracted.
You issue may come from the fact that you didn't encode the parameter, read:
Send Parameters With the Request
Looks like a bug in JMeter. I reported it here - https://issues.apache.org/bugzilla/show_bug.cgi?id=54055

Resources