Skip to content

Instantly share code, notes, and snippets.

@M4R14
Last active May 12, 2019 14:19
Show Gist options
  • Select an option

  • Save M4R14/cb5aa4a386a5653bbf0dd588583115f8 to your computer and use it in GitHub Desktop.

Select an option

Save M4R14/cb5aa4a386a5653bbf0dd588583115f8 to your computer and use it in GitHub Desktop.
วิธีใส่ Puppeteer เข้าไปใน Jest เพื่อทำ UI Testing ในโหมด headless browser อย่างง่าย… / sol.A - http://vachirawit.com/puppeteer-and-jest-testing-headless-browser/
const puppeteer = require('puppeteer');
const Chrome = async ({ STEP }) => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await STEP(browser, page);
browser.close();
}
test('Title == Google', async () => {
await Chrome({
STEP: async (browser, page)=>{
page.goto("https://google.com");
const title = await page.title();
expect(title).toBe("Google");
}
});
}, 1000*30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment