Puppetry
3.2.2
3.2.2
  • Welcome Puppetry
  • Getting Started
  • Project
  • Suite
  • Group
  • Target
    • Simple Target
    • iFrame Target
    • ShadowDOM Target
    • Chained Target
    • Shared Target
  • Test Case
  • Test Step / Action
    • Page Commands
    • Page Assertions
    • Target Commands
    • Target Assertions
  • Managing Records
  • Snippets
  • Running tests
    • Interactive Mode
    • Troubleshooting
  • Test Report
  • Export
    • Exporting as Jest Project (CI-friendly)
    • Exporting as Test Specification
  • Settings
  • Template Expressions
  • Testing Techniques
    • Testing Dynamic Content
    • Exhaustive Testing
    • Performance Testing
    • Visual Regression Testing
    • Testing Shadow DOM
    • Testing Google Analytics tracking code
    • Testing Chrome Extensions
    • Testing REST API
    • Mocking HTTP/S Requests
    • Testing Transactional Emails
      • Example with Restmail.net
      • Example with Mailinator
      • Example with IMAP bridge
      • Example with Google API
    • Testing Forms with Captcha
  • Version Control
  • Tips and Tricks
    • Embrace the Power of CSS
  • Command API
  • Test Application
Powered by GitBook
On this page
  • page.assertTitle
  • page.assertUrl
  • page.assertContent
  • page.assertNodeCount
  • page.assertScroll
  • page.assertVar
  • page.assertScreenshot
  • page.assertRest
  • page.assertResponse
  • page.assertConsoleMessage
  • page.assertDialog
  • page.assertPerformanceAssetWeight
  • page.assertPerformanceAssetCount
  • page.assertPerformanceTiming
  • page.assertGaTracking

Was this helpful?

  1. Test Step / Action

Page Assertions

PreviousPage CommandsNextTarget Commands

Last updated 5 years ago

Was this helpful?

page.assertTitle

Asserts that the page title satisfies the given constraint

page.assertUrl

Asserts that the page URL satisfies the given constraint

page.assertContent

Asserts that the page content (HTML) satisfies the given constraint

page.assertNodeCount

Asserts that number of elements matching a specified selector satisfies the given constraint

page.assertScroll

page.assertVar

Asserts that variable associated with a given name satisfies the given constraint

page.assertScreenshot

Asserts that screenshot of the page matches already approved one

page.assertRest

Makes HTTP/S request and asserts that the response satisfies the given constraint.

The method automatically assigns the response text data to template variable PUPPETRY_LAST_RESPONSE_TEXT

page.assertResponse

Asserts that the HTTP/S response satisfies the given constraint

page.assertConsoleMessage

Asserts there were (no) console messages sent to console to satisfy the given constraint

page.assertDialog

Asserts there was called a dialog (alert, beforeunload, confirm or prompt).

page.assertPerformanceAssetWeight

Asserts that total weight of assets (JavaScript, CSS, images, media, fonts, XHR) on the page satisfies the given budget.

This assertion makes Puppetry to intercept HTTP requests. It compares the given limits to the encoded length of the requests. Note that the request length is considered 0 when request loaded from cache. So it makes sense to place this step next to the very first page.goto in the test suite.

page.assertPerformanceAssetCount

Asserts that total number of requested assets (JavaScript, CSS, images, media, fonts, XHR) on the page satisfies the given budget.

page.assertPerformanceTiming

page.assertGaTracking

Asserts that offset satisfies the given constraint

Asserts a given under a provided budget

Asserts a given action was sent to Google Analytics with or . We also assert that sent payloads are valid according to the Google API

window scroll
resource timing
analytics.js
gtag.js
page.assertTitle
page.assertUrl
page.assertContent
page.assertNodeCount
page.assertScroll
page.assertVar
page.assertScreenshot
page.assertScreenshot advanced options
page.assertRest
page.assertResponse
page.assertConsoleMessage
page.assertDialog
page.assertPerformanceAssetWeight
page.assertPerformanceAssetCount
page.assertPerformanceTiming
page.assertGaTracking