selenium-injector v1.0.4
Selenium Injector
This utility injects environment variables into .side tests that have been generated using the Selenium IDE.
This is particularly useful when the UI tests involve confidential credentials like a username and password.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for testing purposes. See deployment for notes on how to use this tool as part of an automated deployment process.
Prerequisites
Running this utility requires Node.js.
The Selenium IDE is used to create the .side files.
Installing
npm install -g selenium-injector
Usage
For each test that needs to have an environment variable injected, create a step which uses the 'Store' command.
Set the first parameter (called 'Target') to the name of the environment variable, with double curly brackets around it:
{{ui_test_admin_password}}
Set the second parameter (called 'Value') to the name of the variable as you will refer to it in your tests:
admin_password
Then, in each subsequent step where you would need to enter the secret value, instead tell the IDE to enter the variable:
Command: Send keys
Target: name=password
Value: ${admin_password}
Then, save the test project from the IDE - it will generate a .side file.
Then, set the environment variable ui_test_admin_password to the actual password (correct horse battery staple, or whatever)
Then, run the injector on the .side file you saved:
selenium-injector ui-test.side
It will generate ui-test.output-side, with the substituted value of 'correct horse battery staple' instead of {{ui_test_admin_password}}. Then, you can run the tests:
npx selenium-side-runner *.ouput.side
Ta da!
This way, you can share the .side file with other testers, and even make it part of an automated test suite:
Deployment
Add additional notes about how to deploy this in a continuous deployment scenario.
Authors
- Neal McConachie - Initial work - Kinetic Software
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- PurpleBooth - The template for this readme file - template
- SeleniumHQ - The Selenium project - SeleniumHQ