Removing Cypress default proxy settings - proxy

I'm having trouble to load the page of my application under test when running Cypress test. After long investigation I figured out that Cypress is using a corporate proxy which is retrieved from my environment variables according to documentation https://docs.cypress.io/guides/references/proxy-configuration.html#View-proxy-settings-in-Cypress
This proxy is no longer active so I remove it from my environment variables but Cypress is still using it even after restarting both cypress and VsCode.
I also tried the following solutions:
clean up Cypress cache folder
uninstall Cypress and install it again
Installing Cypress on a teammate's machine who never had the proxy environment variables configured worked fine.
My question is: Why Cypress is still retrieving the HTTP_PROXY env var which no longer exists ? How to remove this from Cypress settings ?
Thanks a lot for your help.

environment variables are available in cypress through :
1) Approach 1
adding environment variable through terminal or command line as : CYPRESS_
eg : CYPRESS_TEST create variable TEST
you can see all the variables by typing set in cmd and env in shell , search for cypress in that
2)Approach 2:
to environment file or config file:
check if these files has proxy environment variables:
**3) using plugin file **
check the index.js in plugin folder for
config.env
see if you have proxy variable set in any of these location ( Or from tests ) and try to remove it

Related

How to run pre/post job scripts on self-hosted GitHub Actions runner

Problem
I am trying to use a Windows Docker container to run GitHub Actions.
I want to run scripts before and after the job (e.g. to clean the directory).
I have successfully done this before on a computer not running docker, so I figured the same should work in docker.
What I have tried
I found here that you can do that using Environment Variables.
I used the following two commands in command prompt to set the environment variables.
Pre-Job Script:
setx ACTIONS_RUNNER_HOOK_JOB_STARTED C:\actions-runner-resources\scripts\pre-post-build\pre-run-script.ps1
Post-Job Script:
setx ACTIONS_RUNNER_HOOK_JOB_COMPLETED C:\actions-runner-resources\scripts\pre-post-build\post-run-script.ps1
The scripts do not run.
I have tried restarting the docker container.
I have tried restarting the actions runner service.
I am new to docker, so I am wondering if I am doing something wrong with the environment variables that does not work with docker.
How do I get the actions runner to run pre/post job scripts in docker?
You can safely add them to your environment variable by doing this recommended method;
Inside the actions-runner directory, locate the .env file, edit it by adding your environment variable. Save and restart the runner service.

The JMETER_HOME environment variable is not defined correctly

I'm getting this error when trying to run this jmeter sentence from a maven project in java.
jmeter -g DIRECTORY -o DIRECTORY
When I run it in cmd it works perfectly but when I try to run it using this:
processBuilder.command("cmd.exe","/c","jmeter -g DIRECTORY -o DIRECTORY");
processBuilder.directory(new File("C:\\apache-jmeter-5.3\\bin"));
try {
Process process = processBuilder.start();
It says The JMETER_HOME environment variable is not defined correctly
When I run the command echo %JMETER_HOME% it returns C:\apache-jmeter-5.3
What I found weird is that in other PC it all works fine and that one doesn't have the JMETER_HOME variable defined, so I tried deleting the variable from this PC but it won't delete, it's not appearing in the system variables window but when I echo it's there.
What is going on?
Thanks in advance
So you want us to guess what is the difference between one your PC and the other one without providing any information apart from incomplete code?
I can only state that I cannot reproduce your issue and yes, I don't have JMETER_HOME variable set anywhere.
If you're using Maven maybe it worth considering looking at JMeter Maven Plugin which can automatically download JMeter, run the test and generate the HTML reporting dashboard.
Also be informed that according to JMeter Best Practices you're supposed to use the latest version of JMeter so consider upgrading to JMeter 5.4.3 (or whatever is the latest version of JMeter available at JMeter Downloads page) on next available opportunity.
I faced same issue of JMETER_HOME not been set, even though I tried setting that Env variable.
I was tying to launch the Jmeter on the Virtual system (VM) using command prompt, and didn't succeed.
I able to solve it by running the command prompt as admin and launching Jemter, it worked fine.
Note: make sure you have the set the Env. PATH set to the bin folder of Jmeter

Jmeter_home environment variable is not defined correctly in Jenkins only ,works fine with cmd prompt

I am trying to integrate jmeter with Jenkins and when I try to execute getting jmeter_home env variable, is not defined correctly. It works perfectly when try to execute through the command prompt.
Tried multiple options of setting jmeter_home in Jenkins config global as ~/.jmeter.
Changing jmeter path in system and through a couple of options but no luck.
The environment variable name is case-sensitive, it needs to be JMETER_HOME
Tilda resolves to $HOME environment variable in shell, it might be the case it isn't set so in that case you might want to use full path or check your OS configuration
In general as per JMETER_HOME variable description
(Optional) May point to your JMeter install dir. If empty
it will be set relativ to this script.
So you don't have to pass it, JMeter will "guess" its home from the jmeter starup script location
Also remember that you can always launch JMeter .jar file directly as:
java -jar /path/to/ApacheJMeter.jar
And last but not the least you may find Continuous Integration 101: How to Run JMeter With Jenkins article useful

Add Laravel .env variable to Vue component

I would like to get access to an .env variable using Vue JS.
In my .env file I have added the 'MIX_' prefix to the var.
MIX_VAR=key
And then in the vue component, I have in the created():
console.log(process.env.MIX_VAR);
I keep getting undefined as the result.
I have tried clearing config cache, but still getting the same issue. Any ideas?
in windows :
thats worked for me without any require in webpack.mix
... just add a new variable in env file with this prefix : MIX_
MIX_API_URL=http://laravel:8000
but need to restart php artisan serve and also restart npm run watch....
let api_url = process.env.MIX_API_URL;
console.log("my env variable:");
console.log(api_url);
in linux or docker:
i didnt use them yet
You must build your JS for the env variables to be replaced. You can do this with npm or yarn
https://laravel.com/docs/5.7/mix#running-mix
Pulled from the official docs # https://laravel.com/docs/5.6/mix#environment-variables
Environment Variables
You may inject environment variables into Mix by prefixing a key in your .env file with MIX_:
MIX_SENTRY_DSN_PUBLIC=http://example.com
After the variable has been defined in your .env file, you may access via the process.env object. If the value changes while you are running a watch task, you will need to restart the task:
process.env.MIX_SENTRY_DSN_PUBLIC
The most important thing to remember is that you have to use Laravel Mix for this to work. Mix is what is injecting the environment variable.
process.env.MIX_VAR / process.env.MIX_STRIPE_KEY
It's will work without any settings. Just run this command
npm run prod
This works for me
https://laravel.com/docs/8.x/mix#environment-variables
However, you will need to restart the task if the environment variable's value changes while the task is running:
e.g If Watch is running then re-run it.
npm run watch

Jenkins is not picking up Environment variable to be used in windows batch script

I am building a visual studio solution containing number of project. I wanted to disable multiprocess build, so , i tried setting an enviroment variable CL to /MP1. But it didn't worked in Jenkins while working in running the batch script for building solution using command line.
Good morning,
Log to your Jenkins server, and stop the Jenkins from the command line. While doing this, open your web-browser and refresh the Jenkins webpage to make sure it stopped(it will take around 5 seconds to stop the service). Then start again from the command line, it will update the variable. I did yesterday, to run my unit tests. It should work.
To set environment variables for individual projects, use the checkbox 'Prepare an environment for the run' and set what environment variables you want in the format 'ENV=value' in the Properties content box.
Otherwise, all I can suggest is that you haven;t restarted the Jenkins service after setting your variable in Windows.
You can also used the EnvInject plugin, it works well.
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Resources