Skip to content

Instantly share code, notes, and snippets.

@patocallaghan
Created March 5, 2019 09:33
Show Gist options
  • Save patocallaghan/0d2186f5e1ded1f2bb3f7276162add79 to your computer and use it in GitHub Desktop.
Save patocallaghan/0d2186f5e1ded1f2bb3f7276162add79 to your computer and use it in GitHub Desktop.
function checkTestsOpen() {
if (attempts > 50) { return; }
openedJobs = document.querySelectorAll('.build-details-pipeline-job.build-details-pipeline-job-expanded');
if (openedJobs.length === buildJobs) {
getDeprecationWarnings();
} else {
setTimeout(checkTestsOpen, 200);
}
}
function getDeprecationWarnings() {
deprecationWarnings = new Set();
deprecations = $('.JobLogOutputComponent__Line__Content').toArray().filter(line => {
return line.textContent.includes('[deprecation id');
}).map(deprecation => {
return /\[deprecation id: .*?\]/.exec(deprecation.textContent)[0];
});
uniqueDeprecations = new Set();
deprecations.forEach(deprecation => uniqueDeprecations.add(deprecation));
container = document.querySelector('.job-list-pipeline')
el = document.createElement('ul');
total = document.createElement('li');
total.textContent = `${uniqueDeprecations.size} deprecation warnings`;
el.append(total);
uniqueDeprecations.forEach(warning => {
deprecation = document.createElement('li');
deprecation.textContent = warning;
el.append(deprecation);
});
container.prepend(el);
el.scrollIntoView();
}
buildJobs = document.querySelectorAll('.build-details-pipeline-job').length;
document.querySelectorAll('.build-details-pipeline-job').forEach(item => {
if (!item.classList.contains('build-details-pipeline-job-expanded')) {
item.querySelector('.items-center').click();
}
});
attempts = 0
setTimeout(checkTestsOpen, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment