skip to content

In a Cypress proof-of-concept, which flows do you spike first to expose a misfit?

level: seniorimportance: should knowfreq 42%

answer

  1. Automate the flows you fear first
  2. Green on the happy path proves nothing
  3. Which journeys leave your own domain
  4. Run it the way CI will
  5. End with a written verdict per flow

basics

~20 s

Spike the flows most likely to kill the decision, not the happy path: the journey that leaves your superdomain, the one that opens a second tab, the one your browser sign-off names, and the one that needs back-end seeding.

solid answer

~50 s

A proof-of-concept exists to find the misfit early, so automate the **hostile** flows first. In practice that means four candidates: the journey that leaves your superdomain and needs `cy.origin()`; the journey that opens a second tab or window; anything whose sign-off names a browser Cypress cannot launch, such as Safari or a real device; and a flow that cannot start without back-end state, to prove `cy.task()` or `cy.request()` can seed it. Run the spike the way CI will run it - `cypress run` headless on the CI image, not only `cypress open` on a laptop - because open mode flatters every tool. Time-box it, and record for each flow whether it worked, worked with a workaround, or did not work. A spike that only automates the easy path tells you nothing you did not already believe.

code

javascript · 14 lines
javascript
describe('freight portal evaluation spike', () => {
  it('crosses into the carrier identity domain and comes back', () => {
    cy.visit('/quotes/new')
    cy.get('[data-cy=carrier-sign-in]').click()

    cy.origin('https://sso.carrier-example.test', () => {
      cy.get('[name=account]').type('spike-account')
      cy.get('[data-cy=continue]').click()
    })

    cy.url().should('include', '/quotes/new')
    cy.get('[data-cy=quote-total]').should('be.visible')
  })
})

go deeper

for a junior

Know what a proof-of-concept is for: answering a question, not building the suite. Ask which flows worried the team before you write the first spec.

for a middle

Be ready to explain why the hostile flows come first and which Cypress limits each one probes - superdomain, second tab, browser coverage, back-end seeding.

for a senior

Show that you run the spike under the conditions CI will impose and judge it on readability and repeatability, not on a green tick from a laptop.

for a principal

Own the decision record. Turn the spike into a written per-flow verdict with costs attached, so the adoption choice outlives whoever ran it.

## Why the happy path proves nothing Every browser runner demos well. Point any of them at a list page, click a row, assert some text, and it will be green in twenty minutes. That result carries almost no information, because no serious tool fails there. The decision you are actually making is whether **this application** fits **this tool's boundaries**, and boundaries only show up where the application pushes against them. So invert the usual instinct. A Cypress proof-of-concept should start with the flows you are most afraid of, and it should be judged on what it *discovers*, not on how green it is. ## Rank the flows by what would kill the decision 1. **The journey that leaves your superdomain.** A test is bound to one superdomain, so a hop into an identity provider or a hosted payment page has to be written inside `cy.origin()`. Spike it to learn how often it appears and how readable the result is - once at sign-in is a seam; six times in one journey is a signal. 2. **The journey that opens a second tab or window.** Cypress drives one browser at a time. If the flow's assertion genuinely lives in the second tab, you are into the `@cypress/puppeteer` plugin, whose handlers run in Node. Find that out in week one, not in month three. 3. **Anything your sign-off list names that Cypress cannot launch.** It launches Chrome-family, Firefox and experimental WebKit. Safari itself and real mobile devices are not on that list, and `experimentalWebKitSupport` gives you the engine, not the browser. 4. **A flow that cannot start without back-end state.** Prove that `cy.task()` or `cy.request()` can seed it, and that somebody will own that seam, because a suite that cannot create its own data will be run manually within a quarter. 5. **The longest, most timing-sensitive flow you have.** This is where retry-ability either does the work or does not, and where an honest wall-clock number comes from. ## Run the spike the way CI will run it - Run `cypress run` headless on the image CI will use, not only `cypress open` on a developer laptop. Open mode is the tool at its most flattering, and it is not what the pipeline will do at 3am. - Point it at a real staging environment with real data volumes, not a fixture-only sandbox. - Pick the browser the pipeline will actually use with `--browser`, rather than accepting a default. - Record wall-clock time per spec, so the parallelisation conversation later has a number in it. ## What counts as a pass Green is not the bar. The bar is **green, readable, and repeatable**, with every misfit named. - Did each hostile flow pass without a workaround, with a first-party workaround, or not at all? - Would a new engineer read the resulting spec and understand it, or does it now carry two execution models - commands in the browser and handler code in Node? - Did it pass ten runs in a row on the CI image, or did it need retries nobody can explain? - How long did the spike take relative to what you predicted? That ratio is the most honest input you will get into the size of the real migration. - Did anyone outside the person running it read a spec and understand what it asserted? A suite one enthusiast can maintain is not a suite the team has adopted. Record a *worked with a workaround* result as its own outcome rather than folding it into a pass. The distinction between "Cypress did this" and "Cypress did this once we dropped into a plugin handler running in Node" is the whole content of the evaluation. ## Time-box it, and write down the verdict Give the spike a fixed budget - a few days, a named person - and end it with a short written verdict per flow rather than a demo. The useful artefact is a table of *flow, worked / worked with a workaround / did not work, and what the workaround costs*, because that table is what the adoption decision is actually made from, and it survives the person who ran the spike leaving the team. The failure mode to avoid is the spike that quietly becomes the suite. Spike code is written to answer a question, not to be maintained; if it is going to survive, it gets rewritten with the conventions the real suite will use. Otherwise the first thing a new team inherits is four specs written by someone who was still learning the tool.

  • How long should a Cypress proof-of-concept run before you decide?
    Long enough to cover the hostile flows and no longer - typically days, not weeks, with one named owner. The signal you need arrives early: either the awkward journeys are writable and readable, or they are not. A spike that drags on is usually being extended to justify a decision somebody has already made.
  • What do you do when the spike passes but only with a workaround on every hostile flow?
    Treat that as a finding, not a pass. One documented seam is fine; a workaround on every awkward journey means the application's shape and the tool's shape disagree. Price the ongoing readability cost, and compare it honestly against covering those flows another way.

saying these in an interview costs you the question

  • Spikes the easiest flow to get a fast green
  • Runs the spike only in cypress open locally
  • Never checks the required browser sign-off list
  • Judges the spike on pass rate alone
  • Lets the throwaway spike become the real suite