0

I have used the example from : https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs#defining-multiple-flows

and trying to run the test parallelly so that each browser will be concurrently executed. Here is the script:

const {Builder, By, Key, until} = require('selenium-webdriver');

var browsers = [
    { browserName: 'chrome' },
    { browserName: 'firefox'},
];

browsers.map(browser => {
    describe('Google Search', function() {
        let driver;

        beforeEach(async function() {
            driver = await new Builder().forBrowser(browser.browserName).build();
        }, 10 * 1000);

        afterEach(async function() {
            await driver.quit();
        });

        it('example', async function() {
            await driver.get('https://www.google.com/ncr');
            await driver.manage().setTimeouts({ implicit: 5000 })
            await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
            await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
        }, 10 * 1000);
    });
});

My knowledge in jest/jscript is limited. Apologies if there is anything fundamentally wrong.

I have tried both running locally and running against zalenium. In both cases, tests are running sequentially.

Thank you for the Help in making the script run parallelly.

skyboyer
  • 22,209
  • 7
  • 57
  • 64
wantro
  • 373
  • 1
  • 7
  • 18
  • afaik jest may run each file in own thred, not each declaration inside single file. and what's a point? do you want to perform load testing? – skyboyer Aug 06 '19 at 20:57
  • Yes, I want the tests to run concurrently so that it takes much less time. – wantro Aug 06 '19 at 21:11
  • I mean you are ruining exactly same test for several times here. if you do functional testing you may split test into several files and they should run well in parallel. – skyboyer Aug 06 '19 at 22:16
  • refer https://stackoverflow.com/questions/47291189/is-there-a-way-to-run-some-tests-sequentially-with-jest?rq=1 – kTn Dec 24 '19 at 12:31

0 Answers0