From 2382347a43877007975ec86d99036f10d315cd7c Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 11 Apr 2018 02:33:21 +0100 Subject: [PATCH] [tests][crashlytics] added crashlytics() tests -> 100% coverage --- bridge/e2e/crashlytics/crashlytics.e2e.js | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 bridge/e2e/crashlytics/crashlytics.e2e.js diff --git a/bridge/e2e/crashlytics/crashlytics.e2e.js b/bridge/e2e/crashlytics/crashlytics.e2e.js new file mode 100644 index 00000000..da776cac --- /dev/null +++ b/bridge/e2e/crashlytics/crashlytics.e2e.js @@ -0,0 +1,72 @@ +describe('crashlytics()', () => { + describe('crash()', () => { + it('should force an app crash', async () => { + await firebase.crashlytics().crash(); + if (device.getPlatform() === 'ios') { + // ios responds quicker after a fatal exception if we re-install + await device.uninstallApp(); + await device.installApp(); + } + + await device.launchApp({ newInstance: true }); + await firebase.crashlytics().log('app relaunched from a crash'); + }); + }); + + describe('log()', () => { + it('should set a string value', async () => { + await firebase.crashlytics().log('123abc'); + }); + + xit('should error on a non a string value', async () => { + // TODO lib needs validations adding + await firebase.crashlytics().log(123456); + }); + }); + + describe('recordError()', () => { + it('should record an error with a code and message', async () => { + await firebase.crashlytics().recordError(1234, 'Test error'); + }); + + xit('should error on invalid args', async () => { + // TODO lib needs validations adding - and this should technically take an instance of Error only + await firebase.crashlytics().recordError({}, []); + }); + }); + + describe('setBoolValue()', () => { + it('should set a boolean value', async () => { + await firebase.crashlytics().setBoolValue('boolKey', true); + }); + }); + + describe('setFloatValue()', () => { + it('should set a float value', async () => { + await firebase.crashlytics().setFloatValue('floatKey', 1.23); + }); + }); + + describe('setIntValue()', () => { + it('should set a integer value', async () => { + await firebase.crashlytics().setIntValue('intKey', 123); + }); + }); + + describe('setStringValue()', () => { + it('should set a string value', async () => { + await firebase.crashlytics().setStringValue('stringKey', 'test'); + }); + }); + + describe('setUserIdentifier()', () => { + it('should set a string value', async () => { + await firebase.crashlytics().setUserIdentifier('123abc'); + }); + + xit('should error on a non a string value', async () => { + // TODO lib needs validations adding + await firebase.crashlytics().setUserIdentifier(123456); + }); + }); +});