Skip to content

Instantly share code, notes, and snippets.

View graffhyrum's full-sized avatar

Joshua Pendragon graffhyrum

View GitHub Profile
@rinogo
rinogo / playwright-wait-for-mutation-to-stop.js
Last active July 29, 2022 21:45
Wait for an element to remain unchanged for a period of time. Useful for waiting for asynchronous (AJAX) updates. Playwright, ES6, Promise, Mutation, MutationObserver
///////
//To test this code, execute it locally or copy/paste it at https://try.playwright.tech/
//Usage example: `await waitForMutationToStop(await page.$("#container"));`
///////
// @ts-check
const playwright = require("playwright");
//Wait for `elem` to have no mutations for a period of `noMutationDuration` ms. If `timeout` ms elapse without a "no mutation" period of sufficient length, throw an error. If `waitForFirstMutation` is true, wait until the first mutation before starting to wait for the `noMutationDuration` period.
const waitForMutationToStop = async (elem, noMutationDuration = 3000, timeout = 60000, waitForFirstMutation = true) => {
@gelldur
gelldur / what_i_was_doing_in_last_2w.jql
Last active September 11, 2024 15:12
JQL filter (Jira filter) For what I was doing in last 2 weeks
assignee was currentUser() during (startOfDay(-2w), now()) AND updated >= startOfDay(-2w) AND ( resolutiondate is EMPTY OR resolutiondate >= startOfDay(-2w) )