Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joydeep100/pytestnebulaknight
An UI Framework with Python / Selenium & Pytest.
https://github.com/joydeep100/pytestnebulaknight
Last synced: about 1 month ago
JSON representation
An UI Framework with Python / Selenium & Pytest.
- Host: GitHub
- URL: https://github.com/joydeep100/pytestnebulaknight
- Owner: joydeep100
- License: mit
- Created: 2024-06-23T09:26:26.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-08-18T11:18:52.000Z (4 months ago)
- Last Synced: 2024-08-18T12:23:38.602Z (4 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PySelAut
## Python Selenium Automation Framework!
### Features
- Page Object Model (check pages directory)- Centralized locator repo (locators/locators.py)
- Passing env variables from command line (like browser=chrome, env=QA etc)
- Headless & headed execution (--headless=true|false)
- Passing test data file (--testdata=testdata/example_test_data.json)
- Cypress inspired simplified selenium api's such as visit(), type(), click() etc.
- Used reabable assertions like `assert_that(123).is_greater_than(100)` [documentation](https://github.com/assertpy/assertpy)
### Pre-requisite
- Python3### Installation
`pip install -r requirements.txt`### How to run
- Example API Test cases
```
pytest -vsrP --env=QA --testdata=testdata/example_test_data.json tests/example_tests/example_rest_api_tests.py
```
- Example Web UI test cases
```
pytest -vsrP --browser=firefox --headless=false --env=QA --login=standard_user --secret=secret_sauce --testdata=testdata/example_test_data.json tests/example_tests/example_tests.py
```### Test tags
- To skip a test, use this decorator `@pytest.mark.skip(reason="")`
- To run specific tags, use `-m ""` or `-m "not ` etc.
Ex. `pytest -m smoke -vsrP --env=QA --testdata=testdata/example_test_data.json tests/example_tests/example_rest_api_tests.py`### Allure Report integration (optional)
#### Pre-condition
1. Node.js should be installed
2. Java version 8 (jre is sufficient) and above should be installed & JAVA_HOME path should be setrefer https://allurereport.org/docs/install-for-nodejs/
Now install allure-commandline tools
`npx install allure-commandline`
- To generate allure reports along with pytest run tests like below, some additional file would be now generated in allure-report directory
```
pytest -srP --browser=chrome --headless=true --env=QA --login=standard_user --secret=secret_sauce --testdata=testdata/example_test_data.json tests/example_tests/example_tests.py --alluredir=allure-report
```
- Run this command to convert allure-report into a htm file, this will generate 'html-report/index.html'`npx allure generate --clean --single-file allure-report/ -o html-report`
- Run this command to view reports in browser
`npx allure serve allure-report/`
### Issues
- Chrome headed mode seems to be crashing in windows machine when auto webdriver download is set (this is default). setting headless mode as always on for chrome for the time being.