arrays - protractor, JavaScript Comparison: Cannot read property 'forEach' of undefined -


var operation= require('./1.js');

var expectedresults = require('./range.js');

describe("range test", function() {

operation.min.foreach(function(elt, i) {      expectedresults.timedialmoderateinversemin.foreach(function(elt1, i) {          it('trip unit styles: ' + elt1, function() {                 var result=   min.filter(function(i) {                    if(elt1===elt)                           {                                  return true;                           }                    else                           {                           return false;                           }              })               expect(result.tostring()).tocontain(elt)          })               })  }) 

})

here trying compare 2 different arrays 2 different pages.

  1. there 2 files 1.js , range.js
  2. 1.js performs operations on application , stores data array min[].
  3. range.js contains expected results needs compared min[] 1.js successfull execution of tc.

while executing above code error: "cannot read property 'foreach' of undefined" doing wrong here ?

you're calling .foreach functions on 2 things here. are:

operation.min , expectedresults.timedialmoderateinversemin

your error message explaining what's happening, 1 of 2 things undefined (i haven't run code don't know 1 it's breaking on).

check things being exported 1.js , range.js trying console.log them in file , check keys you're looking min , timedialmoderateinversemin in there.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -