Skip to content

Commit

Permalink
release: v3.4.0-rc.2 (#8065)
Browse files Browse the repository at this point in the history
## Approach
update version release in package and package-lock
update method _updateTestControllerQueues in src\runner\browser-job.ts

## Pre-Merge TODO
- [x] Write tests for your proposed changes
- [x] Make sure that existing tests do not fail
  • Loading branch information
PavelMor25 committed Nov 2, 2023
1 parent 095273d commit b99c72c
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "testcafe",
"description": "Automated browser testing for the modern web development stack.",
"license": "MIT",
"version": "3.4.0-rc.1",
"version": "3.4.0-rc.2",
"author": {
"name": "Developer Express Inc.",
"url": "https://www.devexpress.com/"
Expand Down
10 changes: 7 additions & 3 deletions src/runner/browser-job.ts
Expand Up @@ -214,13 +214,17 @@ export default class BrowserJob extends AsyncEventEmitter {
return this._testRunControllerQueue;
}

private _getNextFixtureFirstTestIndex ( fixtureId: string ): number {
const nextFixtureFirstTestIndex = this._testRunControllerQueue.findIndex(testRun => testRun.test.fixture?.id !== fixtureId);

return nextFixtureFirstTestIndex === -1 ? this._testRunControllerQueue.length : nextFixtureFirstTestIndex;
}

private _updateTestControllerQueues ({ test }: TestRunController, connectionId: string): void {
if (!test.disableConcurrency || this._disableConcurrencyQueue[connectionId]?.length)
return;

const lastIndexFixture = this._testRunControllerQueue.findIndex(el => el.test.fixture?.id !== test.fixture?.id);

this._disableConcurrencyQueue[connectionId] = this._testRunControllerQueue.splice(0, lastIndexFixture);
this._disableConcurrencyQueue[connectionId] = this._testRunControllerQueue.splice(0, this._getNextFixtureFirstTestIndex(test.fixture?.id as string));
}

// API
Expand Down
26 changes: 22 additions & 4 deletions test/functional/fixtures/regression/gh-2011/test.js
@@ -1,8 +1,18 @@
const path = require('path');
const createTestCafe = require('../../../../../lib');
const path = require('path');
const createTestCafe = require('../../../../../lib');
const { createReporter } = require('../../../utils/reporter');
const { expect } = require('chai');

let testCafe = null;
let runner = null;
let errors = null;

const reporter = createReporter({
reportTestDone (_, testRunInfo) {
errors = testRunInfo.errs;
},
});


const run = (pathToTest, concurrency) => {
const src = path.join(__dirname, pathToTest);
Expand All @@ -16,6 +26,7 @@ const run = (pathToTest, concurrency) => {
return runner
.src(src)
.browsers(`chrome:headless`)
.reporter(reporter)
.concurrency(concurrency)
.run();
})
Expand All @@ -27,10 +38,17 @@ const run = (pathToTest, concurrency) => {
describe('[Regression](GH-2011)', function () {

it('Should execute all fixture\'s test with disableConcurrency in one browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-test.js', 3);
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-test.js', 3)
.then(() => expect(errors.length).eql(0));
});

it('Should execute all fixture\'s in different browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-all-test.js', 3);
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-all-test.js', 3)
.then(() => expect(errors.length).eql(0));
});

it('Should execute all fixture\'s test in one browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-and-one-fixture-test.js', 3)
.then(() => expect(errors.length).eql(0));
});
});
@@ -0,0 +1,24 @@
const connectionsFixture = {};

const addConnection = (connections, connectionId) => {
connections[connectionId] = true;
};

fixture `no concurrent fixture`
.beforeEach(async t => {
addConnection(connectionsFixture, t.testRun.browserConnection.id);
})
.afterEach(async t => {
await t.expect(Object.keys(connectionsFixture).length).eql(1);
})
.page `http://localhost:3000/fixtures/regression/gh-2011/pages/index.html`
.disableConcurrency();

test('long concurrent test 1', async t => {
await t.wait(5000);
});

for (let i = 0; i < 10; i++) {
test(`no concurrent test ${i}`, async () => {
});
}

0 comments on commit b99c72c

Please sign in to comment.