'Cypress - How do I change URL for gitlab ci pipeline?
I'm very new to E2E test, cypress and gitlab ci. My idea is to run cypress test before each merge. But I don't know how to change the URL that I'm testing when I run a pipeline on gitlab. Let's say this is my first test:
it('Exibição de modal no clique do botão', () => {
cy.visit('http://127.0.0.1:8000');
cy.get('.inner-header-pt2 .header-buttons__cadastro').click();
cy.get('.modal--login').should('be.visible');
})
For my local environment, I'm using the URL http://127.0.0.1:8000. How do I change to the right URL when I run this test on gitlab ci pipeline? Any help?
Solution 1:[1]
I suggest the following
- Create multiple config files, each with different urls
- Target these in your plugins/index.js
- Create a command in your package.json for each environment
- Execute the corresponding command on your ci pipeline
Here is a detailed instruction: https://ahmed-alsaab.medium.com/configuring-cypress-to-run-on-different-environments-7ae323bb3c86
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | EustassX |
