Skip to content

Latest commit

 

History

History

foreal

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

foreal npm

Test React app with Puppeteer.

Install

$ yarn add foreal

Usage

type TGetAppPageOptions = {
  entryPointPath: string,
  fontsDir?: string,
  width?: number,
  height?: number,
  deviceScaleFactor?: number,
}

const getAppPage: (options: TGetAppPageOptions) => Promise<Page>
// App.tsx
export const App = () => (
  <h1>hi</h1>
)
import { getAppPage } from 'foreal'

const page = await getAppPage({
  entryPointPath: './App.tsx'
})

const result = await page.$eval('h1', (el) => el.textContent)

console.log(result)
// 'hi'

// necessary to call when it's done
await page.close()