-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MWPW-138943 POC Integration test #496
Conversation
) => new Promise((resolve) => { | ||
const el = document.querySelector(selector); | ||
|
||
if (el) { | ||
resolve(el); | ||
return; | ||
} | ||
if (el) { | ||
resolve(el); | ||
return; | ||
} | ||
|
||
const observer = new MutationObserver((mutations, obsv) => { | ||
mutations.forEach((mutation) => { | ||
const nodes = [...mutation.addedNodes]; | ||
nodes.some((node) => { | ||
if (node.matches && node.matches(selector)) { | ||
if (textContent && node.textContent !== textContent) return false; | ||
|
||
const observer = new MutationObserver((mutations, obsv) => { | ||
mutations.forEach((mutation) => { | ||
const nodes = [...mutation.addedNodes]; | ||
nodes.some((node) => { | ||
if (node.matches && node.matches(selector)) { | ||
if (textContent && node.textContent !== textContent) return false; | ||
obsv.disconnect(); | ||
resolve(node); | ||
return true; | ||
} | ||
|
||
// check for child in added node | ||
const treeWalker = document.createTreeWalker(node); | ||
let { currentNode } = treeWalker; | ||
while (currentNode) { | ||
if (currentNode.matches && currentNode.matches(selector)) { | ||
obsv.disconnect(); | ||
resolve(node); | ||
resolve(currentNode); | ||
return true; | ||
} | ||
|
||
// check for child in added node | ||
const treeWalker = document.createTreeWalker(node); | ||
let { currentNode } = treeWalker; | ||
while (currentNode) { | ||
if (currentNode.matches && currentNode.matches(selector)) { | ||
obsv.disconnect(); | ||
resolve(currentNode); | ||
return true; | ||
} | ||
currentNode = treeWalker.nextNode(); | ||
} | ||
return false; | ||
}); | ||
currentNode = treeWalker.nextNode(); | ||
} | ||
return false; | ||
}); | ||
}); | ||
|
||
observer.observe(rootEl, options); | ||
}); | ||
|
||
observer.observe(rootEl, options); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all
) => new Promise((resolve) => { | ||
const observer = new MutationObserver((mutations, obsv) => { | ||
obsv.disconnect(); | ||
resolve(); | ||
}); | ||
observer.observe(el, options); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all
) => new Promise((resolve) => { | ||
const el = document.querySelector(selector); | ||
|
||
if (!el) { | ||
resolve(); | ||
return; | ||
} | ||
if (!el) { | ||
resolve(); | ||
return; | ||
} | ||
|
||
const observer = new MutationObserver((mutations, obsv) => { | ||
mutations.forEach((mutation) => { | ||
const nodes = [...mutation.removedNodes]; | ||
nodes.some((node) => { | ||
if (node.matches(selector)) { | ||
obsv.disconnect(); | ||
resolve(); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
const observer = new MutationObserver((mutations, obsv) => { | ||
mutations.forEach((mutation) => { | ||
const nodes = [...mutation.removedNodes]; | ||
nodes.some((node) => { | ||
if (node.matches(selector)) { | ||
obsv.disconnect(); | ||
resolve(); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
}); | ||
|
||
observer.observe(el.parentElement, options); | ||
}); | ||
|
||
observer.observe(el.parentElement, options); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all
export const delay = (timeOut, cb) => new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve((cb && cb()) || null); | ||
}, timeOut); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all
return new Promise((resolve, reject) => { | ||
if (predicate()) resolve(); | ||
|
||
const intervalId = setInterval(() => { | ||
if (predicate()) { | ||
clearInterval(intervalId); | ||
resolve(); | ||
} | ||
}, interval); | ||
|
||
setTimeout(() => { | ||
resolve((cb && cb()) || null); | ||
}, timeOut); | ||
clearInterval(intervalId); | ||
reject(new Error('Timed out waiting for predicate to be true')); | ||
}, timeout); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## stage #496 +/- ##
==========================================
+ Coverage 97.86% 97.90% +0.03%
==========================================
Files 26 26
Lines 2907 2907
==========================================
+ Hits 2845 2846 +1
+ Misses 62 61 -1 ☔ View full report in Codecov by Sentry. |
To do:
Tu run integration tests on Chromium only:
To run integration tests on 3 browsers: