OpenAPITools / OpenAPITools/openapi-generator

[REQ] Cypress API Generator

Open
#8,008 10 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

We've found ourselves frustrated in having to write a manual API for doing state setup in our Cypress E2E tests.

Describe the solution you'd like

A Typescript Cypress generator that creates a library that uses cy.request for requests, and includes all the models as well, so we get type completion

Describe alternatives you've considered

We're currently using the ts-node generator and using cy.then to make requests in cypress through the ts-node generated library, but this doesn't use cypress's cy worker and logging, which makes debugging issues much harder, as you do not know what request failed, and command ordering is more unpredictable.

Additional context

All cy commands in cypress, go into a worker queue, for the Cypress runner to execute in FIFO order, rather than using the native async/await, which can obscure the execution order of commands if not using all cy commands, as well as obscures errors that occur.

I think all that really needs to happen is for the generator to make cy.request commands instead of node's built in request library

Intro to what Cypress is:
https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-Can-Be-Simple-Sometimes

Explanation of Cypress's worker/runner:
https://docs.cypress.io/guides/core-concepts/test-runner.html#Overview

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing ts-node generator and its request-library entry point, then review how generated models and Cypress's cy.request are represented in the repository. Done means a TypeScript Cypress generator produces typed models and queues requests through cy.request, with coverage or validation for the generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cypress, openapi, typescript
Domain
api, testing, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.