End to End System Testing in Dev Mode

In addition to writing automated unit tests for each project module and integrated tests across modules, we occasionally need to manually walk through the system to experience it the same way as an end user would. Manual testing sometimes leads to discovering new issues that can be then covered with new automated tests.

Following is the recommended way to manually test an Ambianic system end to end in development mode, but as close as possible to realistic deployment conditions.

First, start the Ambianic UI and Ambianic Edge gitpod environments. If you haven't done this before, then follow these instructions.

Next, go to the Ambianic Edge dev environment and make sure that all main modules are running: 1. Core Monitoring and Inference Engine 1. REST API server (fastapi) 1. WebRTC - HTTP proxy

In your main workspace directory you should see a file named .peerjsrc with a contents similar to this:

{"peerId": "77d4b8b4-bc2a-451a-9bed-28f07c3e1abc"}

Copy to the system clipboard the peerId value from this json formatted file. Just the 77d4b8b4-bc2a-451a-9bed-28f07c3e1abc part. Notice that this value is a randomly generated UUID4 which will be unique for your environment.

Screen Shot 2021-09-07 at 7 33 11 PM

Next, go to the Ambianic UI environment, and make sure that the Ambianic PWA is being served by nodejs. Your terminal window should look like the screenshot below.

Screen Shot 2021-09-07 at 8 21 17 PM

Open a browser window pointing to port 8080 of the gitpod environment serving the Ambianic PWA on nodejs in dev mode.

Screen Shot 2021-09-07 at 4 48 19 PM

Click on Begin Setup then on the next page click Skip in the upper right corner of the app.

Screen Shot 2021-09-07 at 7 38 33 PM

On the next page, select the Main menu drop down in the Nav Bar and click Settings.

Screen Shot 2021-09-07 at 7 41 22 PM

Then scroll down to the section titled "Pair with remote Ambianic Edge device".

Screen Shot 2021-09-07 at 7 40 43 PM

Paste the peerjs key value that you copied from the Ambianic Edge CDE. Click on Pair Remotely. In a few moments you will see snackbar status messages indicating that the UI is connecting to Ambianic Edge followed by a confirmation that connection is established.

Screen Shot 2021-09-07 at 7 41 08 PM

If you now scroll up to the top of the Settings page you will see the Peer ID and Version of the Ambianic Edge device you are connected to. This is in fact a connection to the gitpod CDE running Ambianic Edge in dev mode.

Screen Shot 2021-09-07 at 7 59 18 PM

Notice that we did not have to open any public HTTP/S ports on the Ambianic Edge CDE in order for the UI to access the virtual device. This is exactly how the UI and Edge connect in a real world deployment. Instead of relying on access to public HTTP/S endpoints, the UI and Edge connect securely and directly via WebRTC DataChannel (using peerfetch - an HTTP over WebRTC proxy).

Screen Shot 2021-09-07 at 8 26 53 PM

If you now navigate to the Timeline page, you will see a timeline view.

Screen Shot 2021-09-07 at 8 09 16 PM

The source for this view is populated from the video file configured in dev-config.yaml in the Ambianic Edge CDE. You can change the file with your own recorded video file for testing various detection scenarios.

Screen Shot 2021-09-07 at 8 09 46 PM

Notice how the peerfetch terminal shows a log of HTTP fetch requests and responses from the Ambianic UI instance. This is an indication that the UI and Edge are communicating. If you switch to the Fastapi terminal it will also show REST API requests served to the peerfetch proxy on behalf of the UI app (PWA).

Now you have a fully setup live and realistic system that runs both Ambianic UI and Ambianic Edge in dev mode. This setup represents as closely as possible the real world experience of an end user, while allowing you, dear developer, to test, experiment and commit code.