Environment variables are combining as one string when there is comma separated values via --env #14309
              
                Unanswered
              
          
                  
                    
                      senthiltr
                    
                  
                
                  asked this question in
                Component Testing
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HI,
I am start using cypress recently. I need to pass credentials(ip, username, password) via cli because need to run this tests on different VM. I used this command to pass credentials and get those values using Cypress.env('HOST'). But in cypress all the comma separated values combined and coming as one string. Can you please tell any wrong in my command and any other suggestion.
Currently using cypress release is below,
Cypress: 5.1.0 │
│ Browser: Firefox 84 │
│ Specs: 1 found (test.js) │
│ Searched: cypress\user_test_suites\test.js
command:
./node_modules/.bin/cypress run --env HOST="www.google.com",DATA="cypress tutorial" --headed --spec "cypress/user_test_suites/test.js" --browser firefox
tests:
describe("TEST1", function(){
it.only("test2",()=>{
cy.log(Cypress.env())
cy.visit(Cypress.env("HOST"))
cy.get("q").type(Cypress.env('DATA'))
})
})
output:
CypressError:
cy.visit()failed trying to load:http://www.google.com/%20data=cypress%20tutorial/
Cypress.env("HOST") giving as whole www.google.com data=cypress tutorial.
The below are the same result getting from 6.2.0
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 6.2.0 │
│ Browser: Firefox 84 │
│ Specs: 1 found (test.js) │
│ Searched: cypress\user_test_suites\test.js │
└──────────────────────────────────────────────────────────────────────────────────── Running: test.js (1 of 1)
TEST1
1) test2
0 passing (2s)
1 failing
test2:
CypressError:
cy.visit()failed trying to load:http://www.google.com/%20data=cypress%20tutorial/
The response we received from your web server was:
Thanks
Senthilkumar
Beta Was this translation helpful? Give feedback.
All reactions