Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the capability to get browser console messages #1738

Closed
AlexanderMoskovkin opened this issue Aug 29, 2017 · 2 comments
Closed

Add the capability to get browser console messages #1738

AlexanderMoskovkin opened this issue Aug 29, 2017 · 2 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: enhancement The accepted proposal for future implementation.
Milestone

Comments

@AlexanderMoskovkin
Copy link
Contributor

AlexanderMoskovkin commented Aug 29, 2017

Are you requesting a feature or reporting a bug?

feature suggestion

What is the expected behavior?

It allows to check messages that your application outputs via console.log(), console.warn(), console.error(), console.info().

One of possible use cases is described in the Catch JS errors and console output discussion. React notifies about a PropTypes error via console.error but doesn't call something like throw new Error().

Proposed API:

fixture `My fixture`
    .beforeEach(await t => {
        var { error, warn, log, info } = await t.getConsoleMessages();

        const expectedInfoMessages = info.filter(msg => msg.indexOf('important message') > -1);

        await t
            .expect(error.length).eql(0)
            .expect(warn.length).eql(0)
            .expect(expectedInfoMessages.length).ok();
    });

Feel free to vote for the feature if you consider it useful and please let us know about your use case for it.

@AlexanderMoskovkin AlexanderMoskovkin changed the title Add ability to get browser console messages Add the capability to get browser console messages Aug 29, 2017
@dimaip
Copy link

dimaip commented Aug 30, 2017

One usecase for it would be to make tests fail on React PropTypes errors (React uses console.error to warn on such errors).

@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this issue Dec 18, 2019
…#1738) (DevExpress#1818)

* Add the capability to get browser console messages (closes DevExpress#1738)

* Rename to `getBrowserConsoleMessages`

* Address Helen's remarks

* Fix the test for node 4

* Store messages on the server

* Integrating with Roles. Refactoring.

* Fix tests.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: enhancement The accepted proposal for future implementation.
Projects
None yet
Development

No branches or pull requests

3 participants