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

Was this helpful?

  1. Testing Techniques

Testing Dynamic Content

PreviousTesting TechniquesNextExhaustive Testing

Last updated 5 years ago

Was this helpful?

Usually the pages under test have dynamic content. For example we are testing news page and assert that first news title is “Puppetry 3 is out”. But as soon as anybody adds a new story our tests are to fail. What we can do is to use page.assignVar method to extract actual content (e.g. news title) from the page and make assertions on it. Consider the following example:

News page has search filtering by tags. If one click on a tag the news listing gets filtered for the stories associated with the tag. So we create a variable VAR_ARTICLE1_TITLE, which takes-in HTML of ARTICLE1_TITLE target that corresponds to the element representing title of the first story.

We send click on a tag, waiting until the request for listing update complete and assert that the first story title (ARTICLE1_TITLE) changed, meaning the news list updated.

Similarly you can make your test case waiting until a particular image fully loaded. So you extract image URL from src attribute and wait for response including that URL.

If the endpoint has redirections, the response will have URL different from one set with src attribute and therefore the approach won’t work.

Extracting actual news title from the page
Testing dynamic content
Waiting for image to load