Displaying logs in case of error

This commit is contained in:
David Négrier 2021-11-24 10:58:26 +01:00
parent 7ef6431b64
commit 8eb346de25
2 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,4 @@
const BROWSER = process.env.BROWSER || "chrome --use-fake-device-for-media-stream";
const BROWSER = process.env.BROWSER || "chrome --use-fake-ui-for-media-stream --use-fake-device-for-media-stream";
module.exports = {
"browsers": BROWSER,

View File

@ -29,15 +29,21 @@ test("Test that variables cache in the back don't prevent setting a variable in
.click('button.selectCharacterButtonRight')
.click('button.selectCharacterButtonRight')
.click('button.selectCharacterSceneFormSubmit')
.click('button.letsgo');
.click('button.letsgo')
.wait(1000);
//.takeScreenshot('after_switch.png');
const messages = await t.getBrowserConsoleMessages();
const logs = messages['log'];
console.log(logs);
const lastMessage = logs.pop();
// Let's check we successfully manage to save the variable value.
await t.expect(lastMessage).eql('SUCCESS!');
await t.expect(logs).contains('SUCCESS!');
t.ctx.passed = true;
}).after(async t => {
if (!t.ctx.passed) {
console.log("Test failed. Browser logs:")
console.log(await t.getBrowserConsoleMessages());
}
});