mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
bcbf57d590
Summary: This uses a newer version of mocha in grist-core so that tests can be run in parallel. That allows more tests to be moved without slowing things down overall. Tests moved are venerable browser tests; only the ones that "just work" or worked without too much trouble to are moved, in order to keep the diff from growing too large. Will wrestle with more in follow up. Parallelism is at the file level, rather than the individual test. The newer version of mocha isn't needed for grist-saas repo; tests are parallelized in our internal CI by other means. I've chosen to allocate files to workers in a cruder way than our internal CI, based on initial characters rather than an automated process. The automated process would need some reworking to be compatible with mocha running in parallel mode. Test Plan: this diff was tested first on grist-core, then ported to grist-saas so saas repo history will correctly track history of moved files. Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3927
105 lines
2.7 KiB
HTML
105 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<base href="/v/gtag/">
|
|
<title>Grist Tests</title>
|
|
<script src="jquery/dist/jquery.min.js"></script>
|
|
<script src="plotly/plotly-latest.min.js"></script>
|
|
<script src="./mocha.js"></script>
|
|
<script>mocha.setup('bdd')</script>
|
|
<script src="./test.bundle.js"></script>
|
|
<script>
|
|
onload = function() {
|
|
$('#app-test').ready(function() {
|
|
try {
|
|
window.loadTests();
|
|
} catch (err) {
|
|
console.log("ERROR", err);
|
|
mocha.failedTests = [];
|
|
mocha.failedTests.push({title: 'Failed to load', error: err.toString()});
|
|
document.getElementById('mocha-status').textContent = 'DONE - FAILED TO LOAD';
|
|
return;
|
|
}
|
|
|
|
mocha.checkLeaks();
|
|
// fxdriver_id is set by selenium, execWebdriverJQuery by webdriverjq.js.
|
|
mocha.globals(['cmd', 'fxdriver_id', 'execWebdriverJQuery']);
|
|
var runner = mocha.run();
|
|
mocha.failedTests = [];
|
|
runner.on('fail', function(test, err) {
|
|
mocha.failedTests.push({title: test.fullTitle(), error: err.toString()});
|
|
});
|
|
runner.on('end', function() {
|
|
document.getElementById('mocha-status').textContent = runner.failures > 0 ? 'DONE - FAILURE :(' : 'DONE - SUCCESS :)';
|
|
});
|
|
});
|
|
};
|
|
|
|
function scrollToBottom() {
|
|
var bottom = document.getElementById('mocha-end');
|
|
bottom.scrollIntoView(true);
|
|
}
|
|
|
|
afterEach(function() {
|
|
// keep scrolled to the bottom
|
|
return scrollToBottom();
|
|
});
|
|
|
|
after(function() {
|
|
// keep scrolled to the bottom
|
|
return scrollToBottom();
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
#mocha {
|
|
width: 50%;
|
|
}
|
|
|
|
#app-test {
|
|
position: fixed;
|
|
margin: -8px;
|
|
width: 40%;
|
|
height: 80%;
|
|
top: 20%;
|
|
left: 60%;
|
|
}
|
|
|
|
#mocha-status {
|
|
position: fixed;
|
|
bottom: 0px;
|
|
padding: 1rem;
|
|
border: 2px solid #cc9;
|
|
font-family: Helvetica, Arial, sans-serif;
|
|
}
|
|
|
|
/* mostly match #mocha-stats class */
|
|
.extra-info {
|
|
position: fixed;
|
|
top: 60px;
|
|
right: 10px;
|
|
font-size: 12px;
|
|
color: #888;
|
|
z-index: 1;
|
|
}
|
|
|
|
</style>
|
|
|
|
<link rel="stylesheet" href="./mocha.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div id="mocha">
|
|
<div class="extra-info">
|
|
<a href="/test.html?timing=1">Run tests with timings</a>
|
|
</div>
|
|
</div>
|
|
<div id="mocha-end"> </div>
|
|
<div id="mocha-status">TBD - RUNNING...</div>
|
|
</body>
|
|
|
|
</html>
|
|
|