title: Page Object Mode with node, ES7, puppeteer
body: <p>I recently started utilizing Puppeteer for e2e testing (I have some experience with Selenium Web Driver) and I could not find anything in the documentation discussing POM pattern. Are there any examples available how to implement this correctly in node/ES7 within Puppeteer?</p>
  
  <p>Let us say I have a simple script that tests the login functionality of a page:</p>
  
  <pre><code>(async () =&gt; {
  ...
  
       await page.goto(url, {
          timeout: 5000
      });
  
      await page.waitFor('input[id=userId]');
  
      await page.type('input[id=userId]', 'John Doe');
      await page.type('input[id=password]', 'password1');
      await page.click('button[type="submit"]');
      await page.waitFor('p.success-msg');
  ...
  }();
  </code></pre>
  
  <p>Typically, we would have a Page Object Model for the login page. How would I create a basic POM for the above page and integrate it with my script? How would you call the POM in my test script in this environment?  Would I use <code>import</code>?  I am just looking for a basic 'hello world' example.</p>