Skip to content

Commit

Permalink
Merge pull request #131 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.1.6
  • Loading branch information
AmsterGet authored Dec 19, 2023
2 parents 16b7b19 + 5151fbd commit a869804
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Fixed
- Serial mode execution. Fix invocations calculation for indirect test parents.

## [5.1.5] - 2023-12-19
### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.5
5.1.6-SNAPSHOT
2 changes: 0 additions & 2 deletions src/__tests__/reporter/finishSuiteReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('finish suites on finish all of their children', () => {
name: rootSuite,
testInvocationsLeft: 1,
descendants: ['testItemId'],
isSerialMode: false,
},
],
[
Expand All @@ -86,7 +85,6 @@ describe('finish suites on finish all of their children', () => {
name: suiteName,
testInvocationsLeft: 1,
descendants: ['testItemId'],
isSerialMode: false,
},
],
]);
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/reporter/finishTestItemReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ describe('finish test reporting', () => {
name: rootSuite,
testInvocationsLeft: 1,
descendants: ['testItemId'],
isSerialMode: false,
},
],
[
Expand All @@ -78,7 +77,6 @@ describe('finish test reporting', () => {
name: suiteName,
testInvocationsLeft: 1,
descendants: ['testItemId'],
isSerialMode: false,
},
],
]);
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/reporter/startSuiteTestReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('start reporting suite/test', () => {
id: 'tempTestItemId',
name: rootSuite,
testInvocationsLeft: 1,
isSerialMode: false,
descendants: ['testItemId'],
},
],
Expand All @@ -94,7 +93,6 @@ describe('start reporting suite/test', () => {
name: suiteName,
descendants: ['testItemId'],
testInvocationsLeft: 1,
isSerialMode: false,
},
],
]);
Expand Down
10 changes: 5 additions & 5 deletions src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ interface Suite extends TestItem {
logs?: LogRQ[];
testInvocationsLeft?: number;
descendants?: string[];
isSerialMode?: boolean;
executedTestCount?: number;
}

Expand Down Expand Up @@ -332,7 +331,6 @@ export class RPReporter implements Reporter {
this.addRequestToPromisesQueue(suiteObj.promise, 'Failed to start suite.');

// @ts-ignore access to private property _parallelMode
const isSerialMode = currentSuite._parallelMode === 'serial';
const allSuiteTests = currentSuite.allTests();
const descendants = allSuiteTests.map((testCase) => testCase.id);
const testCount = allSuiteTests.length;
Expand All @@ -349,7 +347,6 @@ export class RPReporter implements Reporter {
name: currentSuiteTitle,
testInvocationsLeft,
descendants,
isSerialMode,
...(status && { status }),
...(logs && { logs }), // TODO: may be send it on suite start
});
Expand Down Expand Up @@ -584,14 +581,17 @@ export class RPReporter implements Reporter {
decreaseIndex = decreaseIndex + possibleInvocationsLeft;
}

// @ts-ignore access to private property _parallelMode
const isSerialMode = test.parent._parallelMode === 'serial'; // is test run with "serial" mode

this.suites.forEach((value, key) => {
const { descendants, testInvocationsLeft, isSerialMode, executedTestCount } = value;
const { descendants, testInvocationsLeft, executedTestCount } = value;

if (descendants.length && descendants.includes(test.id)) {
// if test will not be retried anymore, we consider it as finally executed
const newExecutedTestCount = executedTestCount + (nonRetriedResult ? 1 : 0);
/* In case one test from serial group will fail, all tests from this group will be retried,
so we need to increase _testInvocationsLeft_ by already finished test amount, see https://playwright.dev/docs/test-retries#serial-mode
so we need to increase _testInvocationsLeft_ of all its ancestors by already finished test amount, see https://playwright.dev/docs/test-retries#serial-mode
*/
const serialModeIncrement = isSerialMode ? executedTestCount : 0;
const newTestInvocationsLeft = testInvocationsLeft - decreaseIndex + serialModeIncrement;
Expand Down

0 comments on commit a869804

Please sign in to comment.