Skip to content

Instantly share code, notes, and snippets.

@dobromir-hristov
Created November 2, 2018 08:09
Show Gist options
  • Save dobromir-hristov/2dfb1f7569d33f815aabce444b282296 to your computer and use it in GitHub Desktop.
Save dobromir-hristov/2dfb1f7569d33f815aabce444b282296 to your computer and use it in GitHub Desktop.
Sequental iterate + screenshot
async function main(){
const response = await getJson('sone/endpoint') // vzimame vsi4ko
const finalResult = await response.reduce((promiseChain, currentItem) => {
return promiseChain.then(results => {
return screenShotAndCompare(currentItem)
})
}, Promise.resolve())
// Tuk ve4e sme gotovi
}
async function screenShotAndCompare(item){
const screenshot = await screenShotItem(item)
return compareItem(screenshot, oldScreenshot) // tr go ima6 ot nqkyde
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment