Qt Model

In CukeTest, most of the automation objects related to Qt are in the leanpro.qt module, which contains the following two classes:

  1. QtModel: used to load model files, drag the model to the code to automatically load;
  2. QtAuto: A library related to the implementation of Qt automation;

All the methods listed below are synchronous methods and do not require await.

QtModel

Quoting from the leanpro.qt module, used for citation can be written as follows:

const {QtModel} = require('leanpro.qt');

Drag the model directly from the Explorer view to the code to save a lot of effort.

loadModel(modelPath): IQtModel

Load the model from the model file. The model provides automated APIs for various controls.

  • modelPath: string type, the path of the model file.
  • Return value: IQtModel type, model class, including all kinds of [Get Object API] (/qt/linux/node_api/node_operations.md).

QtAuto

Quoted from the leanpro.qt module, the quote can be written as follows:

const {QtAuto} = require('leanpro.qt');

QtAuto is used for the following aspects:

Qt automation timeout

Every Qt automated operation has a timeout period. If the operation takes longer than this time, a timeout error will be reported. The default timeout period in CukeTest is 10 seconds.

defaultTimeout: number

Get the current timeout setting. The unit is ms, so the default value returned is 10000.

setDefaultTimeout(miliSeconds)

Set the timeout period, the unit is ms.

  • miliSeconds: number type, timeout period.

Operate the Qt application

Used to start Qt applications and get information about Qt applications.

launchQtProcess(exePath, args)

Start a Qt application, usually used to start the application under test. It needs to be distinguished from the launchProcess() method of launching ordinary applications, because the launchQtProcess() method will automatically add variable values ​​to the launch command to load Qt Agent, and only the Qt Agent is loaded to perform automation.

  • exePath: string type, application path.
  • args: string[] type, parameters when running the application, such as cuketest --runjs test.js in this command, the latter two are the parameters, written as args to pass parameters in the form of ["- -runjs", "test.js"].

getApplication(appName): IQApplication

Obtain the automation object of the target application, which can be used for automation operations.

  • appName: string type, the name of the Qt application.

Chinese version click here.

results matching ""

    No results matching ""