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

Provide the capability to access browser information from test code #481

Closed
inikulin opened this issue Apr 25, 2016 · 4 comments
Closed
Assignees
Labels
AREA: client AREA: server STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: API TYPE: enhancement The accepted proposal for future implementation.
Milestone

Comments

@inikulin
Copy link
Contributor

inikulin commented Apr 25, 2016

Make browser information available in the test controller - add the t.browserInfo property.

There are various use cases for this feature, including conditional test actions and assertions:

test('My Test', async t => {
    if(t.browserInfo.name === 'IE')
        await t.click('#some-div');
});
@inikulin inikulin added TYPE: enhancement The accepted proposal for future implementation. AREA: client SYSTEM: API AREA: server labels Apr 25, 2016
@inikulin inikulin added this to the APIv2 new goodies milestone Apr 28, 2016
@inikulin inikulin changed the title APIv2: Implement t.browserInfo Implement t.browserInfo Sep 9, 2016
@AlexanderMoskovkin
Copy link
Contributor

It would be useful to add a concurrent worker number to the browserInfo (initially proposed in the #1778)

@miherlosev miherlosev modified the milestones: Planned, Sprint #16 Aug 14, 2018
@AndreyBelym AndreyBelym modified the milestones: Sprint #16, Sprint #17 Aug 14, 2018
@AndreyBelym AndreyBelym modified the milestones: Sprint #17, Planned Aug 30, 2018
@dlangerenken
Copy link

are there any updates on this? any planned release date? @AndreyBelym

@VasilyStrelyaev VasilyStrelyaev changed the title Implement t.browserInfo Access browser information from test code Feb 27, 2019
@VasilyStrelyaev VasilyStrelyaev changed the title Access browser information from test code Provide the capability to access browser information from test code Feb 27, 2019
@AndreyBelym
Copy link
Contributor

We have plans to implement this feature, but I can't give you an estimate yet. As a workaround, you can retrieve the navigator.userAgent property via a ClientFunction and then parse it using a third-party module (useragent):

import { ClientFunction } from 'testcafe';
import useragent from 'useragent';

fixture `get ua`
    .page `http://example.com`;

const getUA = ClientFunction(() => navigator.userAgent);

test('get ua', async t => {
    const ua = await getUA();

    console.log(useragent.parse(ua).family);
});

@lock
Copy link

lock bot commented Nov 29, 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 Nov 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 29, 2019
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this issue Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client AREA: server STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: API TYPE: enhancement The accepted proposal for future implementation.
Projects
None yet
Development

No branches or pull requests

6 participants