Linked Questions

Popular Questions

I have a test suite that opens a local url before making a bunch of assertions on some DOM elements.

Now I'd like to integrate Cypress in my CI/CD but I'm unsure on how to tell Cypress to visit the staging url instead of the local one.

Any idea?

it('The body of the page is in viewport', function() {
    cy.visit(
      'http://mylocalurltovisit.local.com.au:8666/foo'
    );
    let initialPosition;
    const body = cy.get('body');
    body.should('have.class', 'pdfView');
    cy.get('.body-wrapper').should($el => {
      initialPosition = $el.position();
      expect(initialPosition.top).equal(0);
      expect(initialPosition.left).equal(0);
    });
  });

I'd like for the visit url to automatically switch to say the staging one (which could be http://staging.com.au/foo) on the CI environment.

Related Questions