ripple-emulator / ripple

A browser based, platform agnostic mobile application development and testing tool.
Apache License 2.0
46 stars 20 forks source link

Can't run in PhantomJS #26

Open CyborgMaster opened 8 years ago

CyborgMaster commented 8 years ago

I use Ripple in combination with PhanomJS and Capybara to write automated tests for our Phonegap app. This worked great up through Ripple version 0.9.28. 0.9.29 introduced a new technique for overriding native browser properties that doesn't work on PhantomJS. At https://github.com/ripple-emulator/ripple/blob/0.9.29/lib/client/emulatorBridge.js#L81 it uses Object.defineProperty (before it just used =). One of the properties that is overridden is 'name'. This works in Chrome, but not in PhantomJS. (There is an open issue for PhantomJS here https://github.com/ariya/phantomjs/issues/13895, but no progress has been made on it in 6 months).

Is there any way Ripple could use a different property name other than name, or possibly go back to using = for name? Then I could start using PhantomJS again for tests.

TimBarham commented 8 years ago

Unfortunately we found that to consistently patch the properties Ripple needs to patch, it needs to the Object.defineProperty (various properties fail otherwise).

I'm not sure in what context name is getting set (in the situation you're looking at, what object is it a property of?), but pretty much all the properties Ripple sets are replacing existing properties or defining properties that plugins expect and so can't be renamed.