## Description
The Open Self-Service Iframe in New Tab with Auto Approve Button and Environment Input Tampermonkey script adds a UI control to any page matching the specified URL pattern (e.g., https://idp.cmh.platform-cicd.evinternal.net/**). This control consists of an input field and a button that allows users to set a specific environment (such as test, dev, or prod) and automatically open a matching iframe in a new tab.
## How the Script Works
1. Environment Input Field:
• A fixed-position input field appears at the top-right corner of the page, with a default value of “test.” Users can modify this field to specify the desired environment.
2. “Start Auto Approve” Button:
• Next to the input field, the script displays a “Start Auto Approve” button. When clicked, it triggers the process of looking for an iframe with the class self-service-frame.
3. Iframe Search and URL Modification:
• After the button is clicked, the script initiates an interval to repeatedly search for an iframe with the class self-service-frame.
• Once the iframe is detected, it modifies the iframe’s URL by appending or updating the environment parameter with the value from the input field.
• It then opens the modified URL in a new tab and stops the search process.
## Need for This Script
In many CI/CD or multi-environment applications, users (typically developers, testers, or DevOps engineers) must frequently navigate between different environments (e.g., test, dev, prod) to perform tasks like testing, configuration, or deployment. This process can be repetitive and time-consuming, particularly if it requires users to:
• Manually locate specific iframes or embedded content for each environment.
• Update URL parameters for each environment change.
• Perform these actions frequently, which can disrupt focus and workflow.
This script provides a quick and automated way to handle these steps, making environment switching smoother and more efficient by:
• Automating Parameter Setting: Users can easily switch environments by entering the environment name and clicking a button, which appends the environment parameter to the iframe’s URL.
• Reducing Manual Navigation: The script automatically opens the modified iframe in a new tab, eliminating the need to manually find and open it.
• Improving Productivity: By reducing the manual steps involved in environment switching, this tool frees up time and reduces the potential for errors, enabling users to focus on higher-level tasks.
This script is particularly valuable for teams working in fast-paced development cycles where quick environment changes are essential. It streamlines the setup process and provides a user-friendly way to handle frequent environment transitions efficiently.