actionLine function ✓ 100.0%

Last updated: 2026-03-01T23:25:47.083Z

Metrics

LOC: 26 Complexity: 10 Params: 3 Coverage: 100.0% (11/11 lines, 20x executed)

Signature

actionLine( action: CapturedAction, useSmartSelectors: boolean, ): : string

Source Code

function actionLine(
  action: CapturedAction,
  useSmartSelectors: boolean,
): string {
  const sel = escapeString(resolveSelector(action, useSmartSelectors));
  const val = escapeString(action.value);
  const comment = action.label ? `  // ${action.label}` : "";

  switch (action.actionType) {
    case "fill":
      return `    cy.get('${sel}').clear().type('${val}');${comment}`;
    case "check":
      return `    cy.get('${sel}').check();${comment}`;
    case "uncheck":
      return `    cy.get('${sel}').uncheck();${comment}`;
    case "select":
      return `    cy.get('${sel}').select('${val}');${comment}`;
    case "radio":
      return `    cy.get('${sel}').check();${comment}`;
    case "clear":
      return `    cy.get('${sel}').clear();${comment}`;
    case "click":
    case "submit":
      return `    cy.get('${sel}').click();${comment}`;
  }
}

Dependencies (Outgoing)

graph LR actionLine["actionLine"] escapeString["escapeString"] resolveSelector["resolveSelector"] actionLine -->|calls| escapeString actionLine -->|calls| resolveSelector style actionLine fill:#dbeafe,stroke:#2563eb,stroke-width:2px click actionLine "6eb2155c83621b30.html" click escapeString "5c2f25e3b4548c2d.html" click resolveSelector "361a4021ea67e76c.html"
TargetType
escapeString calls
resolveSelector calls

No incoming dependencies.