Actualmente estoy aprendiendo transportador, estoy haciendo este escenario de parámetros donde quiero cambiar el tipo de operación realizada en cada ejecución
mis pasos
const { Given, Then } = require('cucumber'); const { browser } = require('protractor'); const {expect} = require('chai') Given("I open the {string} url", async function(url){ await browser.get(url) }) Then("The title of the website is {string}", async function(name){ const pageTitle = await browser.getTitle(); return expect(pageTitle).to.be.equal(name); }) Then("Wait {int} seconds", async function(timeInSeconds){ //element(by.model('first')).sendKeys(num) await browser.sleep(timeInSeconds * 1000) }) Then("with following variables {int} and {int}", async function(num1, num2){ await element(by.model('first')).sendKeys(num1); await element(by.model('second')).sendKeys(num2); }) Then('Select "(.*?)" and go', async function(op){ op.toUpperCase(); await element(by.model('operator')).element(by.css("option[value="+op+"]")).click(); await element(by.id('gobutton')).click() await browser.sleep(3000) //return expect(resultado).to.be.equal(res) })mi archivo de características
@smoke Feature: Home page validation Scenario Outline: Scenario Outline name: Page title Given I open the "https://juliemr.github.io/protractor-demo" url Then The title of the website is "Super Calculator" Then Wait 3 seconds Then with following variables <num1> and <num2> Then Select <operator> and go Examples: |num1|operator|num2|result| |7|addition|2|9| |2|division|2|4| |4|modulo|2|6| |3|multiplication|2|5| |5|substraction|2|7|? Luego seleccione la adición y vaya a Indefinido. Implemente con el siguiente fragmento:
Then('Select addition and go', function () { // Write code here that turns the phrase above into concrete actions return 'pending'; });
Recibo este mensaje cada vez que ejecuto mi código, intenté usar expresiones regulares debido a esta otra pregunta pero no solucionó nada, anteriormente estaba tratando de usar {string} y tampoco funcionó
Solo faltaba algo realmente simple.
Then Select "<operator>" and go