From e70563e37e1ed56272c5058ab92f8ae2b5514587 Mon Sep 17 00:00:00 2001 From: AlexanderMoskovkin Date: Wed, 27 Sep 2017 21:01:57 +0300 Subject: [PATCH] Rename to `getBrowserConsoleMessages` --- src/api/test-controller/index.js | 8 ++++---- src/client/driver/driver.js | 6 +++--- src/test-run/commands/actions.js | 4 ++-- src/test-run/commands/type.js | 2 +- .../fixtures/api/es-next/console/test.js | 4 ++-- .../console/testcafe-fixtures/console-test.js | 8 ++++---- .../test-suites/typescript-defs/test-controller.ts | 8 ++++---- ts-defs/index.d.ts | 14 +++++++------- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/api/test-controller/index.js b/src/api/test-controller/index.js index a3cd9f22ebe..0b94dcf0832 100644 --- a/src/api/test-controller/index.js +++ b/src/api/test-controller/index.js @@ -24,7 +24,7 @@ import { SwitchToMainWindowCommand, SetNativeDialogHandlerCommand, GetNativeDialogHistoryCommand, - GetConsoleMessagesCommand, + GetBrowserConsoleMessagesCommand, SetTestSpeedCommand, SetPageLoadTimeoutCommand, UseRoleCommand @@ -240,10 +240,10 @@ export default class TestController { return this.testRun.executeCommand(new GetNativeDialogHistoryCommand(), callsite); } - _getConsoleMessages$ () { - var callsite = getCallsiteForMethod('getConsoleMessages'); + _getBrowserConsoleMessages$ () { + var callsite = getCallsiteForMethod('getBrowserConsoleMessages'); - return this.testRun.executeCommand(new GetConsoleMessagesCommand(), callsite); + return this.testRun.executeCommand(new GetBrowserConsoleMessagesCommand(), callsite); } _expect$ (actual) { diff --git a/src/client/driver/driver.js b/src/client/driver/driver.js index b8d23beb9ba..047a81a5597 100644 --- a/src/client/driver/driver.js +++ b/src/client/driver/driver.js @@ -362,7 +362,7 @@ export default class Driver { })); } - _onGetConsoleMessagesCommand () { + _onGetBrowserConsoleMessagesCommand () { this._onReady(new DriverStatus({ isCommandResult: true, result: this.consoleMessages @@ -531,8 +531,8 @@ export default class Driver { else if (command.type === COMMAND_TYPE.getNativeDialogHistory) this._onGetNativeDialogHistoryCommand(command); - else if (command.type === COMMAND_TYPE.getConsoleMessages) - this._onGetConsoleMessagesCommand(command); + else if (command.type === COMMAND_TYPE.getBrowserConsoleMessages) + this._onGetBrowserConsoleMessagesCommand(command); else if (command.type === COMMAND_TYPE.setTestSpeed) this._onSetTestSpeedCommand(command); diff --git a/src/test-run/commands/actions.js b/src/test-run/commands/actions.js index 1056c57b898..7b00a5bd80f 100644 --- a/src/test-run/commands/actions.js +++ b/src/test-run/commands/actions.js @@ -418,9 +418,9 @@ export class GetNativeDialogHistoryCommand { } } -export class GetConsoleMessagesCommand { +export class GetBrowserConsoleMessagesCommand { constructor () { - this.type = TYPE.getConsoleMessages; + this.type = TYPE.getBrowserConsoleMessages; } } diff --git a/src/test-run/commands/type.js b/src/test-run/commands/type.js index fe9bc9131ad..bebd3807c04 100644 --- a/src/test-run/commands/type.js +++ b/src/test-run/commands/type.js @@ -34,7 +34,7 @@ export default { switchToMainWindow: 'switch-to-main-window', setNativeDialogHandler: 'set-native-dialog-handler', getNativeDialogHistory: 'get-native-dialog-history', - getConsoleMessages: 'get-console-messages', + getBrowserConsoleMessages: 'get-browser-console-messages', setTestSpeed: 'set-test-speed', setPageLoadTimeout: 'set-page-load-timeout', debug: 'debug', diff --git a/test/functional/fixtures/api/es-next/console/test.js b/test/functional/fixtures/api/es-next/console/test.js index 0f7f93b28f9..c3433a1a67e 100644 --- a/test/functional/fixtures/api/es-next/console/test.js +++ b/test/functional/fixtures/api/es-next/console/test.js @@ -1,6 +1,6 @@ -describe('[API] t.getConsoleMessages()', function () { +describe('[API] t.getBrowserConsoleMessages()', function () { it('Should return messages from the console', function () { - return runTests('./testcafe-fixtures/console-test.js', 't.getConsoleMessages'); + return runTests('./testcafe-fixtures/console-test.js', 't.getBrowserConsoleMessages'); }); it('Should format messages if several args were passed', function () { diff --git a/test/functional/fixtures/api/es-next/console/testcafe-fixtures/console-test.js b/test/functional/fixtures/api/es-next/console/testcafe-fixtures/console-test.js index ea1603d8259..d304a8346b3 100644 --- a/test/functional/fixtures/api/es-next/console/testcafe-fixtures/console-test.js +++ b/test/functional/fixtures/api/es-next/console/testcafe-fixtures/console-test.js @@ -3,8 +3,8 @@ fixture `Double Click`; test .page `http://localhost:3000/fixtures/api/es-next/console/pages/index.html` -('t.getConsoleMessages', async t => { - let messages = await t.getConsoleMessages(); +('t.getBrowserConsoleMessages', async t => { + let messages = await t.getBrowserConsoleMessages(); await t .expect(messages.error).eql(['error1']) @@ -17,7 +17,7 @@ test // Check the driver keeps the messages between page reloads .click('#reload'); - messages = await t.getConsoleMessages(); + messages = await t.getBrowserConsoleMessages(); await t .expect(messages.error).eql(['error1', 'error2']) @@ -33,7 +33,7 @@ test await t.eval(() => console.log('a', 1, null, void 0, ['b', 2], { c: 3 })); /* eslint-enable no-console */ - const { log } = await t.getConsoleMessages(); + const { log } = await t.getBrowserConsoleMessages(); await t.expect(log[0]).eql('a 1 null undefined b,2 [object Object]'); }); diff --git a/test/server/data/test-suites/typescript-defs/test-controller.ts b/test/server/data/test-suites/typescript-defs/test-controller.ts index f5aa3d63bee..f5456ff4113 100644 --- a/test/server/data/test-suites/typescript-defs/test-controller.ts +++ b/test/server/data/test-suites/typescript-defs/test-controller.ts @@ -747,8 +747,8 @@ test('Chaining callsites', async t => { .click('#btn3'); }); -test('t.getConsoleMessages', async t => { - let messages = await t.getConsoleMessages(); +test('t.getBrowserConsoleMessages', async t => { + let messages = await t.getBrowserConsoleMessages(); await t .expect(messages.error).eql(['error1']) @@ -761,7 +761,7 @@ test('t.getConsoleMessages', async t => { // Check the driver keeps the messages between page reloads .click('#reload'); - messages = await t.getConsoleMessages(); + messages = await t.getBrowserConsoleMessages(); await t .expect(messages.error).eql(['error1', 'error2']) @@ -774,7 +774,7 @@ test('messages formatting', async t => { // Several arguments await t.eval(() => console.log('a', 1, null, void 0, ['b', 2], {c: 3})) - let {log} = await t.getConsoleMessages(); + let {log} = await t.getBrowserConsoleMessages(); await t.expect(log[0]).eql('a 1 null undefined b,2 [object Object]'); }); \ No newline at end of file diff --git a/ts-defs/index.d.ts b/ts-defs/index.d.ts index e1dcf527a4b..77b28c7fb39 100644 --- a/ts-defs/index.d.ts +++ b/ts-defs/index.d.ts @@ -799,21 +799,21 @@ interface NativeDialogHistoryItem { url: string; } -interface ConsoleMessagesCollection { +interface BrowserConsoleMessages { /** - * TODO: + * Messages output to the browser console by the console.log() method. */ log: string[], /** - * TODO: + * Warning messages output to the browser console by the console.warn() method. */ warn: string[], /** - * TODO: + * Error messages output to the browser console by the console.error() method. */ error: string[], /** - * TODO: + * Information messages output to the browser console by the console.info() method. */ info: string[] } @@ -1024,9 +1024,9 @@ interface TestController { */ getNativeDialogHistory(): Promise; /** - * TODO: Returns a collection of browser console messages. + * Returns an object that contains messages output to the browser console. */ - getConsoleMessages(): Promise; + getBrowserConsoleMessages(): Promise; /** * Starts an assertion chain and specifies assertion actual value. *