- Notifications
You must be signed in to change notification settings - Fork0
Sample framework with python, selenium and pytest, using CI GitHub Actions and Poetry
License
dmberezovskyii/pytest-python-selenium-framework
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple UI automation framework built with:
- Python: 3.9 - 3.12
- pytest: 8.3.0
- Selenium: 4.24.0
- CI: GitHub Actions
- User-friendly UI automation framework.
- Built on popular Python libraries: pytest and Selenium.
- SupportsChrome,Firefox, andRemote browsers for UI testing.
- Utilities for setting up and managing WebDriver instances.
- Integrated withGitHub Actions CI workflow for Darwin (Mac) and Linux.
- Supports multiple environments:dev,stage.
- Generatespytest reports andcustom logs.
- Secure Secrets Handling: Sensitive data like passwords are encrypted and stored securely.
- Test Data Management: Integrated with YAML files for test data storage and access.
- If you're not using macOS with ARM64 architecture or a Selenium version below 4.24.0, please upload the appropriate driver corresponding to your OS to the
resources
directory.
Clone this repository:
git clone<repository-url>
Install required dependencies:
pip install poetrypoetry shellpoetry env infocopy`Executable: path to virtual env` -> Add Interpreter -> Poetry Environment -> Existing environment -> add Executable -> Applypoetry install
then specify your poetry env
Create a
.env
file and add:DEV_URL = "your-dev-project-url"STAG_URL = "your-staging-project-url"
If you prefer not to use environment variables, add your references to the properties file:
classProperties:_ENV_VARIABLES= {"dev": ("DEV_URL",""),"stag": ("STAG_URL",""),# Add more environments and their default URLs as needed }
You can download the chrome driver with CLI utilutil
- When running CI locally, ensure your Git resources contain the correct Chrome driver with x86_64 architecture (unless using Selenium version 4.24.0 or higher).
- Go toRepository Settings ->Secrets and Variables ->Actions ->Variables, and add
DEV_URL
,STAG_URL
. - CI configuration is available for running tests on Ubuntu in
run_test_ubuntu.yaml
. jobs: selenium-tests: runs-on: macos-latest env: DEV_URL: ${{ vars.DEV_URL }} STAG_URL: ${{ vars.STAG_URL }}
The linting configuration defines rules that dictate the checks performed. Customize these rules to suit your project's coding style and requirements.
- Create external tools to run linting.
- Set the working directory to:
$ProjectFileDir$
- Specify the program:
path to your ruff installed /bin/ruff
- Provide the arguments:
$FilePathRelativeToProjectRoot$ --config .ruff.toml
To secure our passwords or sensitive data, we store them in an encrypted form. For this, we use thesecure-test-automation library.implementation on framework side: utils/crypto.pyPay attention The encryption key is stored in/config/key.properties
(this file should be added to.gitignore
) for local testing.
For executing tests in remote environments (e.g., BrowserStack, Jenkins, etc.), we have integrated the Vault HashiCorp library.
@pytest.fixturedefget_password():secure=Secure()read=YAMLReader.read("data.yaml",to_simple_namespace=True)password=read.users.john.details.passwordreturnsecure.decrypt_password(password)
Demo toolhttps://demoqa.com/text-box
About
Sample framework with python, selenium and pytest, using CI GitHub Actions and Poetry
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.