Skip to main content
Version: 8.0.2

Util actions

eval

Method allowing to interact in client context.

ParameterTypeDescription
fnfunction
argfunction

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.

ParameterTypeDescription
fnfunction
argfunction

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.

ParameterTypeDescription
fnfunction
argfunction
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.

ParameterTypeDescription
timeoutnumberTime duration in milliseconds.

waitForCondition

Method allowing to wait for a certain amount of time until a condition is met.

ParameterTypeDescription
optionsWaitForConditionOptionsMethod options.

options

ParameterTypeDescription
conditionbooleanCondition to fulfill. Condition is fulfilled when it equals true.
intervalnumberTime interval between retries in milliseconds.
timeoutnumberTimeout of the method.
retriesnumberNumber of retries.
backoffFIXED / EXPONENTIAL / LINEARValue used to determine the wait time between successive retries.
throwOnErrorbooleanIf true, the code throws an error.
maxBackOffnumberMaximum value rof the backoff.
errorMessagestringError message.
overrideErrorMessagestringOverride the Test Maker error message.
retryMessagestringRetry message.

waitForSelectorToExist

Method allowing to wait for a selector to exist.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.

waitForSelectorToNotExist

Method allowing to wait for a selector to cease to exist.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.

waitForSelectorToBeVisible

Method allowing to wait for a selector to be visible.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.

waitForSelectorToBeInvisible

Method allowing to wait for a selector to be invisible.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.

waitForSelectActionabilityCheck

Method allowing to check the state attributes of a selector.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.
checksActionabilityCheckTypes[]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.

ParameterTypeDescription
selectorselectorTypeSelector of the targeted element.
optionsWaitFrameToLoadOptionsWaitFrameToLoadOptionss.

WaitFrameToLoadOptions

ParameterTypeDescription
condition"readyStateComplete" / "domContentLoaded" / "loaded" / "src"Selector of the targeted element.
ignoreSrcboolean
childSelectorstring

waitForVisualState

Method allowing to wait for specific visual state.

ParameterTypeDescription
waitForVisualStateOptionsWaitForVisualStateOptions

WaitForVisualStateOptions

ParameterTypeDescription
baseImagePathstring / (() => Promise<string>)Reference image path.
testImagePathstring / (() => Promise<string>)Image path to compare with reference image.
diffImagePathstring / (() => Promise<string>)Path of the generated difference image .
mismatchThresholdnumberMismatch threshold.
retryOptionsWaitForConditionOptions

returns WaitForVisualStateResult

WaitForConditionOptions

ParameterTypeDescription
intervalnumberTime interval between retries in milliseconds.
timeoutnumberTimeout of the method.
retriesnumberNumber of retries.
backoffFIXED / EXPONENTIAL / LINEARValue used to determine the wait time between successive retries.
maxBackOffnumberMaximum value of the backoff.
errorMessagestringError message.
overrideErrorMessagestringOverride the Test Maker error message.
retryMessagestringRetry message.

debugger

Method allowing to enter debugger mode.

takeScreenshot

Method allowing to take a screenshot.

ParameterTypeDescription
pathstringStorage path of the screenshot.
optionsobjectMethod options.

options

ParameterTypeDescription
fullPagebooleanApply to full page.

takeSelectorScreenshot

Method allowing to take a selector screenshot.

ParameterTypeDescription
selectorselectorTypeSelector of targeted the element.
pathstringStorage path of the screenshot.

recordVideo

Method allowing to record video.

ParameterTypeDescription
optionsRecordVideoOptions

RecordVideoOptions

ParameterTypeDescription
pathstringVideo storage path.
qualitynumberVideo quality.
widthnumberVideo width.
heightnumberVideo height.
extraOptionsstring / anyOptions.

returns

ParameterTypeDescription
idstringVideo 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');

addMetaData

Method allowing to add MetaData to the report.

ParameterTypeDescription
metadataRecord<string, any>Enter the metadata that should be added to the report.

Usage example

Note that metadata do not show in reporter unless you prefix it with "reporter:". Since metadata are generic metadata they can be used for anything and not just reporter.

const metadataValue = "This is the metadata"
await I.addMetaData(
{
"reporter:metaDataTitle":metadataValue
}
)

addReporterAttachment

Method allowing to add an attachment to the report.

ParameterTypeDescription
{ name, content, path, mimeType }{ name?: string; content?: Buffer / string; path?: string;, mimeType: AttachmentTypes; }Enter the optional name, content and path of your attachment and enter the type of file.

AttachmentTypes

string | 'text/plain' | 'text/html' | 'application/xml' | 'text/csv' | 'text/tab-separated-values' | 'text/css' | 'text/uri-list' | 'image/svg+xml' | 'application/json' | 'video/mp4' | 'video/webm' | 'image/jpeg' | 'image/png';

addScreenshotReporterAttachment

Method allowing to attach a screenshot to the report.

ParameterTypeDescription
{ title, filepath }{ title?:string; filepath:string }Enter the optional title of your screenshot attachment enter the screenshot file path.

Usage example

 await I.addScreenshotReporterAttachment({ title: `Attached Screenshot`, filePath: `./dist/attachedScreenshot/${Date.now()}.jpg` });

addImageReporterAttachment

Method allowing to attach an image to the report.

ParameterTypeDescription
{ title, filepath }{ title?:string; filepath:string }Enter the optional title of your image attachment and enter the image file path.

Usage example

  await I.addImageReporterAttachment({ title: 'imgReporterTest', filePath: `./src/assets/images/base_image.jpg` });

addTextReporterAttachment

Method allowing to attach text to the report.

ParameterTypeDescription
{ title, content }{ title?:string; filepath:string }Enter the optional title of your text attachment and enter the text content.

Usage example

 await I.addTextReporterAttachment({ title: 'imgReporterTest', content: `My testing test` });

addHtmlReporterAttachment

Method allowing to attach html to the report.

ParameterTypeDescription
{ title, content }{ title?:string; content:string }Enter the optional title of you html attachment and enter the html content.

Usage example

 await I.addHtmlReporterAttachment({ title: 'htmlReporterTest', content: `<td>My test Codel</td>` });