Ok, I found the answer, so I answer my own question for others:
You can execute javascript using browser.executeScript and then use the return value in your promise, for example:
browser.executeScript('return document._config').then( function(_config){ expect( _config.epid ).toBe( 1 ); });
source share