Working with Lightning apps

Lightning is a JavaScript framework for building TV apps. It is a bit special, because it does not use DOM to render user interface, instead rendering your app into a canvas HTML element. It takes a few extra steps while preparing the setup, so that Suitest is able to inspect and assert on user interface elements.


Building the app

Suitest requires Lightning's inspector to be ON in order to work with user interface elements. Make sure that inspector property is set to true in your Platform settings.

Note, that Lightning includes inspector only to developer build of your application, i.e. when you build it with command lng build. In case you want to test a distribution build (lng dist), you would need to include the Lightning inspector library manually.

Instrumenting the app

There are no extra steps in instrumentation process for Lightning apps. Just follow the steps according the platform you are building your app for:

Limitations

Suitest supports grabbing properties from the default Lightning Textures, such as Rectangle, Image or Text. However, there is no way for us to inspect custom textures, as those are implementation-specific.

Suitest is able to get:

  • top, left, width, height, opacity and z index properties of any element, including when transformation or animation is applied.
  • text contents and text color properties of the elements defined with Text texture.
  • image and image loading state properties of the elements defined with Image texture.
  • background color property of the elements defined with Rectangle texture. Top left corner color is used for gradients.
  • all video properties, as Lightning is using HTML5 video player for the playback.

Properties that Suitest does not fetch:

  • border style, border color and border width properties always return default values (none, rgba(0, 0, 0, 0) and 0 respectively).
  • class, href and value properties are always empty, as they do not have a counterpart props in Lightning.
  • id attribute is equal to Lightning element ID. It's usually a number and is assigned dynamically, so you can't use it as a stable identifier for your tests.

You can also use matches JS type of assertion in case you need to assert on some custom value of your Lightning element.

Example of JavaScript assertion on the Lightning element