Skip to content

Instantly share code, notes, and snippets.

View mattzeunert's full-sized avatar

Matt Zeunert mattzeunert

View GitHub Profile

asdf

const puppeteer = require('puppeteer');
const { startFlow } = require('lighthouse/lighthouse-core/fraggle-rock/api.js');
const fs = require("fs");
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
const flow = await startFlow(page, {
name: 'Go to homepage',
@mattzeunert
mattzeunert / github-search.js
Created November 6, 2021 13:48
Chrome DevTools User Flow Recording for GitHub Search
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
async function waitForSelectors(selectors, frame) {
for (const selector of selectors) {
try {
return await waitForSelector(selector, frame);
var waitFor = async function waitFor(conditionFn, { timeout = 15000, checkInterval = 25, debugString = null, } = {}) {
if (typeof conditionFn !== "function") {
throw Error("waitFor condition argument isn't a function. Did you mean waitForElement?");
}
if (!debugString) {
debugString = conditionFn.toString();
}
let startedAt = new Date();
let conditionResult = await conditionFn();
while (!conditionResult) {
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
function throttle (callback, limit) {
var wait = false;
return function () {
if (!wait) {
callback.apply(null, arguments);
wait = true;
setTimeout(function () {
wait = false;
}, limit);
}