Skip to content

Commit

Permalink
EPMRPP-76797 || Tests steps fix (#47)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Zyabrev <[email protected]>
  • Loading branch information
renkyoji and Aleksandr Zyabrev authored May 16, 2022
1 parent ff78387 commit 9a4b940
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,15 @@ export class RPReporter implements Reporter {
const { includeTestSteps } = this.config;
if (!includeTestSteps) return;
const playwrightProjectName = test.parent.project().name;
const { id: testItemId } = this.findTestItem(this.testItems, test.title, playwrightProjectName);
const testItem = this.findTestItem(this.testItems, test.title, playwrightProjectName);
if (!testItem) return;
const stepStartObj = {
name: step.title,
type: TEST_ITEM_TYPES.STEP,
hasStats: false,
startTime: this.client.helpers.now(),
};
const { tempId, promise } = this.client.startTestItem(stepStartObj, this.launchId, testItemId);
const { tempId, promise } = this.client.startTestItem(stepStartObj, this.launchId, testItem.id);

this.addRequestToPromisesQueue(promise, 'Failed to start nested step.');

Expand All @@ -410,16 +411,17 @@ export class RPReporter implements Reporter {
const { includeTestSteps } = this.config;
if (!includeTestSteps) return;
const playwrightProjectName = test.parent.project().name;
const { id } = this.findTestItem(this.nestedSteps, step.title, playwrightProjectName);
const testItem = this.findTestItem(this.nestedSteps, step.title, playwrightProjectName);
if (!testItem) return;
const stepFinishObj = {
status: step.error ? STATUSES.FAILED : STATUSES.PASSED,
endTime: this.client.helpers.now(),
};

const { promise } = this.client.finishTestItem(id, stepFinishObj);
const { promise } = this.client.finishTestItem(testItem.id, stepFinishObj);

this.addRequestToPromisesQueue(promise, 'Failed to finish nested step.');
this.nestedSteps.delete(id);
this.nestedSteps.delete(testItem.id);
}

async onTestEnd(test: TestCase, result: TestResult): Promise<void> {
Expand Down

0 comments on commit 9a4b940

Please sign in to comment.