Test Data not showing in All Steps page in Cluecumber report plugin - automation

I am generating the cluecumber report. When ever the report is generated , in the All Steps page the test data is not getting populated rather the steps are showing empty angular brackets like {}.
The test case is written as -
#Regression
Scenario: Create a new Modifiers
Given item image is clicked
When modifiers option is selected
And modifier is created as **"ModifierName"**
And enter modifier option and modifier price as **"Mod"** and **"3.50"** respectively
And hit save
Then verify modifier is created as **"ModifierName"**
**
See the below image for how it is generating now.**
enter image description here
pom file looks like this-
enter image description here
enter image description here
I wish test data passed in feature file to appear in steps while report is generated in All Steps Page and no {} empty brackets.

The all steps page shows which step implementations are used in which scenarios. This is independent of parameter values.
In the scenario details you see the data you need since here the steps are used with concrete values.

Related

ReadyAPI - Automation script to get the value from data source step

i am new to ReadyAPI and automation. But now i facing some issue where i wanted to fill in the consent page will the value that will get from the Data source.
The Role value is the value that i need to get and fill into the consent page
Here is my automation code to get the value:
I have to get the value from Data source, then fill into text box, then click button
This is the code im using:
document.getElementById('freeTextHabilitations').value = 'ObjectiveCombinaisons Data Source#Role';
document.getElementById('allowBtn').click();
I having problem where get nothing after the data source ran .
Anyone have any idea on how to inject the value from data source to automation script (java?)
Thank you.
Stanley,
Unclear as to how you are using DOM methods(with ReadyAPI), but to answer your question on accessing Data Source values
For that, you will need property expansion. So, your groovy script should be something like
xxxx.value = context.expand( '${ObjectiveCombinations Data Source#Role}' )
Property Expansion
This can be generated for you by using the Get Data dialog
Get Data Dialog

TestCafe does not write in text input field

I'm using TestCafe for test automation of a web application based on the Wicket framework. I try to type text into a text input field ... well, actually it is a dropdown list, where a text input field appears, so that the user can search for certain codes. The HTML fragment is as follows:
HTML fragment
And here is the corresponding screenshot (text field above "001"):
Text input field with dropdown
The user can type some characters and the list below is automatically filtered (I did this manually):
Text input field with some text
My TestCafe test tries this:
.click( productcodeList )
.expect( productcodeInputField.visible ).ok()
.click( productcodeInputField )
.typeText( productcodeInputField, 'ABW' )
i.e.
Click on the drop down list.
Assume that the text input field is now visible (works fine).
Click on the text input field (this should not be necessary, since typeText() is supposed to do this anyway).
Type the text "ABW" into the text input field ==> This does not work.
I'm sure that my Selector works, since the assertion (expect) is successful and when I debug the test run after the second click (on the text input field), I see the following:
TestCafe screenshot
I.e. the cursor is directly on the text field, but somehow TestCafe cannot write the text into the field.
Some additional information: The Selector for the input field is created as follows:
productcodeInputField = Selector('span').withAttribute('class', /select2-dropdown.*/ ).child('span').withAttribute('class', /select2-search.*/ ).child('input').withAttribute('class', 'select2-search__field' );
More information: I'm using the same logic on the same page:
kurzbezeichnungField = Selector('input').withAttribute('name', /.*aeAbbreviation.*/);
...
await t.click( kurzbezeichnungField )
.typeText( kurzbezeichnungField, 'xxxWWW' )
and this works fine.
Node.js version: v10.16.3
Testcafe version: 1.5.0
This issue looks like a bug. However, I cannot say it precisely without an example that demonstrates the problem.
My team would really appreciate it if you share your project or sample to demonstrate the issue.
Please create a separate issue in the TestCafe github repository using the following template and provide as much additional information as possible.

Can't pass a Test Execution result to a variable in Robo Framework

I am posting the results of automated tests to an offline forum. It would be nice to include PASS/FAIL in the forum post title but I'm having some difficulties retrieving the ${TEST STATUS} value - (obviously a hard-coded value works fine) .
I've defined the following in common-variables.robot as:
${FORUM_TEST_RESULT}....${TEST STATUS}
then on publish-results.robot
Input Text....//*[#id="title"]....${FORUM_TEST_RESULT}
The error I get is: variable ${FORUM_TEST_RESULT} not found
I can see here: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#listener-interface that ${TEST STATUS} can only be used as part of Teardown.
I'm not sure how to collect the value of ${TEST STATUS} in the context of my RF script.
e.g the very last thing my script does is post to a forum:
Input Text....//*[#id="title"]....${FORUM_TEST_RESULT}
but before that I obviously need to populate ${FORUM_TEST_RESULT} with the value of ${TEST STATUS) which you can only get on Teardown? Hope this makes sense.
Input Text is a keyword of Selenium2Library that types the given text into the text field of a web page. You need to start a browser session first and open the right page an then possibly wait for the element to become visible, for example like this:
Open Browser [URL of your site]
Wait Until Element Is Visible //*[#id="title"]
Input Text //*[#id="title"] ${FORUM_TEST_RESULT}
If you want to retrieve a text from a page (as your coment suggests) then you need to use the keyword Get Text which returns the text of the element identified by locator.
Get Text locator

How to handle Xpaths which changes dynamically every time?

I am writing selenium web-driver script. The scenario of script is:
1) Login in www.yahoomail.com
2) Sign-in successfully.
3) Click on "Compose" button
4) Enter email ID in "To" Field.
5) Enter subject in "Subject Field.
6) Enter Email Body in "Text" Field.
7) Click on "Send" button.
Using Firepath, I have taken xpath of fields mentioned in "Compose" page.
But every time when I open Compose page, this xpaths changes dynamically.
Below is the script I am using:
WebDriver oYahoo = new FirefoxDriver();
oYahoo.get("http://www.yahoomail.com/");
oYahoo.manage().window().maximize();
oYahoo.findElement(By.xpath(".//*[#id='login-username']")).sendKeys("abcdefasdf#yahoo.com");
oYahoo.findElement(By.xpath(".//*[#id='login-passwd']")).sendKeys("sfgas234#123");
oYahoo.findElement(By.xpath(".//*[#id='login-signin']")).click();
oYahoo.findElement(By.xpath(".//*[#id='Compose']/button")).click();
oYahoo.findElement(By.xpath(".//*[#id='yui_3_16_0_1_1448364357109_2222']")).sendKeys("abcdefgh#gmail.com");
oYahoo.findElement(By.xpath(".//*[#id='subject-field']")).sendKeys("Hi This is my first automated mail");
oYahoo.findElement(By.xpath(".//*[#id='yui_3_16_0_1_1448364357109_1966']")).sendKeys("Hi This is my first automated mail");
oYahoo.findElement(By.xpath(".//*[#id='yui_3_16_0_1_1448364357109_2465']")).click();
oYahoo.quit();
What we can do so that it will take Xpath dynamically? Do we need to map those things in some class ? do we have to write any other class for "Compose" pop-up?
If "Yes" then how we can do it ?
Try to observe a common pattern that is repeated everytime. Either an id prefix or class prefix, anything.
Then use the following selector in your By.xpath(..) function.
//*[contains(#id,’your-common-pattern’)].
I worked on a project where class names where random each time the page was generated and the unique way i found to get those label/input/.. is i used the nth-child() function with the css selector. The thinking method is like : I want the 3rd input from the 2nd row of the 1st table.
checkout this fiddle to understand what i meant.
https://jsfiddle.net/8v150af1/

How to find value of email field using Selenium2Library

I am writing regression tests for a web application using robot framework and the Selenium2Library library. I have a simple test which changes all of the fields of an "account settings" type form (think username, password, email, etc.), then revisits the page and makes sure all of the data was saved. Like so:
*** Test Cases ***
Sample Test
Change All Account Details
New Account Details Should Be Saved
*** Keywords ***
Change All Account Details
Navigate to Account Page
Input Text accountSettingFrom_firstname Test
Input Text accountSettingFrom_lastname Dummy
Input Text accountSettingFrom_email new_email#example.com
# etc etc, eventually save the form
New Account Details Should Be Saved
Go To ${ACCOUNT_URL}
Textfield Value Should Be accountSettingFrom_firstname Test
Textfield Value Should Be accountSettingFrom_lastname Dummy
Textfield Value Should Be accountSettingFrom_email new_email#example.com
I get the following error on the final step (Textfield Value Should Be accountSettingFrom_email new_email#example.com) when running this test: Value of text field 'accountSettingFrom_email' should have been 'new_email#example.com' but was 'None'
I have taken screenshots the moment before that step runs, and I have added a pause and manually confirmed that the value attribute of 'accountSettingFrom_email' is indeed 'new_email#example.com'. HTML of the element at time the check occurs:
<input type="email" name="accountSettingFrom[email]" value="new_email#example.com" class="foo bar" required="required" tabindex="3" maxlength="128" url="/foo/bar" userid="foobar" id="accountSettingFrom_email">
You'll notice that the first two Textfield Value Should Be keywords pass. The only difference I can discern between the three elements is that 'accountSettingFrom_email' is type="email" instead of type="text", but if the the keyword is successfully locating the element, then why can't it grab the value of the value attribute?
So am I doing something wrong? I feel like this or some similar keyword must exist to test this, without having to resort to writing a custom library.
You have hit some bugs in Selenium2Library. When Selenium2Library was created, HTML5 was not ratified. Internally the library is filtering out your element because it has a type other than 'text' (made sense before HTML5). Textfield Value Should Be can only find your element if it has tag name input and attribute value 'text' for type.
See https://github.com/robotframework/Selenium2Library/issues/546
Also due to how Textfield Value Should Be is implemented, the error you are getting makes you think the element was found when in fact it was not because it was filtered out.
See https://github.com/robotframework/Selenium2Library/issues/547
In contrast, Input Text and Input Password have never filtered on element tag or attribute.
I would try Get Element Attribute instead to get the attribute named value instead. According to the API it should be
accountSettingFrom_email#value