Skip to content

Commit

Permalink
Rename to getBrowserConsoleMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMoskovkin committed Sep 27, 2017
1 parent 568cb32 commit e70563e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/api/test-controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
SwitchToMainWindowCommand,
SetNativeDialogHandlerCommand,
GetNativeDialogHistoryCommand,
GetConsoleMessagesCommand,
GetBrowserConsoleMessagesCommand,
SetTestSpeedCommand,
SetPageLoadTimeoutCommand,
UseRoleCommand
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/driver/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export default class Driver {
}));
}

_onGetConsoleMessagesCommand () {
_onGetBrowserConsoleMessagesCommand () {
this._onReady(new DriverStatus({
isCommandResult: true,
result: this.consoleMessages
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/test-run/commands/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ export class GetNativeDialogHistoryCommand {
}
}

export class GetConsoleMessagesCommand {
export class GetBrowserConsoleMessagesCommand {
constructor () {
this.type = TYPE.getConsoleMessages;
this.type = TYPE.getBrowserConsoleMessages;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test-run/commands/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions test/functional/fixtures/api/es-next/console/test.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand All @@ -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'])
Expand All @@ -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]');
});
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand All @@ -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'])
Expand All @@ -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]');
});
14 changes: 7 additions & 7 deletions ts-defs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
}
Expand Down Expand Up @@ -1024,9 +1024,9 @@ interface TestController {
*/
getNativeDialogHistory(): Promise<NativeDialogHistoryItem[]>;
/**
* TODO: Returns a collection of browser console messages.
* Returns an object that contains messages output to the browser console.
*/
getConsoleMessages(): Promise<ConsoleMessagesCollection>;
getBrowserConsoleMessages(): Promise<BrowserConsoleMessages>;
/**
* Starts an assertion chain and specifies assertion actual value.
*
Expand Down

0 comments on commit e70563e

Please sign in to comment.