Stub navigator API in end-to-end tests

1 · Gleb Bahmutov · April 29, 2019, 4 a.m.
Battery status web appSimple testMocking navigator.battery propertyMocking navigator.getBattery methodBattery status updatesNo battery APISee alsoBattery status web appIn source repo bahmutov/demo-battery-api there is a web application forked from pazguille/demo-battery-api that uses navigator browser API to show the current battery status. You can try the demo of the application at http://pazguille.github.io/demo-battery-api/. It should look something like this:You can see the application JavaS...