From 59483716e7e005f4bf960d909c35aa9041aa43ee Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 5 May 2022 07:19:36 +0200 Subject: [PATCH] add logs --- .../src/commands/getBrowserLogs.ts | 17 +++++++++++++++++ apps/remix-ide-e2e/src/tests/terminal.test.ts | 1 + apps/remix-ide-e2e/src/types/index.d.ts | 1 + 3 files changed, 19 insertions(+) create mode 100644 apps/remix-ide-e2e/src/commands/getBrowserLogs.ts diff --git a/apps/remix-ide-e2e/src/commands/getBrowserLogs.ts b/apps/remix-ide-e2e/src/commands/getBrowserLogs.ts new file mode 100644 index 0000000000..d2e07cb7a4 --- /dev/null +++ b/apps/remix-ide-e2e/src/commands/getBrowserLogs.ts @@ -0,0 +1,17 @@ +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' + +class GetBrowserLogs extends EventEmitter { + command(this: NightwatchBrowser): NightwatchBrowser { + this.api.getLog('browser', function (logs) { + logs.forEach(function (log) { + console.log(log) + } + ) + }).perform(() => { + this.emit('complete') + }) + return this + } +} +module.exports = GetBrowserLogs \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 55031eafcc..ec271acc9f 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -201,6 +201,7 @@ module.exports = { .openFile('contracts/storage.sol') .sendKeys('body', [browser.Keys.CONTROL, browser.Keys.SHIFT, 's']) .pause(5000) + .getBrowserLogs() .journalLastChildIncludes('147') } } diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index 9abe5c2174..e8698d4407 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -61,6 +61,7 @@ declare module 'nightwatch' { acceptAndRemember (this: NightwatchBrowser, remember: boolean, accept: boolean): NightwatchBrowser clearConsole (this: NightwatchBrowser): NightwatchBrowser clearTransactions (this: NightwatchBrowser): NightwatchBrowser + getBrowserLogs (this: NightwatchBrowser): NightwatchBrowser currentSelectedFileIs (name: string): NightwatchBrowser }