Files
RSSHub/test/utils/puppeteer.js
2021-11-28 01:37:20 +00:00

21 lines
720 B
JavaScript

const puppeteer = require('../../lib/utils/puppeteer');
const wait = require('../../lib/utils/wait');
describe('puppeteer', () => {
it('puppeteer run', async () => {
const browser = await puppeteer();
const page = await browser.newPage();
await page.goto('https://www.google.com', {
waitUntil: 'domcontentloaded',
});
// eslint-disable-next-line no-undef
const html = await page.evaluate(() => document.body.innerHTML);
expect(html.length).toBeGreaterThan(0);
expect((await browser.process()).signalCode).toBe(null);
await wait(31 * 1000);
expect((await browser.process()).signalCode).toBe('SIGKILL');
}, 40000);
});