don/cordova-plugin-ble-central

Test app installation fails; no tests listed

mikerusso-tsi opened this issue · 7 comments

The following instruction for installing the test app yields an error:
cordova plugin add ../cordova-plugin-ble-central/tests
== > Invalid Plugin! ../cordova-plugin-ble-central/tests needs a valid package.json
True, the repo has no package.json in the tests subdirectory.
As a result, there are no tests listed when running the app.
Is there a repair or work-around? Thanks!

Hi @mikerusso-tsi

That's not surprising, as I haven't really used that test suite for a very long time 😅
What's driving your desire to get this running again?

I can see ways to make it work again probably, but it would be good to understand what you're wanting to get out of it!

Right... that makes sense!

In terms of testing the plugin, the easiest thing is to create a clean cordova app, add the plugin, and then put a single ble.scan() with an alert in the demo JS file. There's almost always BLE devices around, and this checks that the underlying BLE hardware is all connecting properly.

The test code here itself relies on a plugin that I'm not sure is well maintained, and I haven't had a chance yet to dig into further. Let me know though if the above doesn't meet your needs well enough however 🙂

Either way, I should either remove or fix the test app instructions so I need to take some action.

It seemed like there was a very comprehensive set of tests and they would serve well as QA for the plugin, so I would certainly encourage you to get them going again.

I was unsure about your suggestion for an alert in a demo file - alerts weren't showing up for me. Instead, I added the following in jasmineDone() in platform/ios/platform_www/cdvtests/jasmine-2.4.1/jasmine-html.js and ran it on an iPad, tapping the various test run buttons to start new scans:
var bleDevice = 'NO BLE';
ble.scan([], 5, function(device) {
bleDevice = JSON.stringify(device);
alert.appendChild(createDom('span', {className: statusBarClassName}, ' BLE Device = ' + bleDevice, seedBar));
} /*, failure */ );
The scan results then show up in the status bar. Thanks again for you help! Please reply here if you get the tests working!

It seemed like there was a very comprehensive set of tests and they would serve well as QA for the plugin, so I would certainly encourage you to get them going again.

This particular aspect is well covered by a much more extensive set of automated multi-platform end-to-end tests I run against a farm of local hardware 🙂. This is used in some medical-related software applications across both iOS and Android, so I have a very vested interest in keeping it long-term stable across a variety of Android platforms and devices especially.

Glad you were able to prove out the build tools to your satisfaction however.

This particular aspect is well covered by a much more extensive set of automated multi-platform end-to-end tests I run against a farm of local hardware
I share your interest in its stability... Is the testing you mentioned part of this plugin (repo) or outside of it?

@mikerusso-tsi currently outside of the repo, unfortunately.

Apart from a standalone test set leveraging webdriver.io, I have access to several applications with their own dedicated automation suites as part of my job which are also leveraged to help test out the edges of the plugin itself.