Instrumenting Samsung Tizen apps

  • Samsung Tizen

To prepare a Samsung Tizen app you have three choices. Either use our Lite solution (see below) or have the Instrumentation library automatically injected into the package or manually insert the instrumentation code into every HTML file of your app. Then create a build and upload it to Suitest.

Only .wgt and .tmg package file extensions are supported. For more information see the Uploading package to Suitest section below.

At this point you should have a working Samsung Tizen device in your Suitest account.

WatchMe demo application

If you are looking for a Samsung Tizen application to try Suitest with, feel free to use our WatchMe demo application. Please note that this app is a hosted one. Therefore, you will need to either use our Lite solution or setup the Suitestify.

If using Automated library injection:

  1. On the application settings page you will need to enable Suitestify by checking the Enable Suitestify checkbox.
  2. Into the list of domains, please insert the following ones: watchme.suite.st, file.suite.st.

Suitestify - WatchMe demo setup


Choosing Lite or Instrumentation library

Suitest is using 2 different solutions to access information from a Samsung Tizen application:

  • Lite (recommended)
    • No code needs to be injected into your application.
  • Instrumentation library
    • Injecting a JavaScript code into your application.

Here you can see the differences between these solutions:

Feature support Lite Lite (with Suitestify) Instrumentation library Instrumentation library (with Suitestify)
Identifying element based on link text - -
Testing pseudo elements - -
Testing more shadow DOM elements - -
Network requests -
- for audio/video files - -
- to local files - -
- to IP addresses - -
3rd party cookies - -

Using Lite

Select Lite - no Instrumentation library (recommended) option inside the Instrumentation library section of your application configuration.

No further action related to the instrumentation library needed. You can continue with package upload.

Inject the library automatically

Suitest can automatically inject the instrumentation library into your application package without your interaction. Select Inject the library automatically before uploading the app package under the App details tab.

Inject the library automatically

If your Samsung Tizen app is hosted (package referencing a URL), then you will need to enable Suitestify.

Instrumentation limitations

Suitest can only auto-instrument .wgt packages (not .tmg). Upon instrumentation, the package will be re-signed with our own certificate. In case your application requires some specific permissions that are not available for standard public or partner certificate, you would have to instrument the application manually.

If the process fails, please follow the manual instrumentation guide.

Insert the library manually

Copy and paste the code snippet from the Suitest configuration page into every HTML file of your application. For best results put it as the first script element in your HTML file right after the opening <head> tag.

Inserting Suitest instrumentation library for HTML apps

Instrumentation library in production

When inserting the Suitest instrumentation library, ensure you do not accidentally release the app to production with the Suitest code included. Suitest code is intended for testing and could impact the user experience of your application.

Content Security Policy

Samsung Tizen supports CSP web standard. Suitest loads instrumentation library from https://*.suite.st domain.

Make sure to configure your CSP to allow loading scripts and data from that domain.

Examples:

Basic:
default-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://*.suite.st wss://*.suite.st; object-src 'none'

For advanced users:
img-src https://*.suite.st; script-src https://*.suite.st 'unsafe-eval' 'unsafe-inline' blob:; connect-src https://*.suite.st wss://*.suite.st; style-src 'unsafe-inline'; frame-src https://*.suite.st

Read more about CSP on Tizen.

Registering keys to be caught inside an application

Samsung Tizen requires an application to register list of keys you want to catch. Events of pressing keys Left, Up, Right, Down, Enter, and Back are detected automatically, and do not require separate registration (see link 1 and link 2 to Samsung official documentation).

Keep in mind that Suitest will not catch/record a key that is not registered from within an application.

Here is a code snippet to register all supported keys.

const supportedKeys = tizen.tvinputdevice.getSupportedKeys();

for (const supportedKey of supportedKeys) {
    tizen.tvinputdevice.registerKey(supportedKey.name)
}

There is also need to have the following privilege defined in config.xml file.

<tizen:privilege name="http://tizen.org/privilege/tv.inputdevice" />

Uploading package to Suitest

You can upload the package on the configuration page. Suitest will automatically install or update the package on the device as necessary when you try running the app on this device.

If you use Suitest Network API you can also send the package with an API request. Suitest will automatically install or update the package on the device as necessary when you try running the app on this device.

Uploading a .tmg package

Together with a .tmg package Suitest also needs a license in order to be able to install it on the device automatically. Archive a .tmg package and widget.license file together and upload the resulting .zip into Suitest app configuration page.

Setting up Suitestify

Enable Suitestify

  1. On the application settings page you will need to enable Suitestify by checking the Enable Suitestify checkbox.
  2. Make sure application domain name is listed in the Suitestify settings. For example, lets assume that the app is hosted at https://example.com therefore the domain added to the domain list is example.com.
Suitestify with .tmg package

There are extra steps needed for using Suitestify with .tmg package.