title: How to access the value of baseURL in Cypress
body: <p>I'm just starting to learn JavaScript and have been using Cypress to automate some regression tests. The test I writing currently is meant to verify link's text and href in a header and footer.</p>
  
  <p>The issue I am having is that these tests need to be run across various environments and I cannot seem to access the baseUrl property set in the cypress.json in order to set the domain in my assertion.</p>
  
  <p>In the script that follows it is the line <code>cy.get("a").should("have.attr", "href", baseUrl + footerLink.link)</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    it.only("translates the content info section", () =&gt; {
        cy.wrap(orbitData).each(service =&gt; {
          cy.visit(service.name);
          cy.get("#orb-contentinfo &gt; div &gt; ul &gt; li").each(($li, index) =&gt; {
            let footerLink = service.links[index]
            cy.wrap($li).should("have.text", footerLink.linkText)
            .within(($li) =&gt; {
              cy.get("a").should("have.attr", "href", baseUrl + footerLink.link)
            });
          });
        });
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>So far I have tried a number of things, I'm a bit embarrassed to list them all, I'm new to this so they're probably insane and definitely just guesses; amongst them were <code>Cypress.env('CYPRESS_baseUrl')</code> and <code>Cypress.baseUrl</code>. Each time it just comes back as <code>undefined</code>.</p>
  
  <p>Or, if I'm attacking this in completely the wrong way any guidance on a better way would be appreciated. I'd be grateful for any help or guidance, thanks.</p>