The offset for the action point. It should be a 2-elements array with either exact offsets (number) or "offset expressions" (string).
The expression consists from "percentage" part and optional "fixed" part and should have the following syntax:
'25%'
'50% + 10'
'50% - 10'
Overall, it may look like this:
[ 10, '50% + 10' ]
Note, that '100%' offset corresponds to the 1st point outside of the element's dimension, to specify the right/bottom-most element's point as an offset, provide it as:
[ '100% - 1', '100% - 1' ]
The options object for the firesOk assertion
Description for the assertion.
The period of time during which the events are counted. It can be:
async
, in this case, don't forget to await
on the firesOk call itself)An object with the events to count. The keys of the object corresponds to the event names. The values - to the expected number of that event. The value can be either a number indicating the exact expected events number, or a string, with the "expected number expression".
The expression consists from the comparison operator and number:
'> 5'
'<= 1'
'== 3'
The observable, on which to count the fired events. The exact meaning of the "observable" depends from the
environment, for example in browsers it is an instance of EventTarget
interface and in Node.js - EventEmitter
class.
In general "observable" is whatever the resolveObservable method accepts as the 1st argument.
The options object for the keyboard action
Set to true
to simulate Alt
keypress during the action
Whether to clear any existing text in the target <input>/<textarea>
element before typing.
Set to true
to simulate Ctrl
keypress during the action
Delay between the individual key down / key up events. By default 0 (no delay)
Set to true
to simulate Meta
keypress during the action
Set to true
to simulate Shift
keypress during the action
The target element to type at
The text to type.
Maximum time for the target element to become actionable.
The options for mouse action
When waiting for the target to become actionable, one of the checks that element needs to pass is "reachable". It defines that the action point should be directly reachable by the user (be the top-most and not covered with other elements). This setting defines whether to allow that point to be covered with child element of the target.
Default is true
.
Set to true
to simulate Alt
keypress during the action
Set to true
to simulate Ctrl
keypress during the action
Set to true
to simulate Meta
keypress during the action.
Mouse move precision to use, when moving the mouse cursor from its current location to the target point.
Offset for the action. If not provided, the action happens in the center of the visible part of the target element.
Set to true
to simulate Shift
keypress during the action
The target of the action.
The maximum time to wait for target to become actionable. By default its taken from the TestDescriptor.defaultTimeout
This type represent a 2-dimensional point, as a tuple (array with 2 elements)
Union type, that describes the precision of the pointer movement. It defines how many mousemove/pointermove
events
will be fired for the mouse move actions. This also includes moving cursor the target point for other actions,
like TestBrowser.click and similar.
The kind
options are:
fixed
- The fixed amount of mousemove
events will be fired, divided equally along the path.
For example, if precision
is 3, 3 mouse move events will be fired - 1 at the beginning, 1 at the middle and 1
at the end of the path.every_nth
- Simulate a mousemove
event every N-th point along the path.
For example, if precision
is 3 and the path is 10 pixels long, mousemove
events will be simulated
for 1st, 4th, 7th and 10th pixels. mousemove
is always simulated for the last point.first_and_last
- Simulate a mousemove
event for the precision
number of points in the beginning and the end
of path. For example, if precision
is 2 and the path is 10 pixels long, mousemove
events will be simulated
for 1st, 2nd, 9th and 10th pixels.last_only
- Simulate a mousemove
event for the precision
number of points at the end
of path. For example, if precision
is 2 and the path is 10 pixels long, mousemove
events will be simulated
for 9th and 10th pixels.The special case of number
is equivalent to every_nth
kind.
Having precise control over the mousemove
simulation might be important for certain drag and drop implementations,
which relies on at least 2 mousemove
events fired on the drop target.
A preload descriptor describes what resources should be loaded into the test page, before starting the test. It can point to JavaScript or CSS resource, or can provide it inline.
Preload descriptor can be:
{ type : 'js', url : string, isEcmaModule? : boolean }
, pointing to the JavaScript file.
If the file contains Ecma module, the isEcmaModule
flag should be set to true
{ type : 'js', content : string, isEcmaModule? : boolean }
, providing the inline JavaScript content.
If the content represents an Ecma module, the isEcmaModule
flag should be set to true
{ type : 'css', url : string }
, pointing to the CSS file.{ type : 'css', content : string }
, providing the inline CSS content..css
it corresponds to { type : 'css', url : string }
,
otherwise it corresponds to { type : 'js', url : string, isEcmaModule : false }
{ code : string | Function }
, which corresponds to { type : 'js', content : string, isEcmaModule : false }
.
If the code
property is provided as a Function
it will be stringified with .toString()
call.{ style : string }
, which corresponds to { type : 'css', content : string }
.null
, undefined
, empty string etc. It will be ignoredThe last 2 cases allows simple conditional preloading, for example:
preload : [
'http://mydomain.com/file1.js'
{
code : 'MySpecialGlobalFunc = () => { if (typeof console != "undefined") ... }'
},
// simple conditional preload
someCondition ?
[
'http://mydomain.com/file2.css',
'http://mydomain.com/file3.js'
]
:
null
],
Generated using TypeDoc
This union type represent action target for various user-action simulation methods.
It can be:
Element
string
, which contains a CSS query to be resolved. The onAmbiguousQuery config controls the behavior if a query is resolved to multiple elements.For example: