All Projects → CodementorIO → puppeteer-jest-starter

CodementorIO / puppeteer-jest-starter

Licence: other
A starter-kit quipped with the minimal requirements for Puppeteer + Jest, making E2E testing a breeze.

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to puppeteer-jest-starter

Express Typescript Boilerplate
A delightful way to building a RESTful API with NodeJs & TypeScript by @w3tecch
Stars: ✭ 2,293 (+13388.24%)
Mutual labels:  e2e-tests, starter-kit
aurelia-typescript-boilerplate
A starter kit for building a standard navigation-style app with Aurelia, typescript and webpack by @w3tecch
Stars: ✭ 18 (+5.88%)
Mutual labels:  e2e-tests, starter-kit
phantom-lord
Handy API for Headless Chromium
Stars: ✭ 24 (+41.18%)
Mutual labels:  e2e-tests, puppeteer
Root Cause
🔍 Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. 🔎
Stars: ✭ 205 (+1105.88%)
Mutual labels:  e2e-tests, puppeteer
Softest
Recording Browser Interactions And Generating Test Scripts.
Stars: ✭ 208 (+1123.53%)
Mutual labels:  e2e-tests, puppeteer
Qawolf
🐺 Create browser tests 10x faster
Stars: ✭ 2,912 (+17029.41%)
Mutual labels:  e2e-tests, puppeteer
Pending Xhr Puppeteer
Small tool to wait that all xhr are finished in puppeteer
Stars: ✭ 227 (+1235.29%)
Mutual labels:  e2e-tests, puppeteer
softest
Recording Browser Interactions And Generating Test Scripts.
Stars: ✭ 225 (+1223.53%)
Mutual labels:  e2e-tests, puppeteer
go-graphql-api-boilerplate
A Boilerplate of GraphQL API built in Go + graphql-go + gorm
Stars: ✭ 75 (+341.18%)
Mutual labels:  starter-kit
barclayscrape
A small app to programmatically mainpulate Barclays online banking
Stars: ✭ 57 (+235.29%)
Mutual labels:  puppeteer
top.gg-automatic-voter
This is a script that votes for specified bot automatically per 12 hours on top.gg
Stars: ✭ 144 (+747.06%)
Mutual labels:  puppeteer
Frontend-StarterKit
Frontend StarterKit - [Gulp 4, Pug, SCSS, ES6+]
Stars: ✭ 13 (-23.53%)
Mutual labels:  starter-kit
gw-starter-kit
PEPELAC - Современный инструментарий для вёрстки и создания статичных сайтов с использованием Webpack
Stars: ✭ 30 (+76.47%)
Mutual labels:  starter-kit
ZSpider
基于Electron爬虫程序
Stars: ✭ 37 (+117.65%)
Mutual labels:  puppeteer
marmelad
Заготовка фронтенд проекта для продвинутых и начинающих 🤘. Хорошо подходит для поддержания единой структуры проектов в команде и легкого переиспользования готовых блоков между проектами.
Stars: ✭ 15 (-11.76%)
Mutual labels:  starter-kit
MagicMouse
A webbrowser for Squeak using Chrome/Chromium. Not to be confused with a highly innovative pointing device.
Stars: ✭ 24 (+41.18%)
Mutual labels:  puppeteer
codepen-puppeteer
Use Puppeteer to download pens from Codepen.io as single html pages
Stars: ✭ 22 (+29.41%)
Mutual labels:  puppeteer
frontend-starter-kit-with-gulp
Frontend Starter Kit with Gulp for either Themeforest Projects or customizable projects.
Stars: ✭ 34 (+100%)
Mutual labels:  starter-kit
abeamer
frame-by-frame Web Animation framework
Stars: ✭ 49 (+188.24%)
Mutual labels:  puppeteer
simple-react-native-starter
Simple ReactNative starter with an opinionated folder structure for mobile development.
Stars: ✭ 73 (+329.41%)
Mutual labels:  starter-kit

Puppeteer-Jest Starter

CircleCI

A starter-kit quipped with the minimal requirements for Puppeteer + Jest, making E2E testing a breeze.

Kicking off:

Install dependencies:

$ npm i

Run the test:

$ npm start

Run test test in headed Chrome:

$ npm start:headed

What's inside:

global.page

  • provide wrapped global.page instance so that you can start writting your test case immediately.

Screenshot for each failed test case

  • A screenshot will be taken for each failed test case, put in screenshots folder. (/tmp/screenshots if env.CI)
  • Each file will be named by the spec description

Failure details for each failed test case

  • A json file named by the spec description will be generated for each failed test case. Contents in the file include:
    • The current page url
    • Spec description
    • console messages

Multiple Browsers

Sometimes, we'd like to manipulate more than on browsers in a test case. For example, testing two sided chat. We can do that by:

const { getPageFromBrowser } = require('lib/browserStore')

describe('Demo', () => {
  it('manipulates multiple browsers', async ()=> {
    const page2 = await getPageFromBrowser('page2')

    // do something with `global.page` here
    // and do some other thing to `page2` here

    await page.goto('...')
    await page2.goto('...')
  })
})

where the getPageFromBrowser works as a browser store providing multiple browser references by browserName:

page1 = await getPageFromBrowser('the-name')
page2 = await getPageFromBrowser('the-name')

page1 === page2 // true

Wrapped global.page with convenient default options and behaviors which can be overwritten easily when needed

For example, global.page.goto is with default option waitUntil: networkidle0 and fails with readable erorr message if the returning status code is not 200. To overwrite it, just

global.page.goto({
  waitUntil: 'my-other-desired-options',
  myOtherKey: 'my-other-value'
})

The default options/overwritten methods can be modified in lib/pageWrapper.

Default options/behavior in global.page

  • page.goto: waitUntil: 'networkidle0', guard status 200
  • page.waitForSelector: visible: true
  • page.click: First waitForSelector with visible: true then click

Make it easy to decouple test case with UI detail

In e2e testing, it's easy to scatter css selectors all around the code base. This makes maintainance when UI changes a nightmare. Here we use window driver layer to mitigate this issue and make the error message more readable at the same time:

before

it('is nasty', async () => {
  // do payment
  await page.click('.my-first-css-selector')
  await page.click('.my-another-css-selector')
  await page.click('.my-yet-another-css-selector')
  await page.click('.this-drove-me-crazy')
})

after

const { getPageFromBrowser } = require('lib/browserStore')

function createPageDriver (page) {
  return wrapErrorHandler({
    async doPayment() {
      // when UI implementation changed, change here
      await page.click('.my-first-css-selector')
      await page.click('.my-another-css-selector')
      await page.click('.my-yet-another-css-selector')
      await page.click('.this-drove-me-crazy')
    },
  }, 'MyDemoPage')
}

it('is much better', async () => {
  // when UI implementation changed, this part won't change if the business logic remains the same
  const driver = createPageDriver(page)
  await page.doPayment()
})

By adding a layer between business logic and UI details, we can abstract out the UI implementation detail there.

CI setup

CircleCI config is included!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].