Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Browser Automation Testing

derek-b
June 05, 2018
220

Browser Automation Testing

derek-b

June 05, 2018
Tweet

Transcript

  1. Derek Binkley @DerekB_WI Who Am I? • Derek Binkley •

    @TurnTo networks • Married, 2 daughters, 1 son
  2. Derek Binkley @DerekB_WI What Are We Doing? • Automate a

    browser • Try out a site/application • Validate functionality
  3. Derek Binkley @DerekB_WI Headless Chrome • June 2017 • Full

    browser • Chrome Dev Tools • No GUI
  4. Derek Binkley @DerekB_WI Install • npm init • npm i

    —save mocha chai • npm i --save puppeteer • Add test script to package.json
  5. Derek Binkley @DerekB_WI Basics • Test Defined as JavaScript •

    Full Access to DOM • Assertions using Chai • Run using Mocha
  6. • Try out some pdf options of your own •

    https:/ /github.com/GoogleChrome/puppeteer/blob/ master/docs/api.md#pagepdfoptions
  7. Derek Binkley @DerekB_WI Experiment Further const context = await browser.createIncognitoBrowserContext();

    page.focus(‘#myselector’) page.mouse.move(x, y, [options]) page.mouse.click(x, y, [options]) page.keyboard.press(‘Tab’) page.touchscreen.tap(x, y) https:/ /github.com/GoogleChrome/puppeteer/blob/master/docs/api.md
  8. Derek Binkley @DerekB_WI Resources • https:/ /developers.google.com/web/updates/2017/06/headless-karma-mocha-chai • https:/ /medium.com/@ankit_m/ui-testing-with-puppeteer-and-mocha-part-1-

    getting-started-b141b2f9e21 • https:/ /github.com/GoogleChrome/puppeteer • https:/ /github.com/checkly/puppeteer-examples • https:/ /puppeteersandbox.com/ • https:/ /groups.google.com/forum/m/#!topic/phantomjs/9aI5d-LDuNE • Photos courtesy of https:/ /www.flickr.com/photos/internetarchivebookimages • https:/ /medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium- ghostjs-autogcd-ef34bcd26907