puppethelper v1.13.9
🧰 puppethelper
A Puppeteer helper package for automated QA web testing.
Functions:
clear(page: Page, selector: string)
Clears a text field using Document's querySelector()
function.
clearManual(page: Page, selector: string, attribute: string = 'value')
Clears a text field by simulating user input of pressing the Backspace key.
click(page: Page, selector: string, timeout: number = 30)
Clicks on an element by utilizing the waitForSelector()
function and Puppeteer's Page.click()
function.
executeCommand(command: string, password?: string)
expectAttribute(page: Page, selector: string, attribute: string, value: string, timeout: number = 30)
Expects a selector's attribute to be of a specified value by utilizing the waitForSelector()
function, the getAttribute()
function and Chai's expect()
function.
expectText(page: Page, selector: string, text: string, timeout: number = 30)
Expects a specified text within an element based on the provided CSS selector by utilizing the waitForSelector()
function, the getText()
function and Chai's expect()
function.
getAttribute(page: Page, selector: string, attribute: string)
getText(page: Page, selector: string)
randomInt(min: number = 0, max: number = 9)
Generates a random integer within a specified range by utiizing the Math.random()
function.
timeout(seconds: number = 5)
type(page: Page, selector: string, text: string, timeout: number = 30)
Types a string into a text field by utilizing the waitForSelector()
function and Puppeteer's Page.type()
function.
waitForSelector(page: Page, selector: string, timeout: number = 30)
Waits for a element to be loaded by checking its presence every 500ms until a timeout period has elapsed.
Errors:
CustomError
SelectorNotFound
Constants:
BROWSER_OPTS
const BROWSER_OPTS: {headless: HeadlessOption, slowMo: number, devtools: boolean, executablePath: string} = {
headless: 'new',
slowMo: 1,
devtools: false,
executablePath: '/usr/bin/chromium-browser',
}
PAGE_OPTS
const PAGE_OPTS: {DEFAULT_TIMEOUT: number} = {
DEFAULT_TIMEOUT: 30000,
}
Scripts:
custom-mocha-spec-reporter.js
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago