0

I'm writing a protractor test that check the value of an input type field.

Code in the Test Page:

expect(logPage.logFileSizeField.getAttribute('value')).toBe(logFileSizeDeafault)

Object Page code:

this.logFileSizeField = element(by.css('input[name="logFileSizeField"]'));

The test run correct localy (so I'm sure the element is found) but when it runs on jenkins it fails because the value returned from the getAttribute('value'); is empty.

Error from jenkins:

Error Message

Expected '' to be '1048576'.

Stacktrace

Error: Failed expectation
   at [object Object].<anonymous>(/usr/src/app/tests/e2e/log/log.spec.js:43:64)
   at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14
I.G. Pascual
  • 5,818
  • 5
  • 42
  • 58
IlBosco
  • 1
  • 1
  • 4
  • I do the same in other tests that run correctly localy and on Jankins so i dont understand what could be the problem.. – IlBosco Jun 13 '17 at 14:53
  • The app you are running the tests locally and in Jenkins has the same data? Try checking manually what is happening in Jenkins. Another thing I would try is pulling the getting element value part out of the expect and use `then()`, outputting the value to console (or even taking a screenshot) and running the expect, all withing that `then(). – Ania Jun 15 '17 at 10:45
  • After hour on that i think the prolem is that the data i need is read from a file. Probably the fs.existSync() doesnt work – IlBosco Jun 15 '17 at 12:52

0 Answers0