playwright-bdd
Version:
BDD Testing with Playwright runner
54 lines • 2.72 kB
TypeScript
/**
* Transforms the envelope set consumed by the HTML formatter.
*
* Cucumber HTML renders only the final non-retried attempt for a scenario. This transformer
* builds a dedicated finalRetryTestCase for that HTML view, replacing the shared TestCase envelopes
* while dropping retried attempts and step envelopes that no longer belong to the final retry.
*/
import * as messages from '@cucumber/messages';
import { MessagesBuilder } from '../messagesBuilder';
export declare class EnvelopesTransformer {
private messagesBuilder;
private finalRetryTestCases;
private finalRetryTestCaseRunIds;
private finalRetryTestStepIdsByRunId;
constructor(messagesBuilder: MessagesBuilder);
/**
* Build HTML-specific test cases for the final non-retried attempts.
* They reuse the canonical TestCase step IDs so step envelopes emitted for the final retry
* continue to match after hook steps are filtered out.
*/
private buildFinalRetryTestCases;
/**
* Replaces or drops each envelope for the HTML view:
* - testCase envelopes are replaced with the final-retry version (filtered hook steps)
* - envelopes belonging to retried attempts are dropped entirely
* - hook step envelopes that are absent in the final-retry testCase are dropped
* - all other envelopes pass through unchanged
*/
transformEnvelope(envelope: messages.Envelope): messages.Envelope | undefined;
/**
* Drops envelopes that belong to retried (non-final) test case runs.
* A testCaseStartedId is present on testCaseStarted / testCaseFinished / testStepStarted /
* testStepFinished / attachment envelopes — any of these must be discarded for retried runs.
*/
private shouldDropRetriedAttemptEnvelope;
/**
* Drops hook step envelopes that were executed in a previous retry but not in the final run.
* Only envelopes that carry both a testCaseStartedId and a testStepId are checked, because
* only those are tied to a specific step (testStepStarted, testStepFinished, attachment).
*/
private shouldDropHookStepEnvelope;
/**
* Extracts the testCaseStartedId that ties an envelope to a particular test run attempt.
* Each envelope type stores it under a different field name, so all variants are checked.
*/
private getTestCaseStartedId;
/**
* Extracts the testStepId from envelopes that are scoped to a specific step.
* Only testStepStarted, testStepFinished and attachment carry this field;
* other envelope types return undefined, which tells the caller the envelope is not step-scoped.
*/
private getTestStepId;
}
//# sourceMappingURL=envelopesTransformer.d.ts.map