Test a Widget
Test your widget as you build your document and write request handlers. You can use the authoring tool to preview your widget layout as you build, but you must use a device with a screen to fully test your widget end-to-end.
Preview your widget layout in the authoring tool
The widget authoring tool displays a preview of your widget layout as you work. The preview doesn't have access to a data store. Therefore, you won't see any values for properties bound to the data store in the preview.
To preview a widget in the authoring tool
-
To see the widget by itself, click Widget.
-
To preview the widget relative to a device, click On Device.
-
In the On Device mode, view the size allocated to a widget on different devices.
Preview your widget on a device
When you use the authoring tool to preview a widget on a device, you send the widget to the device and the device displays it in the center of the screen. You can see the size allowed for the widget on that device. This preview doesn't connect to the data store. Therefore, you won't see any values for properties bound to the data store.
To preview a widget on a device from the authoring tool
- In the widget authoring tool, at the bottom of the page, click Preview.
- From the menu, select a device that supports widgets.
- Click Send to Device
Install and test your widget on a device
When you install a widget on a device, you simulate a user installing your widget from the Widget Gallery. This option tests both the widget document and your related request handlers. You can also test running data store commands.
When you use the install option, Alexa installs your widget on the selected device. If the manifest.installStateChanges
property in your APL package manifest is set to INFORM
, Alexa also sends your skill the Alexa.DataStore.PackageManager.UsagesInstalled
request. After your widget installs, view it in the Widget Panel on the device or tap the shortcut to display the widget. With this testing option, the widget can access the data store on the device. You can test the Data Store REST API and all interactions between the widget and your skill. You can also send updates to the data store on the device. For details about using the Widget Panel, see What Are Alexa Widgets?.
To install a widget on a device from the authoring tool
- Implement your request handler for the
Alexa.DataStore.PackageManager.UsagesInstalled
request, if applicable. - In the widget authoring tool, at the bottom of the page, click Install.
- From the menu, select a device that supports widgets.
- Click Send to Device
If your widget uses the data store, you can test the data store with the authoring tool after you install the widget.
Test the data store from the authoring tool
- Install the widget on a device as described earlier.
-
In the widget authoring tool, at the bottom of the page, click Install.
The Preview option doesn't support the data store. You must install the widget on the device to test the data store.
- Click Update Datastore.
- Replace the Data in the dialog box with an array of data store commands you want to run.
- Click Send to Datastore to send the commands to the device.
For details about the data store commands, see Data store commands.
Related topics
Last updated: Feb 29, 2024