Skip to content

Commit

Permalink
Android emulator setup (#68)
Browse files Browse the repository at this point in the history
### To be filled by the PR creator:

* A brief description of the changes made - 

* Do we have clean latest run report (Docker or Browserstack) attached
with this PR?
  * [ ] Yes
  * [ ] No (Please explain why)

* Does the PR contain changes to any core file?
  * [ ] Yes (Needs approval from at least 1 people)
  * [ ] No

* Is it
  * [ ] New Testcase
  * [ ] Fix


### To be filled by the PR reviewer:

* [ ] Verify the attached run report passed in GitHub Actions (Docker or
Browserstack run)

* General
    * [ ] Use the best strategy to locate the elements
    * [ ] Comments wherever the code is not readable by itself
    * [ ] Use of the right data structure for the use case
    * [ ] Reuse logic/functionality as much as possible
    * [ ] Cleanup of any test data that is generated by the tests
    * [ ] No static waits
  • Loading branch information
Tauqir Sarwar authored Mar 26, 2024
2 parents dfe21b2 + 148b3ab commit a26bb67
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
41 changes: 27 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ This document assumes that user has:
* Access to `pytest-automation-boilerplate` repository, and/or additional test repositories.
* Have installed your favourite IDEs (Pycharm or VSCode - it's recommended) and/or set up your terminal for development environment.

#### Windows

*Recommended terminal application is GitBash*

For Windows machine setup, there is a well-written article hosted on Sharepoint describing the steps to be followed.
<p align="right">(<a href="#about-the-project">back to top</a>)</p>

#### MacOS

1. <u><strong>Homebrew</strong></u>
Expand Down Expand Up @@ -161,7 +154,16 @@ For Windows machine setup, there is a well-written article hosted on Sharepoint
5. <u><strong>Appium setup for Mobile apps</strong></u>
If you are planning to run mobile tests, you need to install Appium server and start it before running the tests.
Detailed instructions can be found [here](https://appium.io/docs/en/about-appium/getting-started/)
Detailed instructions can be found [here](https://appium.io/docs/en/latest/quickstart/)
6. <u><strong>Local Setup for BrowserStack</strong></u>
If you are planning to run tests on BrowserStack, you need to install BrowserStack Local binary and start it before running the tests.
Detailed instructions can be found [here](https://www.browserstack.com/local-testing/automate#test-localhost-websites)
7. <u><strong>Local Setup for Docker</strong></u>
you need to install Docker desktop before running the docker-compose.yml file.
Detailed instructions can be found [here](https://docs.docker.com/desktop/install/mac-install/)
<p align="right">(<a href="#about-the-project">back to top</a>)</p>
### Executing Test Cases in Local Machine
Expand All @@ -171,7 +173,7 @@ command line arguments to be passed to `pytest` command:
1. **`--driver=<test-browser-name>`**
This should be passed **mandatorily** while running UI/selenium test cases. Test Browser name would be`chrome`,
`firefox` or `edge` as per the test needs for local testing. Use `Remote` for testing using BrowserStack and `Appium` for mobile tests.
`firefox` or `edge` or `safari` as per the test needs for local testing. Use `Remote` for testing using Docker/BrowserStack and `Appium` for mobile tests.
2. **`--language=<en|fr|etc.>`**
Application Language, used in context of UI testing (selenium)
3. **`--capability <individual-capability-value>`**
Expand All @@ -197,10 +199,10 @@ command line arguments to be passed to `pytest` command:
Sample `pytest` invocation to run all sample ui tests in Chrome browser with 3 threads in parallel:
```shell
pytest -v --driver=Chrome --capability headless True --tags=web-tests -n=2
pytest -v --driver=Chrome --capability headless True --tags=web-tests -n=1
```
Starting from v3.28 Boilerplate framework is using built-in driver manager to handle the driver binaries for each browser.
Boilerplate framework is using built-in driver manager to handle the driver binaries for each browser.
There is no need to provide `--driver-path` argument anymore. Selenium lib. will automatically detect the browser version and download required binary driver.
All the drivers will be stored in the `$HOME/.cache/selenium/` folder.
More info: [here](https://www.selenium.dev/blog/2022/introducing-selenium-manager)
Expand All @@ -212,15 +214,18 @@ More info: [here](https://www.selenium.dev/blog/2022/introducing-selenium-manage
├── / # root directory with project-wide env_configs and folders
├── /app files # directory with all android and ios app files/builds
├── /webdriver # directory contains all the driver binaries / Browserstack local binary
├── /bp_code # directory contains all the base code (utils, plugins, common steps...) for the framework
├── /env_configs/ # Configurations related to framework & browser specific
├── /main # directory contains all the base code (utils, plugins, common steps...) for the framework
├── /env_configs/ # Configurations related to framework & browser specific
├── /frontend/ # Project specific files (locators, page objects, step definitions, feature files... etc)
├── /frontend/features/* # Test cases written in Gherkin language
├── /frontend/locators/* # Web locators for the project
├── /output/ # Reports, downloads.... etc)
├── /test_data/ # All project test data for API, WEB, Mobile tests)
│ ├── /conftest.py # Step up and tear down for the tests
│ ├── /setup_install.sh # Local Setup script
│ ├── /setup_install.sh # Local Setup script
│ ├── /**.sh # Shell scripts for local/CI runs
│ ├── /pytest.ini # Project init file
│ ├── /docker-compose.yml # To build the docker image
│ ├── /README.md # Instructions for the project
│ ├── /requirements.txt # Dependencies
Expand Down Expand Up @@ -363,6 +368,7 @@ python -m pytest -v --tags="sample-ui-tests" -n=3 --variables=./env_configs/web_
Please avoid adding `-s` in the CLI since it will not include any logs in the html report.
</br>
</br>
For GitHub actions please update .yaml including .html file and ./assets folder as in this example.
```
Expand All @@ -376,6 +382,13 @@ For GitHub actions please update .yaml including .html file and ./assets folder
./output/
if: ${{ always() }}
```
### Allure Reports
by default allure report generates at output/allure/reports at the end of test execution, results are inside /output/allure/results folder.
### Github Workflows
A list of workflows are added in the .github/workflows folder. e.g
Docker execution, Browserstack execution, Local execution, Mobile execution, Testrail execution, etc.
** about billing of github actions, please check the github documentation. (https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions)
Best Practices
---------------------
Expand Down
3 changes: 2 additions & 1 deletion env_configs/ios_mobile_docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"platformName": "iOS",
"app": "/Users/runner/work/pytest-automation-boilerplate/pytest-automation-boilerplate/app files/builds/MyRNDemoApp.app",
"noReset": false,
"newCommandTimeout": 3600
"newCommandTimeout": 3600,
"wdaLaunchTimeout": 300000
}
}
3 changes: 2 additions & 1 deletion frontend/test_project/features/mobile/ios_login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ Feature: Basic IOS App functionality
And I set text '325885556585999' to field '_mob > Payment_Detail > Card_Number'
And I set text '0325' to field '_mob > Payment_Detail > expired_card'
And I set text '123' to field '_mob > Payment_Detail > CVV'
And I scroll to element '_mob > Payment_Detail > Enter_Click' for '1' iterations
And I scroll to element '_mob > Payment_Detail > Enter_Click' for '2' iterations
And I click on element '_mob > Payment_Detail > Enter_Click'
And I scroll to element '_mob > Review_Order > Review' for '2' iterations
And I click on element '_mob > Review_Order > Review'
And I click on element '_mob > Review_Order > Review'
And The element '_mob > Review_Order > Total' is displayed
Expand Down
1 change: 1 addition & 0 deletions frontend/test_project/features/web/login_tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Feature: OrangeHRM Login and Modus QA blog
And I click item 'Logout' for element 'OrangeHRM > logout_button'
Then The element 'OrangeHRM > username' is displayed

# This test case fails on Edge browser, because success message is not displayed after adding user (application issue)
@hrm_add_user @automated
Scenario: Login and add admin user in OrangeHRM system
Given I set web base url '{%BASE_URL%}'
Expand Down

0 comments on commit a26bb67

Please sign in to comment.