Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-76797 || Tests steps fix #47

Merged
merged 1 commit into from
May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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