1.13.9 • Published 7 months ago

puppethelper v1.13.9

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

🧰 puppethelper

A Puppeteer helper package for automated QA web testing.

semantic-release: angular


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
1.13.6

7 months ago

1.13.5

7 months ago

1.13.4

7 months ago

1.13.3

7 months ago

1.13.9

7 months ago

1.13.8

7 months ago

1.13.7

7 months ago

1.13.2

9 months ago

1.13.1

9 months ago

1.13.0

9 months ago

1.12.1

9 months ago

1.12.0

9 months ago

1.11.6

9 months ago

1.11.5

9 months ago

1.11.4

9 months ago

1.11.3

9 months ago

1.11.2

9 months ago

1.11.1

9 months ago

1.11.0

9 months ago

1.10.0

9 months ago

1.9.0

9 months ago

1.8.0

9 months ago

1.7.0

9 months ago

1.6.0

9 months ago

1.5.0

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.3.6

9 months ago

1.3.5

9 months ago

1.3.4

9 months ago

1.3.3

9 months ago

1.3.2

9 months ago

1.3.1

9 months ago

1.3.0

9 months ago

1.2.1

9 months ago

1.2.0

9 months ago

1.1.3

10 months ago