Skip to content

testimio/custom-actions-examples

Repository files navigation

custom-actions-examples

This is a repository of custom action steps that work with Testim.io

These are not officially supported by Testim, but rather examples to try and modify to fit your specific test cases.

If you have an idea for a custom action example feel free to submit a GitHub issue.

Initially it includes custom action steps (JavaScript) that we have created for customers. The code can be copied from here and added to a custom step in a Testim test. Instructions on how to use each example are included in the linked file with the JavaScript code needed. Typically it will involve copying the file and code into a custom step, making a change or two to the properties panel, checking your variables, and perhaps pointing to the correct element.

Element Functions

Classes Get - Get an element's class list as a string array

Element(ByText) - Click - Find an element by Text and click it

Element(ByXPath) - Click - Find an element by XPath and click it

Element(ByXPath) - Wait Exists - Wait for an element by XPath to be found in the DOM

Element(ByCSS) - Click - Find an element by CSS and click it

Element Neighbor Click/Select - Find an element by AI/Text/XPath or CSS and optionally a neighboring element based on xpath or relative position

Element Select Text - Select text within an element based on index or substring matches

Element Value Validate - Validate an element's value/text using numeric, statistical or text comparison expressions

Element Computed Style(s) - Validate - Validate a superset/subset of style for an element

Element - Image Capture-Validate - Capture an image of a DOM element and optionally validate

isEnabled - Vaildate that an element is enabled (or disabled)

isVisible - Vaildate that an element is visible

Element - Wait Not Visible - Wait for an element to optionally display and then to be hidden.

isPlaying - Validate that a video/media element is currently playing video (or not)

hasAttribute - Validate that an element does/does not have an attribute defined and optionally validate its value

hasClass - Check if an element's class list includes certain expected classes

Checkbox - Check - Check/Uncheck/Toggle a checkbox. Supports custom checkbox controls and states (some assembly required)

Checkbox - Validate Checked - Validate a checkbox is checked/unchecked.


OCR Functions

OCR - Element Text Get - Read text from an element's image

OCR - Element Text validate - Read/validate the text from an element's image


Data Generation, Encryption and Redaction

Excel - Import Data - Process Excel download file and save sheet data values as test data variable (testData)

Excel - Import File - Read Excel file for use as test data variable (excelData)

Generate Faked Data (faker.js) - Uses the faker.js library to create fake test data.

Redact data - This custom step creates an overlay element to prevent screenshot capture of private data.

Set Text (Redacted) - Redacts a field and then sets its text

Set Text Encrypted(Reference) - Use encrypted test data to set a text field (optionally redact field to protect PII from screenshots

Text Encrypt (Reference) - Encrypts plain text for use by "Set Text Encrypted" sister step

Environment Variables Get - Get process environment variables

S3 - Bucket Data Get - Retrieve data from an AWS S3 Bucket

S3 - Bucket Data Put - Put data into an AWS S3 bucket


Database Functions

MongoDB Query - Execute a MongoDB Query and return results

MySQL Server Query - Execute a MySQL Query and return results

SQL Server Query - Execute a SQL Server Query and return results

SQL Server - Results Validate - Execute a SQL Server query, validate and return results

JSONDBFS Query - Read/write data from/to local json files on disk using NoSQL query syntax.

Postgres Query - Execute a Postgres DB Query and return results

Oracle Query - Execute an Oracle DB Query and return results

indexedDB - Clear - Clear all ObjectStores from the named indexedDB database


API

AzureDevOps wiQL Query - Execute a wiQL (Work Item Query Language) query in Azure DevOps and return results

AzureDevOps WorkItem Create/Update - Create or Update a Work Item in Azure DevOps

SOAP Request - Execute a SOAP request and return results

graphQL Query - Execute a graphQL Query and return results

API Request - Make an API call and return results to Testim.


PDF Functions

PDF - Download-Process-Validate - Download, parse and optionally validate a PDF document

PDF - Fields/Texts Validate - Validates text blocks and fields using pdfDocumentTexts and pdfDocumentFields from "Download-Process-Validate PDF" step


Debugging Functions

Debug Popup - Displays in a modal popup window for debugging purposes

Watchlist Popup - Display Testim and User defined variables in a popup window (div)


Browser Functions

Popup Killer - When you don't know when a popup modal will kill your test, use this to handle it.

Alert Override - Overrides the window.alert function to dispaly an alert as a popup div to enable validation of javascript alert

Open New Tab/Window - Open a url in a new tab or window

Cookies Get - Get all cookies and return in currentCookies

Cookies Clear - Clears all cookies

Cookies Session Clear - Clears all cookies, sessionStorage and localStorage

Validate Current URL - Validates the current page's URL

Validate Current Title - Validates the current page's title

Console Log - Override - Override Console Log/Warn/Err/Debug and window onerror to capture all subsequent log output.

Console Log - Validate Text - Validates the console log output captured via "Console Log - Override"


Hook Functions

AfterStep (Hook Function) - Collect step information for AfterTest reporting

AfterStep - Extended (Hook Function) - Collect enhanced step information for AfterTest reporting

AfterTest - Azure Devops (Hook Function) - Create a new or update an existing work item (bug) with test results

After Test Hook - SQL Server (Hook Function) - Collect test results gathered during a test run and insert into a SQL Server database table

After Test Hook - JSONDBFS (Hook Function) - Collect test results gathered during a test run and insert into a JSONDBFS Database Collection (file)


Performance Testing

Transaction Begin - Start a transaction.

Transaction End - End a transaction.

Transaction Summary Report - Log/Report all transactions.

Transaction Summary Report To File - Log/Report all transactions to disk in an HTML format.

Network Performance Checker - Validate that all network requests are completed under maxResponseTime milliseconds.

Network Performance Summary - Creates a summary of network requests with min/max/avg duration and request size.


Test Reporting and Analysis

Testim Test Result Report Generator - Generate Detailed HTML/PDF Test Report(s) with optional screenshots, test data and network summary performance data

AfterStep - Extended (Hook Function) - Collect enhanced step information for AfterTest reporting

After Test Hook - JSONDBFS (Hook Function) - Collect test results gathered during a test run and insert into a JSONDBFS Database Collection (file)

After Test Hook - SQL Server (Hook Function) - Collect test results gathered during a test run and insert into a SQL Server database table

Network Performance Summary - Creates a summary of network requests with min/max/avg duration and request size that can be included in the test report.


Select List Functions

Select List - Items Get - Return items (option/li/custom) from a select/ol/ul/custom element

Select List - Items Select - Select an item by value or text (select/option, ul/li)

Select List - Items Validate - Validate that expected items are in a list/select.

Select List - Items Order Validate - Validate the items (option/li/) from a (select/ol/ul/) element are sorted properly.

Select List - Selected Items Validate - Validate the selected item(s) text, value, misc attribute(s) are correct.


Table Functions

Table - Validate - Validate table cell content

Table - Cells Get - Get all table cell values

Table - Cell Get - Get the content a specific cell within a specific row in a table

Table - Cell Click - Click on a specific cell within a specific row in a table

Table Cell - Set Text - Sets the text of a specific cell within a specific row in a table

Table - Column Order Validate - Validate the values in a column are sorted properly

Table - Row Count Validate - Validate number of rows in a table

Table - Column Sum Validate - Calculate and verify the sum of all numerical values in a specific column

Table - Column Sum Get - Calculate the sum of all numerical values in a specific column


Validation Functions

Link Checker (CLI) - Finds links at the given URL and validates that they are working.

Network Validate Request - Validate that network requests were made and optionally validate response status(es) and/or request(s) are not slower than maxDuration (ms).

Numeric Expression Validate - Validate a value using numeric expressions ">", ">=", "==", "<", "<=".

Email - Validate - Process email inbox and validate/parse last message for subject/body and optional regex to pull specific data and links

Validate Currency - Validate that an element displays an expected value formatted as currency.

Validate HTML Markup - Validates the current page's HTML markup contains certain markup.


Misc Functions

Shell Command Execute - Runs a shell command and returns stdout

Java Executor - Execute a java method/function in a given jar file

Python Program Execute - Execute a Python program and return stdout, exit signal and exit code

Excel365 - Grid Cell Mapping Get - Using Column and Row Headers Get coordinates of visible cells. Can be used with Click and Double Click actions to set cell values.

File Upload - Set File - Create/Set a file upload with custom data.

About

A repository of custom action steps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published