Methods
(static) addCustomCommand(target, value, commandFunction)
Adds a customed command declared by users.
Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.recorder.start();//start recording
//Record a command
//For example: click at anywhere on the window,
//then you get a ClickAt command
sideex.recorder.stop();//stop recording
console.log(sideex.file.command.get(0));//get the first recorded command
let command = sideex.file.command.get(0);
command.name = "myAction";//rename the command name to "myAction"
console.log(sideex.file.command.get(0));//see the change of the command name
//add a user-defined function for executing "myAction"
sideex.playback.addCustomCommand("myAction", true, (target, value) => {
console.log(target, value);
//define the action here
}
);
sideex.playback.start();//replay the modified recorded commands
Parameters:
Name | Type | Description |
---|---|---|
target |
string | The command's target |
value |
string | The command's value |
commandFunction |
function | The function that tells command what to do. |
(static) findElement(locator) → {Element}
Finds an element by a supported locator.
Parameters:
Name | Type | Description |
---|---|---|
locator |
string | Locator of the element |
Returns:
Element object
- Type
- Element
(static) getClientXY(element, coordString) → {Array.<number>}
Gets the element location.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Element object |
coordString |
string | CoordString |
Returns:
Element's X, Y
- Type
- Array.<number>
(static) pause()
Pauses playback.
Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.playback.start();
sideex.playback.pause();
sideex.playback.resume();
(static) resume()
Resumes playback.
Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.playback.start();
sideex.playback.pause();
sideex.playback.resume();
(static) start(modeopt, idStringopt, speedopt)
Starts playback.
Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
//you should have some test cases or commands first.
//choose a mode to do playback.
sideex.playback.start("all");//play all test suites.
sideex.playback.start("suite");//play the test suite you selected.
sideex.playback.start("case");//play the test case you selected.
sideex.playback.stop();
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
"all" | "suite" | "case" |
<optional> |
"all"
|
The mode to play -- (mode == "all"): Play all the test suites, (mode == "suite"): Play the selected test suite, (mode == "case"): Play the selected test case. |
idString |
string |
<optional> |
selectedCaseId | selectedSuiteId
|
(mode == "all"): test case's id, (mode == "suite"): test suite's id, (mode == "case"): test case's id. |
speed |
number |
<optional> |
The playback speed (1 ~ 5) |
(static) stop()
Stops playback.
Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.playback.start();
sideex.playback.stop();
Type Definitions
commandFunction(target, value)
The function of your own command - declare by yourself.
Parameters:
Name | Type | Description |
---|---|---|
target |
string | The command's target |
value |
string | The command's value |
selectedCaseId
selectedCaseId
- The test case id that is currently selected.
Type:
- string
selectedSuiteId
selectedSuiteId
- The test suite id that is currently selected.
Type:
- string