I have a cucumber scenario outline in which Examples table I would like to pass an empty string (" ") and line breaks (\n \n \n) as value. I want to edit an textfield and I am deleting the string and want to pass in the empty string or the line breaks. I want to send this value and press enter. This would look like this .sendKeys(value + "\n"). In the Example table just leaving the value blank and pass \n\n\n doesnt work. Value in textfield gets not changed.
This is how the Scenario outline looks like:
Scenario Outline: Do not accept erroneous input as group conversation name (only spaces and break lines)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name <NewName> for conversation
Then I do not see conversation <NewName> in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 | NewName |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 | |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 | \n\n\n\n |
How do I pass the values?
When I am just passing the values as hardcoded it works. The textfield gets replaced at least with the values, but I would like to have it in as an placeholder .
Hard coded version:
Scenario Outline: Do not accept erroneous input as group conversation name (only spaces)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name for conversation
Then I do not see conversation in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 |
Scenario Outline: Do not accept erroneous input as group conversation name (line breaks)
Given I Sign in using login <Login> and password <Password>
And I see Contact list with name <Name>
And I create group chat with <Contact1> and <Contact2>
When I open conversation with <Contact1>, <Contact2>
And I open Conversation info
And I set name \n\n\n\n\n for conversation
Then I do not see conversation \n\n\n\n\n in contact list
And I see Contact list with name <Contact1>, <Contact2>
Examples:
| Login | Password | Name | Contact1 | Contact2 |
| aqaUser | aqaPassword | aqaUser | aqaContact1 | aqaContact2 |
Any ideas? Thanks
You only need to put the <columnName>
between "" in your feature definition. Example:
And I set name "<NewName>" for conversation
In your step definition, the step could be annotated like as follows:
@And("^And I set name \"([^\"]*)\" for conversation$")
public void And_I_set_name_for_conversation(String newName) throws Throwable {
...
}
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With