Selenium "StoreText" to use in other field - testing

Please help,
I want to use the value that i stored using storeText.
My problem is, how do i use this on the other fields of the page?
Thanks in advance!
For example:
I want to get the name of this customer, and verify it on another site if its existing by entering the name on the search field on another site?

See the "Variable substitution" paragraph of the documentation, it even has a nice example of usage for storing a name from multiple fields:
Variable substitution
Variable substitution provides a simple way to include a previously
stored variable in a command parameter. This is a simple mechanism, by
which the variable to substitute is indicated by ${variableName}.
Multiple variables can be substituted, and intermixed with static
text.
Example:
store | Mr | title
storeValue | nameField | surname
store | ${title} ${surname} | fullname
type | textElement | Full name is: ${fullname}

Why don't you get the text from the webelement store it in a global static variable and call the variable in the other test case?

Related

How do I transform array in search or elsewhere in dashboard

I have a search that is working fine
index=event_db environment=prod release = 2020150015
| timechart count as Events
However, I'd like to modify this to search for any release in an array of releases. I'm aware of the "in" operator.
The catch is that the array of releases I've been provided ("Releases") is formatted slightly differently like so:
[ver2020.15.0015, ver2020.15.0016, ver2020.22.0019] // in general, many more than 3!
Is there a way to use the in operator and some mapping to get
release in
[2020150015, 2020150016, 2020220019] ?
Can this be put in the search?
This is part of a panel so if it's simpler I could have code elsewhere to convert [ver2020.15.0015, ver2020.15.0016, ver2020.22.0019] into [2020150015, 2020150016, 2020220019]
However, as mentioned I'm a newbie so my knowledge of where to put code to transform an array is limited :)
I have a fieldset section and a panel with a query in it.
The "Releases" array is populated in the fieldset section as so:
<input type="text" token="Releases">
<label>Release or Releases</label>
<default>*</default>
</input>
The user enters ver2020.15.0015 or perhaps ver2020.15.*.
I can't just have the user enter 2020150015 as the ver2020.15.0015 format is used elsewhere.
Perhaps there's a way to create new field Releases_Alt right after getting this?
Let me know of any other info I can provide. As I said, I'm new to Splunk so I'm still struggling with terminology.
Try this query. It uses a subsearch to build the IN argument. Subsearches in Splunk run before the main search and the output of the subsearch replaces the subsearch itself.
index=event_db environment=prod release IN (
[ | makeresults
| eval Releases=replace ($Releases|s$, "[ver\.]+","")
| return $Releases ] )
| timechart count as Events
The makeresults command is there because even subsearches have to start with a generating command. makeresults creates a "dummy" event that allows other commands to work.
The eval command does the work of converting release versions into the desired format. Note the use of |s with the Releases token. This construct ensures the contents of the token are enclosed in quotation marks, which is expected by the replace function.
Finally, the return command with $ returns the results of the eval, but without the field name itself. Without it, the subsearch would return releases="2020150015, 2020150016, 2020220019", which wouldn't work.

How to render Karate.Config values in Scenario outline

I am just wondering if there is a way to make use of karate.config values in Scenario Outline statement. Please have a look at the example below:
Feature: Sample feature
Scenario Outline: Sample scenario for id: <id>
Examples:
| id |
| partnerId |
Here the partnerId is defined in Karate.config file (just say it is '123'). When I run the file I want to see '123' in scenario outline in reports rather than the value holder 'partnerId'
Expected:
You are asking for variables to be able to be substituted into the title. Sorry, that's not supported. You can always print these values so they will show in the HTML report, but yes - not as the title.

how to (still) use a wildcard in the middle of a string?

I am trying to run the following query
index=one /thispath/file*.pdf
I know that using wildcards in the middle of a string is not recommended, but I have too many different files: file001.pdf, fileabc.pdf and others.
What can I do? I am more worried about bogus results than processing speed.
Thanks!
It's not recommended, but it works. Just do it.
index=one "/thispath/file*.pdf"
I think you could do this one of 3 ways, actually, depending on your needs:
| makeresults | eval field="/thispath/fileone.pdf"
tell splunk to look for both the beginning and end of something
| search field="/thispath/file*" AND field="*.pdf"
filter after the event search using wildcards
| where like(field, "/thispath/file%.pdf")
filter after the event search using regex
| where match(field, "/thispath/file.*.pdf")

How can I test that an image has been sent to a user on a chat application

I've got a chat application I'm doing Gherkin for and one of the features I'll be adding is the ability to send images of various types, I just don't know how to write this up. Could it be?
Given the following users exist:
| Username |
| Alice |
| Bob |
When "Alice" sends "Bob" "Image A"
Then "Bob" can see "Image A"
Is "Image A" the url to the image? And, if it is, where does the image reside for the test itself?
This is a common programming problem where you need to store image location in a variable and pass that variable as argument. You can pass that variable name from gherkin feature file. See Here for storing file location, hope this helps:
How to pass a text file as a argument?

Avoid creating full-package field in Intelij IDEA

When I have field, which is not created at the moment time, I usually hit alt + enter and do -> Create field
The problem is, when I create field, I have full package field, for example
com.blabla.ClassName, but I want to create field without package prefix.
File | Settings | Editor | Code Style | Java | Imports
Then select: Never, use short name and add import