Remember that while the protractor makes it look like the test code is synchronous, everything is asynchronous under the hood.
It is unlikely that it waiting for db.connection.query complete (this is an asynchronous interface). That way, the callback you pass that calls the transporter methods is called in a random context. (Perhaps during the next it or something --- whenever db is ready.)
If db.connection.query returns something like a promise, then you can simply return its result as a result of it , and everything should work. Otherwise, you need to wrap the db connection in a promise or use the explicit done it callback style:
it('test1',function(done){ sql = "UPDATE table users set users = 1"; db.connection.query(sql, function(err, rows, fields) { if (!err) {
source share