diva-e-cypress - v1.0.3
    Preparing search index...

    StepsPrompt ist eine spezialisierte Prompt-Vorlage, die Anweisungen für ein Sprachmodell bereitstellt, um basierend auf einem Gherkin-Feature, dem Pfad zur Selectors-Datei und dem Inhalt dieser Datei eine vollständige TypeScript-Datei mit Cypress-Step-Definitions zu erzeugen.

    Die generierte Datei enthält standardisierte Step-Implementierungen für Cypress-Tests und folgt strikten Vorgaben für Struktur und Syntax, sodass sie direkt in einer automatisierten Testumgebung verwendet werden kann.

    Einsatzgebiet: Automatisierte Generierung von Step-Definitions für End-to-End-Tests.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    instruction: "\nYou are a Cypress step-definition generator. You will be given the following inputs:\n- Feature text: a complete .feature Gherkin file.\n- Selectors module path: e.g. \"../selectors/orchestrator_selectors\".\n- Selectors file content: TypeScript code that exports helper functions such as:\n - visitHomepage()\n - clickLabel(label)\n - getLabel(label)\n - (plus optional element helpers)\n- Temporary step file content: an auto-generated step-definition skeleton that contains one step per line from the feature, with // TODO: implement step placeholders.\n\nYour task:\n- Replace the placeholder step bodies in the step-definition file with working Cypress code:\n 1. Starts with exactly:\n import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';\n import * as sel from '{{selectorsModulePath}}';\n 2. For each step line in the feature, replace the // TODO with exactly one Cypress chain using the helpers from the selectors file. \n Always return the chain (no await, no plain cy. without return). \n Do not leave any step unimplemented.\n ONLY use the selectors that are fitting to the steps definition, you MAY use selectors multiple times if viable.\n 3. Do not modify the step text.\n No regex.\n No parameter placeholders ({string}, {int}, {word}, etc).\n Each step definition must reproduce the literal step text as written in the feature.\n 4. No control flow.\n No if/else.\n No loops.\n No ternaries.\n 5. No extra imports, no comments, no code fences, no JSON.\n\nFeature:\n{{featureText}}\n\nSelectors Module Path:\n{{selectorsModulePath}}\n\nSelectors File Content:\n{{selectorsTs}}\n\nSteps File Content:\n{{tempStepsTs}}\n" = ...

    Die vollständige Prompt-Vorlage für die Steps-Erzeugung. Diese enthält Regeln, erwartetes Format und Platzhalter für Eingabedaten.

    Methods

    • Erzeugt den vollständigen Prompt mit eingefügtem Feature-Text, Pfad zur Selector-Datei und deren Inhalt.

      Parameters

      • featureText: string

        Der Gherkin-Featuretext (z. B. aus einer .feature-Datei)

      • selectorsModulePath: string

        Relativer Pfad zur Selektoren-Datei

      • selectorsTs: string

        TypeScript-Inhalt der Selektoren-Datei

      • tempStepsTs: string

        TypeScript-Inhalt der vorgeschriebenen Steps-Datei

      Returns string

      Der formatierte Prompt-Text zur Weitergabe an ein LLM

      const prompt = new StepsPrompt();
      const stepsPromptText = prompt.getPrompt(
      'Feature: Login\nScenario: ...',
      '../selectors/orchestrator_selectors',
      'export function selLoginButton() { ... }'
      );
    • Ersetzt sämtliche Platzhalter in der Instruction durch die Werte, die im Kontext übergeben werden.

      Parameters

      • context: PromptContext

        Objekt mit Schlüssel-Wert-Paaren zur Ersetzung der Platzhalter.

      Returns string

      • Fertiger Prompt-String, der vom LLM verarbeitet werden kann.
      const context = {
      featureText: 'Login-Feature',
      htmlSnapshot: '<div>Snapshot</div>'
      };
      const promptText = myPrompt.render(context);