mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
frontend tests: add helper.logDebugMsg function to help get information from tests that do not have support for console.json on SauceLabs
This commit is contained in:
parent
ca4cc2d7c0
commit
c228283c17
4 changed files with 23 additions and 0 deletions
|
@ -226,3 +226,15 @@ helper.clearPad = async () => {
|
|||
await helper.waitForPromise(() => helper.commits.length > commitsBefore);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes to an (hidden) element which is dropped into the console output of a workflow run
|
||||
*
|
||||
* This is useful for debugging failed tests when there is no console log output available on
|
||||
* SauceLabs (e.g. Safari)
|
||||
*
|
||||
*/
|
||||
helper.logDebugMsg = (msg) => {
|
||||
const elem = $('#debuglogs');
|
||||
elem.append(`\n${msg}`);
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="console"></div>
|
||||
<div id="debuglogs"></div>
|
||||
<div id="split-view">
|
||||
<div id="mocha"></div>
|
||||
<div id="separator"></div>
|
||||
|
|
|
@ -13,6 +13,10 @@ body {
|
|||
display: none;
|
||||
}
|
||||
|
||||
#debuglogs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#split-view {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -54,6 +54,11 @@ const sauceTestWorker = async.queue(async ({name, pfx, testSettings}) => {
|
|||
.setFirefoxOptions(firefoxOptions)
|
||||
.build();
|
||||
const url = `https://saucelabs.com/jobs/${(await driver.getSession()).getId()}`;
|
||||
const debugOutput = () => {
|
||||
const console = document.getElementById('debuglogs'); // eslint-disable-line no-undef
|
||||
if (console == null) return '';
|
||||
return console.innerText;
|
||||
};
|
||||
try {
|
||||
await driver.get('http://localhost:9001/tests/frontend/');
|
||||
log(`Remote sauce test started! ${url}`, pfx);
|
||||
|
@ -89,6 +94,7 @@ const sauceTestWorker = async.queue(async ({name, pfx, testSettings}) => {
|
|||
}
|
||||
} finally {
|
||||
log(`Remote sauce test finished! ${url}`, pfx);
|
||||
log(`Debug logs of ${pfx}: ${await driver.executeScript(debugOutput)}`);
|
||||
await driver.quit();
|
||||
}
|
||||
}, 6); // run 6 tests in parrallel
|
||||
|
|
Loading…
Reference in a new issue