API Documentation

Complete reference for all Cuppet Core modules and functions

🌐

mainFunctions

Core navigation and URL handling functions for web automation.

prepareUrl ASYNC

async prepareUrl(path)

Prepare the URL using configuration to get the domain and generate full or relative paths.

path (string) - The path to prepare, can be relative or absolute URL
Returns: Promise<string> - The prepared URL
const url = await mainFunctions.prepareUrl('/about');
// Returns: 'https://example.com/about'

extractPath SYNC

extractPath(page, absolute = false)

Extract current page URL - absolute or relative.

page (Page) - Puppeteer page object
absolute (boolean) - Set to true for full URL with domain
Returns: string - The extracted path

visitPath ASYNC

async visitPath(page, path)

Navigate to a URL with automatic cookie consent handling if configured.

page (Page) - Puppeteer page object
path (string) - URL path to visit

validatePath SYNC

validatePath(page, path)

Validate that current page URL contains the expected path.

setViewport ASYNC

async setViewport(page, device)

Set viewport size for different devices (mobile, tablet, laptop, etc.).

🎯

elementInteraction

Comprehensive element interaction utilities for web automation.

click ASYNC

async click(page, selector, skip = false)

Click on an element with optional skip functionality.

page (Page) - Puppeteer page object
selector (string) - CSS selector of element to click
skip (boolean) - Skip if element not found

fillField ASYNC

async fillField(page, selector, text, skip = false)

Fill a form field with text.

seeElement ASYNC

async seeElement(page, selector, isVisible = true, time = 3000)

Check if an element is visible or hidden on the page.

uploadFile ASYNC

async uploadFile(page, fileName, selector)

Upload a file using file input element.

selectOptionByValue ASYNC

async selectOptionByValue(page, selector, value, skip = false)

Select dropdown option by value attribute.

💾

dataStorage

Data storage and management utilities for test data persistence.

createFile ASYNC

async createFile()

Create the JSON file for storing test data.

getVariable SYNC

getVariable(variable, stringify = false)

Retrieve a stored variable value from JSON file.

iStoreVariableWithValueToTheJsonFile ASYNC

async iStoreVariableWithValueToTheJsonFile(data, variable)

Store a variable with its value to the JSON file.

saveCurrentPath ASYNC

async saveCurrentPath(page)

Save the current page path to JSON file.

🔧

helperFunctions

Utility functions for common testing operations.

generateRandomString SYNC

generateRandomString(length)

Generate a random string with custom length.

waitForAjax ASYNC

async waitForAjax(page)

Wait until AJAX requests are completed.

getRegion ASYNC

async getRegion(page, region)

Get region element class name from configuration.

🌍

apiFunctions

RESTful API testing capabilities with authentication support.

sendRequest ASYNC

async sendRequest(method, url = '/', headers = {}, data = {})

Send HTTP request with method, URL, headers, and data.

setBasicAuth ASYNC

async setBasicAuth()

Set up basic authentication for API requests.

📱

appiumTesting

Mobile application testing with Appium integration.

clickElement ASYNC

async clickElement(driver, selector)

Click on mobile element using Appium driver.

scrollToElement ASYNC

async scrollToElement(driver, selector)

Scroll to element on mobile device.

accessibilityTesting

Web accessibility testing with Pa11y integration.

validateAccessibility ASYNC

async validateAccessibility(page, path, scenarioName)

Run accessibility tests and generate HTML reports.

🚀

lighthouse

Performance testing with Google Lighthouse integration.

validatePageSpeed ASYNC

async validatePageSpeed(page, path, scenarioName)

Run Lighthouse performance audit and generate reports.

👁️

visualRegression

Visual regression testing with BackstopJS integration.

runBackstopSingleScenario ASYNC

async runBackstopSingleScenario(scenarioName, path, testCommand)

Run BackstopJS visual regression test for а single scenario.

runBackstopMultiplePages ASYNC

async runBackstopMultiplePages(pages, testCommand)

Run visual regression tests for multiple pages.