The Mini Program Development Tools simulates the WeChat client. It is limited by differences between desktop and mobile devices, as well as certain special WeChat data. At the same time, for the convenience of development, some APIs are different on the tool from them on WeChat.

Code scanning interface

Calling the camera to scan codes in debugging on PC or Mac can achieve very little, which is different from calling the camera to scan codes on mobile devices. Therefore, after calling the API for scanning QR codes on the development tool, the developer can select a local image for subsequent logic debugging, instead of actually activating the camera to scan codes. These processes are different, but the interface input and output are consistent.

WeChat Pay

The latest version of development tool already supports WeChat payment debugging, but for security, it is different from directly calling WeChat payments on mobile devices:

  • Newly bound developers need to wait for 24 hours before getting the permissions to conduct WeChat payment debugging
  • After the developer calls the WeChat payment API on the development tool, a QR code will appear, the developer has to use the current WeChat ID used for development to scan the code and complete the payment process on the phone
  • The tool will sync the mobile end's WeChat payment return package to the tool, then the developer can conduct the desired subsequent operations

Usage interaction is different, but the input/output tools of the interface is kept consistent with that of the client.

Enable use of custom parameters

During routine usage, the user open a Mini Program via code-scanning or sharing, and depending on the launch page set: path Jump to the corresponding Mini Program page (not necessarily the main page). Parameter query may be carried. Within the developer tool, the developer can also debug different launch pages and parameters through customizing compiled conditions.

For example, the following image shows the page selected to be entered is page/API/index, parameter is name=can

argsargs

Entering scenario values

In the WeChat client, the user may open Mini Programs Details under various scenarios, however, the developer tool does not have the actual environments to simulate these scenarios. The developer can debug various scenarios through conditions compilation.

sencesence

General Forwarding

Calling forwarding on the developer tools is a simulated action, nothing is actually forwarded to users. The development process can use this simulation action to ascertain whether the forwarding API was correctly called.

Forwarding that contains shareTicket

Forwarding that contains shareTicket can retrieve more forwarding messages, e.g. name of group chats and group identities openGId. The developer can use the following methods on the development tool to call forwarding that contains shareTicket.

When calling wx.showShareMenu, if the parameter withShareTicket is true, tapping the forward button that appears after tapping the top right corner menu of the simulator will bring out a test group list, as illustrated:

withShareTicketwithShareTicket

By tapping to select any group, the developer can retrieve shareTicket using the return package of the interface, and information related to forwarding by calling wx.getShareInfo

When the developer needs to debug opening from a particular group, and when the scenario has shareTicket, 1044:``Mini Program message card in group chat session (with shareTicket) in the custom compilation can be used while any mode can be selected to test the group, as illustrated

withShareTicketwithShareTicket

Preview conditions for using custom compilations

As described in Enable use of custom parameters , when submitting previews, the developer can debug different launch pages and parameters through custom preview. We can select custom compilation conditions already created to conduct previews.

Debug support for Mini Program redirecting

The debugging of Mini Program redirecting can be divided into 2 parts

Debugging the Mini Program if it redirects correctly

For security considerations regarding Mini Program codes, when the tool calls wx.navigateToMiniProgram, the developer tool will not actually be opened and redirected to another Mini Program, but the tool will ascertain the binding relationship between the current Mini Program and the Mini Program to be redirected to. Related information will be output to the developer. The developer can ascertain if calling is successful according to successful or unsuccessful call parameters.

Debug correct receiving of parameters when the Mini Program is opened

Select Custom compilation to enter scenario selection 1037 By entering from the Mini Program, debugging can be done on the Mini Program on whether it received and correspondingly handled correct parameters when it was opened.

navigateToMiniProgramnavigateToMiniProgram

Select Custom compilation to enter scenario selection 1038 By returning to from the Mini Program, debugging can be done on the Mini Program on whether it received and correspondingly handled correct parameters when it returned.

navigateToMiniProgramnavigateToMiniProgram