question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the capability to perform testing in multiple browser windows

See original GitHub issue

Are you requesting a feature or reporting a bug?

Feature

What is the current behavior?

You can run test only in single window of the browser

What is the expected behavior?

It’s useful to run test in multiple windows to simultaneously observe results from different users perspective. E.g. we test online chat or online game. The idea is to spawn new windows in test and switch test context to that window (It also we’ll play well with Roles feature):

test('Multi-window', async t => {
     await t
           .switchRole(user1)
           .click('#start-game')

           .switchToWindow(1)   // Spawns new browser window if it wasn't used before
           .switchRole(user2)
           .click('#start-game')
           .click('#shoot')

           .switchToWindow(0); // Return to default window

    expect(await healthbar.value).eql(0);   
});

The syntax is still a subject for bikeshedding. \cc @DevExpress/testcafe

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:211
  • Comments:94 (26 by maintainers)

github_iconTop GitHub Comments

17reactions
miherlosevcommented, Apr 23, 2020

Hi guys,

We are ready to introduce the testcafe@1.8.5-alpha.1 version with the basic support of testing in multiple browser windows.

The ‘basic support’ means that TestCafe will open a new browser window and close it in the same way as a web browser. This functionality covers the ‘Login via something’ scenario. To switch to another browser window, you don’t need to execute any additional actions - TestCafe does this automatically. See the ‘Login via Google’ example:

import { Selector, ClientFunction } from 'testcafe';

fixture `JustPark`
    .page('https://www.justpark.com/');

const loginLink          = Selector('a').withText('Login');
const findParkingLink    = Selector('a').withAttribute('track', 'click:web-nav:home');
const continueWithGoogle = Selector('button.bt--google ');

const getLocation = ClientFunction(() => window.location.href);

const GOOGLE = {
    Email:           Selector('input[type=email]'),
    NextEmailBtn:    Selector('#identifierNext').find('span'),
    Password:        Selector('input[type=password]'),
    NextPasswordBtn: Selector('#passwordNext').find('span')
};

test('Login via Google', async t => {
    await t
        .click(loginLink)
        .click(continueWithGoogle)
        .typeText(GOOGLE.Email, '<your email>')
        .click(GOOGLE.NextEmailBtn)
        .typeText(GOOGLE.Password, '<your password>')
        .click(GOOGLE.NextPasswordBtn)
        .click(findParkingLink)
        .expect(getLocation()).eql('https://www.justpark.com/dashboard/bookings/made/', { timeout: 30000 });
});

‘Testing in multiple browser windows’ is an experimental option. To use it, you need to add the necessary command line or programmatic option.

// Command line interface

testcafe chrome test.js --allow-multiple-windows

//Programmatic interface

const runner = testcafe.createRunner();

return runner
    .src('test.js')
    .browsers('chrome')
    .run({ allowMultipleWindows: true });

At present, not all the problems related to the ‘Testing in multiple browser windows’ feature are fixed (for example, Login via Facebook is too slow). We continue working on bug fixes and stability improvements and will release a new TestCafe version with necessary fixes as soon as possible.

Guys, try to write tests that require the multiple browser window support and run them with the testcafe@1.8.5-alpha.1 version. Please share your experience with us. Also, we really want to know what functionality you require besides the basic support of testing in multiple windows.

If you face any issues or have any suggestions, please create separate issues with the window management tag.

9reactions
miherlosevcommented, Feb 15, 2021

Folks

We are happy to announce that we released the mentioned feature (‘Add the capability to perform testing in multiple browser windows’) in testcafe@1.11.0. See the documentation in the following help topic: https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/multiple-browser-windows.html.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Cross Browser Testing and How to Perform It
Cross Browser Testing is a type of testing to verify if an application works across different browsers as expected and degrades gracefully.
Read more >
Cross Browser Testing using Selenium WebDriver - Guru99
Cross Browser Testing is a type of functional test to check that your web application works as expected in different browsers.
Read more >
Cross Browser Testing in Selenium : Tutorial | BrowserStack
Learn how to get started with cross browser testing using Selenium with examples. Read about best practices to follow for multi browser ......
Read more >
Introduction to cross-browser testing - Learn web development
Cross -browser testing is the practice of ensuring that a website works across various browsers and devices. Web developers should consider:.
Read more >
Cross Browser Testing in Selenium [Tutorial] - LambdaTest
Browser coverage is an integral aspect of test coverage. The primary agenda of cross browser testing is to perform testing on different browsers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found