ATF Test step to set url parameters.

Cecilia7
Kilo Contributor

I'm testing a SN catalog item. When a user gets directed to the SN form from another website, some parameters are passed through the URL and used to auto-populate the form. One of these parameters is the user's IP address, which is used to populate a field (and made invisible to the user) with a client side script:

var gUrl = new GlideURL();

gUrl.setFromCurrent();

var publicip = gUrl.getParam("sysparm_pip");

g_form.setValue('user_ip_address', publicip);

g_form.setDisabled('user_ip_address', true);

In an ATF test step, how would I set the url parameters for subsequent test steps so that I can validate that this field was populated automatically in the form?

 

 

1 ACCEPTED SOLUTION

Deepen Shah
Kilo Guru

Hello Cecilia,

 

Which ATF test step are you using? If you are using 'Open a Catalog Item (SP)' then it has Query parameters field to supply the parameter.

 

find_real_file.png

 

Regards
Deepen shah
aavenir.com

View solution in original post

9 REPLIES 9

Deepen Shah
Kilo Guru

Hello Cecilia,

 

Which ATF test step are you using? If you are using 'Open a Catalog Item (SP)' then it has Query parameters field to supply the parameter.

 

find_real_file.png

 

Regards
Deepen shah
aavenir.com

Thanks! This may be the answer, but it still doesn't appear to be working. Even though I set sysparm_query to a value as a Query parameter, the test behaves as if it is blank.

I haven't been able to find any documentation for this. Do you know if there is a way to see the URL that is generated from the test step (or what the URL would look like if it had those parameters)?

As an example, I'm trying to set the sysparm_query value in the URL to www.example.com as in the example below:

https://mysite.service-now.com/nav_to.do?uri=%2Fcom.glideapp.servicecatalog_cat_item_view.do%3Fsysparm_id%3D5551234567810d974edf9bc4bcbed%26sysparm_query%3Dwww.example.com%26 

Hi

This is how you are setting query parameter?

find_real_file.png

 

Also make sure this is right query name & value, because i believe sysparm_query is used to filter data like sysparm_query=id!=007 

Regards
Deepen shah
aavenir.com

Yes I entered it that way and verified it is the right query name.

I found that in SN on the form for the client-side script that uses the parameters, there is a form field for "UI Type", which I assume specifies on which UI types the script is active. It had the options of Desktop, All, and, Mobile/ServicePortal and it was set to Desktop, so I changed it to Mobile/ServicePortal. 

I now get javascript errors on the Service Portal page from the client-side script and will need to fix this.

 

Do you know why query parameters are not a feature on the "Open a Catalog Item" test step as well?