I'd like to reuse the same script for different environments. The opening URL is dependent on passed in parameter.
For each Fleet agent policy, I'd like the passed in parameter to apply to just that script, but not shared with the others.
Would it be something like inserting under Advanced Browser Options --> Synthetics agent options --> Synthetics args the value "params: {activeEnv: 0}"
Here's an example:
Monitor Environment #1
const MY_MONITOR_ENV_0 = 0;
const MY_MONITOR_ENV_1 = 1;
**let activeEnv = MY_MONITOR_ENV_0;**
const myLocation = [
"https://www.computerhope.com/jargon/o/operator.htm",
"https://www.computerhope.com/jargon/h/hardware.htm",
];
step ('Enter site',async () => {
await page.goto(myLocation[**activeEnv**] );
});
======================
Monitor Environment #2
const MY_MONITOR_ENV_0 = 0;
const MY_MONITOR_ENV_1 = 1;
**let activeEnv = MY_MONITOR_ENV_1;**
const myLocation = [
"https://www.computerhope.com/jargon/o/operator.htm",
"https://www.computerhope.com/jargon/h/hardware.htm",
];
step ('Enter site',async () => {
await page.goto(myLocation[**activeEnv**] );
});