I am having an e2e testing pack with protractor-cucumber-framework and Chai for asserting.
I have a Feature file with a data table as below.
Scenario: Menu Validation
Given I am on the home page
When I do Hover over the menu item I should have the menu dropdown
|menu1 |
|menu2 |
|menu3 |
I have the step definition as below.
When(/^I do Hover over the menu item I should have the menu dropdown/, (dataTable) => {
let rootMenu : Array<string> = Array.from( dataTable.rawTable )
rootMenu.forEach((ele) => {
console.log(ele[0]);
element(by.id(ele[0])).isPresent().then(function(present) {
expect(present).to.equal(true);
});
});
});
Even if the menu element ID is not present this test step never fail, I checked further the expect(present).to.equal(true); never get executed. I am not sure what I am missing.
forEachof therootMenubut then you sayele[0]like if the rootMenu was an array of arrays - Sergey Pleshakov