Currently learning protractor, I am doing this parameter scenario where I want to the change the type of operation done in every run
my steps
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)
})
my feature file
@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|
? Then Select addition and go Undefined. Implement with the following snippet:
Then('Select addition and go', function () { // Write code here that turns the phrase above into concrete actions return 'pending'; });
I am getting this message every time I run my code, I tried using regex because of this other question but it didn't fix anything, previously I was trying to use {string} and it didn't work out either
It was just missing something really simple
Then Select "<operator>" and go