title: Passing a variable's value from a test to the next one in Cypress
body: <p>Is it possible to pass a variable from one <code>it</code> test to the next <code>it</code> test ? The following using <code>cy.wrap</code> does not work:</p>
  <pre class="lang-js prettyprint-override"><code>it('test1', () =&gt; {
   const var1 = 'test'
   cy.wrap(var1).as('var1Alias')
  })
  it('test2', () =&gt; {
   cy.get('@var1Alias').then(var1Alias =&gt; {
      // do stuff with the var1Alias
    })
  })
  </code></pre>
  <p>I've checked old stackoverflow questions similar to mine such as this: <a href="https://stackoverflow.com/questions/57588085/use-variables-across-multiple-it-statements-to-track-change-in-cypress">Use variables across multiple &#39;it&#39; statements to track change in Cypress</a> and the difference is that the variable is declared globally outside the tests (<code>it</code>). Hence, you can always replace the variable.</p>
  <p>My specific issue is that the dependency on the variable's value from the previous test. I know Cypress best practice suggests that tests shouldn't be sequential but this is a common scenario in my opinion to properly categorise tests in a readable manner.</p>
  <p>For context, my first test is calling a POST endpoint then the response body will be passed as a query parameter for my GET endpoint in the succeeding test.</p>
  <p>Current workarounds (while I am still looking for a better option):</p>
  <ul>
  <li>Use fixtures and write then retrieve (slower runtime)</li>
  <li>Use localstorage-commands plugin (I have multiple variables to retrieve)</li>
  <li>Include the succeeding test inside the arrow function of the previous test (thus combination both tests in one test)</li>
  </ul>