typescript - Esquema de escenario de Cucumber: Pasando cadenas de espacio " " como valor en la tabla de Ejemplos
Tengo un Scenario Outline de Cucumber en el cual en la tabla de Examples me gustaría pasar 6 cadenas de espacios (" ") como valor. En la tabla de Examples, simplemente dejando el valor en blanco, se pasa una cadena vacía. Intenté con comillas dobles y simples y es lo mismo. Pasa 8 caracteres (incluyendo 2 comillas), en lugar de 6.
Así es como se ve el Esquema de Escenario:
Scenario Outline: Change password - Negative Invalid Confirm Password
Given I log in as a user on the change password page
When I insert the current password
And I insert password
And I insert invalid confirm password <value>
And I move focus to another element on the change password page
Then <message> appears under the confirm password field
Examples:
|value |message |
|Aa1! |Passwords Invalid or Do Not Match |
|" " |Passwords Invalid or Do Not Match |
Y así es como se ve la definición de la característica:
When(/^I insert invalid confirmPassword (.*)$/, async (confirmNewPass:string) => {
await changePasswordPage.changePasswordComponent.insertConfirmNewPassword(confirmNewPass);
});
Respuesta #1
Necesitas crear un archivo de funcionalidad así
Feature: Title of your feature
I want to use this template for my feature file
Scenario Outline: Title of your scenario outline
Given I want to write a step
When I check for the <value> in step
Then I verify the <message> in step
Examples:
|value |message |
| "Aa1!" | "Passwords Invalid or Do Not Match" |
| " " | "Passwords Invalid or Do Not Match" |
y luego en la definición del paso tendrás que usar una expresión de cucumber.
El código de ejemplo está escrito abajo
@Given("I want to write a step")
public void i_want_to_write_a_step() {
// Write code here that turns the phrase above into concrete actions
System.out.println("In a given method!");
}
@When("I check for the {string} in step")
public void i_check_for_the_Aa1_in_step(String value) {
// Write code here that turns the phrase above into concrete actions
System.out.println("Value: " + value);
}
@Then("I verify the {string} in step")
public void i_verify_the_Passwords_Invalid_or_Do_Not_Match_in_step(String message) {
System.out.println("Message: " + message);
}
