Util actions
eval
Method allowing to interact in client context.
Parameter | Type | Description |
---|---|---|
fn | function | |
arg | function |
Usage example
await I.eval(() => {
console.log(`hello from client`);
})
evalInCurrentWindowMainFrame
Method allowing to interact in client context inside the main frame of the current window.
Parameter | Type | Description |
---|---|---|
fn | function | |
arg | function |
Basic Usage
const elementSelector = `myElementID`;
await I.evalInCurrentWindowMainFrame((element)=> {
return document.getElementById(element).innerText
},
elementSelector
);
evalInAllFrames
Method allowing to interact in client context inside all frames.
Parameter | Type | Description |
---|---|---|
fn | function | |
arg | function |
const elementSelector = `myElementID`;
await I.evalInAllFrames((element)=> {
return document.getElementById(element).innerText
},
elementSelector
);
getClientInfo
Method allowing to retrieve client information.
Client information
name: string;
version: string;
headless: boolean;
platform: string;
userAgent: string;
prettyUserAgent: string;
type: `mobile` | `web` | `desktop` | `unit`;
engine: {
name: string;
version: string;
};
os: {
name: string;
version: string;
};
wait
Method allowing to wait for a certain amount of time.
Parameter | Type | Description |
---|---|---|
timeout | number | Time duration in milliseconds. |
waitForCondition
Method allowing to wait for a certain amount of time until a condition is met.
Parameter | Type | Description |
---|---|---|
options | WaitForConditionOptions | Method options. |
options
Parameter | Type | Description |
---|---|---|
condition | boolean | Condition to fulfill. Condition is fulfilled when it equals true . |
interval | number | Time interval between retries in milliseconds. |
timeout | number | Timeout of the method. |
retries | number | Number of retries. |
backoff | FIXED / EXPONENTIAL / LINEAR | Value used to determine the wait time between successive retries. |
throwOnError | boolean | If true, the code throws an error. |
maxBackOff | number | Maximum value rof the backoff. |
errorMessage | string | Error message. |
overrideErrorMessage | string | Override the Test Maker error message. |
retryMessage | string | Retry message. |
waitForSelectorToExist
Method allowing to wait for a selector to exist.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
waitForSelectorToNotExist
Method allowing to wait for a selector to cease to exist.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
waitForSelectorToBeVisible
Method allowing to wait for a selector to be visible.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
waitForSelectorToBeInvisible
Method allowing to wait for a selector to be invisible.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
waitForSelectActionabilityCheck
Method allowing to check the state attributes of a selector.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
checks | ActionabilityCheckTypes[] | Actionability check types. |
ActionabilityCheckTypes[]
ActionabilityCheckTypes = `attached` | `stable` | `visible` | `enabled` | `editable`;
Basic Usage
await I.waitForSelectActionabilityCheck("mySelector", [`enabled`])
waitForFrameToLoad
Method allowing to wait for a frame to load.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of the targeted element. |
options | WaitFrameToLoadOptions | WaitFrameToLoadOptionss. |
WaitFrameToLoadOptions
Parameter | Type | Description |
---|---|---|
condition | "readyStateComplete" / "domContentLoaded" / "loaded" / "src" | Selector of the targeted element. |
ignoreSrc | boolean | |
childSelector | string |
waitForVisualState
Method allowing to wait for specific visual state.
Parameter | Type | Description |
---|---|---|
waitForVisualStateOptions | WaitForVisualStateOptions |
WaitForVisualStateOptions
Parameter | Type | Description |
---|---|---|
baseImagePath | string / (() => Promise<string>) | Reference image path. |
testImagePath | string / (() => Promise<string>) | Image path to compare with reference image. |
diffImagePath | string / (() => Promise<string>) | Path of the generated difference image . |
mismatchThreshold | number | Mismatch threshold. |
retryOptions | WaitForConditionOptions |
returns
WaitForVisualStateResult
WaitForConditionOptions
Parameter | Type | Description |
---|---|---|
interval | number | Time interval between retries in milliseconds. |
timeout | number | Timeout of the method. |
retries | number | Number of retries. |
backoff | FIXED / EXPONENTIAL / LINEAR | Value used to determine the wait time between successive retries. |
maxBackOff | number | Maximum value of the backoff. |
errorMessage | string | Error message. |
overrideErrorMessage | string | Override the Test Maker error message. |
retryMessage | string | Retry message. |
expect
Method allowing to assert a value.
Parameter | Type | Description |
---|---|---|
actual | any | |
options | AssertOptions | Method options. |
expectSelector
Method allowing to assert a selector property.
debugger
Method allowing to enter debugger mode.
takeScreenshot
Method allowing to take a screenshot.
Parameter | Type | Description |
---|---|---|
path | string | Storage path of the screenshot. |
options | object | Method options. |
options
Parameter | Type | Description |
---|---|---|
fullPage | boolean | Apply to full page. |
takeSelectorScreenshot
Method allowing to take a selector screenshot.
Parameter | Type | Description |
---|---|---|
selector | selectorType | Selector of targeted the element. |
path | string | Storage path of the screenshot. |
recordVideo
Method allowing to record video.
Parameter | Type | Description |
---|---|---|
options | RecordVideoOptions |
RecordVideoOptions
Parameter | Type | Description |
---|---|---|
path | string | Video storage path. |
quality | number | Video quality. |
width | number | Video width. |
height | number | Video height. |
extraOptions | string / any | Options. |
returns
Parameter | Type | Description |
---|---|---|
id | string | Video id. |
pause | () => Promise<void> | |
resume | () => Promise<void> | |
stop | () => Promise<void> |
emulateNetworkConditions
Method allowing to emulate network conditions.
getClientLogs
Method allowing to retrieve the client log information.
getScrollPosition
Method allowing to retrieve the scroll position.
Usage example
let scrollPosition = await I.getScrollPosition();
getTitle
Method allowing to retrieve the title of the window.
Usage example
await I.goto('http://my-website-url.com');
let title = await I.getTitle();
await I.expect(title).toEqual('Website title');
getSource
Method allowing to retrieve page source code.
Usage example
await I.goto('http://the-internet.herokuapp.com/abtest');
let pageSource = await I.getSource();
await I.expect(pageSource).toContain(`A/B Test`);
getCurrentUrl
Method allowing to retrieve the current URL.
Usage example
await I.goto('http://my-website-url.com');
let currentUrl = await I.getCurrentUrl();
await I.expect(currentUrl).toEqual('http://my-website-url.com');
addReporterAttachment
Method allowing to add an attachment to the report.
addScreenshotReporterAttachment
Method allowing to attach a screenshot to the report.
Usage example
await I.addScreenshotReporterAttachment({ title: `Attached Screenshot`, filePath: `./dist/attachedScreenshot/${Date.now()}.jpg` });
addImageReporterAttachment
Method allowing to attach an image to the report.
Usage example
await I.addImageReporterAttachment({ title: 'imgReporterTest', filePath: `./src/assets/images/base_image.jpg` });
addTextReporterAttachment
Method allowing to attach text to the report.
Usage example
await I.addTextReporterAttachment({ title: 'imgReporterTest', content: `My testing test` });
addHtmlReporterAttachment
Method allowing to attach html to the report.
Usage example
await I.addHtmlReporterAttachment({ title: 'htmlReporterTest', content: `<td>My test Codel</td>` });