diff --git a/.gitattributes b/.gitattributes index e7c94c1f..3efd526d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,5 +6,5 @@ LICENSE export-ignore screenshots export-ignore scripts export-ignore selenium_drivers export-ignore -install.sh export-ignore +env_install.sh export-ignore install_scripts export-ignore diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index eed0df92..b4a38795 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,16 +2,12 @@ * A brief description of the changes made - -* Do we have clean latest run report attached with this PR? +* 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 BP core file? - * [ ] Yes (Needs approval from at least 2 people) - * [ ] No - -* Does the PR contain changes to modules shared with other teams? - * [ ] Yes (Needs approval from at least one of the other teams that use the module) +* Does the PR contain changes to any core file? + * [ ] Yes (Needs approval from at least 1 people) * [ ] No * Is it @@ -21,7 +17,7 @@ ### To be filled by the PR reviewer: -* [ ] Verify the attached run report passed in GitHub Actions (Justify if local run) +* [ ] Verify the attached run report passed in GitHub Actions (Docker or Browserstack run) * General * [ ] Use the best strategy to locate the elements diff --git a/.github/workflows/android_workflow.yml b/.github/workflows/android_workflow.yml index 0f1d3e31..b85b8c0e 100644 --- a/.github/workflows/android_workflow.yml +++ b/.github/workflows/android_workflow.yml @@ -25,7 +25,7 @@ jobs: include: - name: Android Mobile tags: 'android_mobile_tests' - config_file: ./configs/android_mobile_BS.json + config_file: ./env_configs/android_mobile_BS.json html_report: android-mobile testrail_configuration_name: 'Samsung Galaxy S23 Ultra' @@ -54,7 +54,7 @@ jobs: - name: Setup dependencies run: | - sh install.sh + sh setup_install.sh - name: Run All Tests run: | @@ -127,7 +127,7 @@ jobs: id: setup_dependencies if: steps.co_code.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Manual Job Tests id: run_manual_job @@ -139,7 +139,7 @@ jobs: source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium \ --selenium-host '${{secrets.BROWSERSTACK_API_USERNAME}}:${{secrets.BROWSERSTACK_ACCESS_KEY}}@hub-cloud.browserstack.com' \ - --variables './configs/android_mobile_BS.json' \ + --variables './env_configs/android_mobile_BS.json' \ --tags="$TAGS" --html=report.html \ --self-contained-html diff --git a/.github/workflows/api_workflow.yml b/.github/workflows/api_workflow.yml index 10207438..ee569489 100644 --- a/.github/workflows/api_workflow.yml +++ b/.github/workflows/api_workflow.yml @@ -1,4 +1,3 @@ -# Workflow for executing API tests name: API Workflow env: @@ -16,30 +15,24 @@ on: required: true default: 'api' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: run-api-test-schedule: if: github.event_name == 'schedule' - # The type of GH runner where the job will run on name: API Regression runs-on: ubuntu-latest steps: - # Setup Python - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.9' - # Checkout the latest code from the repo - name: Check out code uses: actions/checkout@v4 - # Setup dependencies by running requirement.txt - name: Setup dependencies run: | - sh install.sh + sh setup_install.sh - # Execute tests. If test tag/s are provided while triggering manually it will pick that otherwise pick the default tags from Env section - name: Run tests run: | if [ "${{ github.event.inputs.tags }}" != "" ] @@ -74,7 +67,6 @@ jobs: PUBLISH_BRANCH: gh-pages PUBLISH_DIR: allure-history - # Upload html results as GH artifact - name: Upload pytest test results uses: actions/upload-artifact@v4 with: @@ -91,22 +83,18 @@ jobs: runs-on: ubuntu-latest steps: - # Setup Python - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.9' - # Checkout the latest code from the repo - name: Check out code uses: actions/checkout@v4 - # Setup dependencies by running requirement.txt - name: Setup dependencies run: | - sh install.sh + sh setup_install.sh - # Execute tests. If test tag/s are provided while triggering manually it will pick that otherwise pick the default tags from Env section - name: Run tests run: | if [ "${{ github.event.inputs.tags }}" != "" ] @@ -141,7 +129,6 @@ jobs: PUBLISH_BRANCH: gh-pages PUBLISH_DIR: allure-history - # Upload html results as GH artifact - name: Upload pytest test results uses: actions/upload-artifact@v4 with: @@ -150,4 +137,4 @@ jobs: ./*.html ./output/ ./assets/ - if: ${{ always() }} + if: ${{ always() }} \ No newline at end of file diff --git a/.github/workflows/docker_android_workflow.yml b/.github/workflows/docker_android_workflow.yml index 523ed3be..e3b32a5a 100644 --- a/.github/workflows/docker_android_workflow.yml +++ b/.github/workflows/docker_android_workflow.yml @@ -72,7 +72,7 @@ jobs: id: setup_dependencies if: steps.run_emulator.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Tests id: run_manual_job @@ -82,7 +82,7 @@ jobs: env source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium --selenium-host 'localhost' --selenium-port '4723' \ - --variables './configs/android_mobile_docker.json' \ + --variables './env_configs/android_mobile_docker.json' \ --tags="$TAGS" \ --html=report.html \ --self-contained-html \ @@ -167,7 +167,7 @@ jobs: id: setup_dependencies if: steps.co_code.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Tests id: run_manual_job @@ -177,7 +177,7 @@ jobs: env source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium --selenium-host 'localhost' --selenium-port '4723' \ - --variables './configs/android_mobile_docker.json' \ + --variables './env_configs/android_mobile_docker.json' \ --tags="android_mobile_tests" \ --html=report.html \ --self-contained-html \ diff --git a/.github/workflows/docker_ios_workflow.yml b/.github/workflows/docker_ios_workflow.yml index 59eb5679..354fa3d7 100644 --- a/.github/workflows/docker_ios_workflow.yml +++ b/.github/workflows/docker_ios_workflow.yml @@ -67,7 +67,7 @@ jobs: id: setup_dependencies if: steps.open_ios_simulator.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Tests id: run_manual_job @@ -77,7 +77,7 @@ jobs: env source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium --selenium-host 'localhost' --selenium-port '4723' \ - --variables './configs/ios_mobile_docker.json' \ + --variables './env_configs/ios_mobile_docker.json' \ --tags="$TAGS" \ --html=report.html \ --self-contained-html \ @@ -153,7 +153,7 @@ jobs: id: setup_dependencies if: steps.open_ios_simulator.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Tests id: run_manual_job @@ -163,7 +163,7 @@ jobs: env source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium --selenium-host 'localhost' --selenium-port '4723' \ - --variables './configs/ios_mobile_docker.json' \ + --variables './env_configs/ios_mobile_docker.json' \ --tags="$TAGS" \ --html=report.html \ --self-contained-html \ diff --git a/.github/workflows/docker_ui_workflow.yml b/.github/workflows/docker_ui_workflow.yml index 63c4ce4b..5db92e6a 100644 --- a/.github/workflows/docker_ui_workflow.yml +++ b/.github/workflows/docker_ui_workflow.yml @@ -54,21 +54,21 @@ jobs: - name: Linux Chrome baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/docker_chrome.json + config_file: ./env_configs/docker_chrome.json html_report: linux-chrome concurrent_thread: 3 - name: Linux Firefox baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/docker_firefox.json + config_file: ./env_configs/docker_firefox.json html_report: linux-firefox concurrent_thread: 3 - name: Linux Edge baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/docker_edge.json + config_file: ./env_configs/docker_edge.json html_report: linux-edge concurrent_thread: 3 @@ -103,7 +103,7 @@ jobs: - name: Setup dependencies id: setup_dependencies run: | - sh install.sh + sh setup_install.sh - name: Run All Tests if: steps.setup_dependencies.outcome == 'success' @@ -186,7 +186,7 @@ jobs: id: setup_dependencies if: steps.docker_compose.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Manual Job Tests id: run_manual_job @@ -203,14 +203,14 @@ jobs: concurrent_thread=3 if [[ "${{ github.event.inputs.browser }}" == "chrome" ]]; then - BROWSER=./configs/docker_chrome.json + BROWSER=./env_configs/docker_chrome.json fi if [[ "${{ github.event.inputs.browser }}" == "firefox" ]]; then - BROWSER=./configs/docker_firefox.json + BROWSER=./env_configs/docker_firefox.json fi if [[ "${{ github.event.inputs.browser }}" == "edge" ]]; then - BROWSER=./configs/docker_edge.json + BROWSER=./env_configs/docker_edge.json fi env diff --git a/.github/workflows/ios_workflow.yml b/.github/workflows/ios_workflow.yml index 4969fa02..74f2b2c7 100644 --- a/.github/workflows/ios_workflow.yml +++ b/.github/workflows/ios_workflow.yml @@ -25,7 +25,7 @@ jobs: include: - name: IOS Mobile tags: 'ios_mobile_test' - config_file: ./configs/ios_mobile_BS.json + config_file: ./env_configs/ios_mobile_BS.json html_report: ios-mobile testrail_configuration_name: 'iPhone 15 Plus' @@ -54,7 +54,7 @@ jobs: - name: Setup dependencies run: | - sh install.sh + sh setup_install.sh - name: Run All Tests run: | @@ -128,7 +128,7 @@ jobs: id: setup_dependencies if: steps.co_code.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Manual Job Tests id: run_manual_job @@ -141,7 +141,7 @@ jobs: source $HOME/.bp-venv/bin/activate python -m pytest -v --driver Appium \ --selenium-host '${{secrets.BROWSERSTACK_API_USERNAME}}:${{secrets.BROWSERSTACK_ACCESS_KEY}}@hub-cloud.browserstack.com' \ - --variables './configs/ios_mobile_BS.json' \ + --variables './env_configs/ios_mobile_BS.json' \ --tags="$TAGS" --html=report.html \ --self-contained-html diff --git a/.github/workflows/ui_workflow.yml b/.github/workflows/ui_workflow.yml index c776d12a..2052506f 100644 --- a/.github/workflows/ui_workflow.yml +++ b/.github/workflows/ui_workflow.yml @@ -63,7 +63,7 @@ jobs: - name: Win Chrome baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/win_chrome.json + config_file: ./env_configs/win_chrome.json html_report: win-chrome concurrent_thread: 2 testrail_configuration_name: 'Chrome, Windows' @@ -72,7 +72,7 @@ jobs: - name: Win Firefox baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/win_firefox.json + config_file: ./env_configs/win_firefox.json html_report: win-firefox concurrent_thread: 2 testrail_configuration_name: 'Firefox, Windows' @@ -81,7 +81,7 @@ jobs: - name: Win Edge baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/win_edge.json + config_file: ./env_configs/win_edge.json html_report: win-edge concurrent_thread: 2 testrail_configuration_name: 'Edge, Windows' @@ -90,7 +90,7 @@ jobs: - name: Mac Firefox baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/mac_firefox.json + config_file: ./env_configs/mac_firefox.json html_report: mac-firefox concurrent_thread: 2 testrail_configuration_name: 'Firefox, MacOS' @@ -99,7 +99,7 @@ jobs: - name: Mac Chrome baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/mac_chrome.json + config_file: ./env_configs/mac_chrome.json html_report: mac-chrome concurrent_thread: 2 testrail_configuration_name: 'Chrome, MacOS' @@ -108,7 +108,7 @@ jobs: - name: Mac Edge baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/mac_edge.json + config_file: ./env_configs/mac_edge.json html_report: mac-edge concurrent_thread: 2 testrail_configuration_name: 'Edge, MacOS' @@ -117,7 +117,7 @@ jobs: - name: Mac Safari baseurl: https://opensource-demo.orangehrmlive.com tags: web_tests - config_file: ./configs/mac_safari.json + config_file: ./env_configs/mac_safari.json html_report: mac-safari concurrent_thread: 2 testrail_configuration_name: 'Safari, MacOS' @@ -126,7 +126,7 @@ jobs: - name: Mac Chrome Visual baseurl: https://opensource-demo.orangehrmlive.com tags: visual - config_file: ./configs/mac_chrome.json + config_file: ./env_configs/mac_chrome.json html_report: mac-chrome-visual concurrent_thread: 2 testrail_configuration_name: 'Chrome, MacOS' @@ -157,7 +157,7 @@ jobs: - name: Setup dependencies run: | - sh install.sh + sh setup_install.sh - name: Run All Tests run: | @@ -265,7 +265,7 @@ jobs: id: setup_dependencies if: steps.co_code.outcome == 'success' run: | - sh install.sh + sh setup_install.sh - name: Run Manual Job Tests id: run_manual_job @@ -282,22 +282,22 @@ jobs: concurrent_thread=2 if [[ "${{ github.event.inputs.browser }}" == "chrome" && "${{ github.event.inputs.os }}" == "window" ]]; then - BROWSER=./configs/win_chrome.json + BROWSER=./env_configs/win_chrome.json fi if [[ "${{ github.event.inputs.browser }}" == "firefox" && "${{ github.event.inputs.os }}" == "window" ]]; then - BROWSER=./configs/win_firefox.json + BROWSER=./env_configs/win_firefox.json fi if [[ "${{ github.event.inputs.browser }}" == "edge" && "${{ github.event.inputs.os }}" == "window" ]]; then - BROWSER=./configs/win_edge.json + BROWSER=./env_configs/win_edge.json fi if [[ "${{ github.event.inputs.browser }}" == "chrome" && "${{ github.event.inputs.os }}" == "mac" ]]; then - BROWSER=./configs/mac_chrome.json + BROWSER=./env_configs/mac_chrome.json fi if [[ "${{ github.event.inputs.browser }}" == "firefox" && "${{ github.event.inputs.os }}" == "mac" ]]; then - BROWSER=./configs/mac_firefox.json + BROWSER=./env_configs/mac_firefox.json fi if [[ "${{ github.event.inputs.browser }}" == "safari" && "${{ github.event.inputs.os }}" == "mac" ]]; then - BROWSER=./configs/mac_safari.json + BROWSER=./env_configs/mac_safari.json fi env diff --git a/.gitignore b/.gitignore index e40be61d..5d000003 100644 --- a/.gitignore +++ b/.gitignore @@ -138,10 +138,10 @@ Pipfile Pipfile.lock # Sensitive data -/binaries/webdriver/BrowserStackLocal* -/binaries/webdriver/chromedriver* -/binaries/webdriver/geckodriver* -/binaries/webdriver/msedgedriver* +/webdriver/BrowserStackLocal* +/webdriver/chromedriver* +/webdriver/geckodriver* +/webdriver/msedgedriver* # output contents /output/visualtesting/diff/* diff --git a/README.md b/README.md index 8b962ec2..78fb7264 100755 --- a/README.md +++ b/README.md @@ -129,15 +129,15 @@ For Windows machine setup, there is a well-written article hosted on Sharepoint # alternatively, you could use ssh link if you have setup ssh in your work machine. ``` -2. source install.sh +2. source setup_install.sh After successful cloning, execute below commands to install BoilerPlate. ```shell cd pytest-automation-boilerplate/ - source install.sh + source setup_install.sh 3. Activate your Virtual Environment - In the above step using source install.sh automatically activates the virtual environment. + In the above step using source setup_install.sh automatically activates the virtual environment. For eg: After installation you will see the following.Yet another Important Note: Please activate virtual environment using command ". /Users/username/.bp-venv/bin/activate" while running test cases from new shell. Need not activate now, since it is already activated. @@ -156,7 +156,7 @@ For Windows machine setup, there is a well-written article hosted on Sharepoint 4. Setup Environment Variables in `.local.env` & `pytest.ini` files - After successful installation, check and update `configs/.local.env` and `pytest.ini` files with relevant details. + After successful installation, check and update `env_configs/.local.env` and `pytest.ini` files with relevant details. 5. Appium setup for Mobile apps @@ -209,17 +209,17 @@ More info: [here](https://www.selenium.dev/blog/2022/introducing-selenium-manage ```bash . -├── / # root directory with project-wide configs and folders +├── / # root directory with project-wide env_configs and folders ├── /app files # directory with all android and ios app files/builds -├── /binaries # directory contains all the driver binaries / Browserstack local binary +├── /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 -├── /configs/ # Configurations related to framework & browser specific +├── /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 ├── /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 -│ ├── /install.sh # Local Setup script +│ ├── /setup_install.sh # Local Setup script │ ├── /pytest.ini # Project init file │ ├── /README.md # Instructions for the project │ ├── /requirements.txt # Dependencies @@ -229,11 +229,11 @@ More info: [here](https://www.selenium.dev/blog/2022/introducing-selenium-manage ### Testrail Interaction -Ensure to set/update following details in `configs/.local.env` file before interacting with testrail. +Ensure to set/update following details in `env_configs/.local.env` file before interacting with testrail. > **_IMPORTANT_NOTE:_** If you are updating to project v3.10 or newer make sure to store your TestRail related -> configs in '.local.env' file. -> The reason for that is BoilerPlate releases up to v3.8, all TestRail related configs were stored in 'pytest.ini' file. +> env_configs in '.local.env' file. +> The reason for that is BoilerPlate releases up to v3.8, all TestRail related env_configs were stored in 'pytest.ini' file. > With current release all TestRail data are stored in the file mentioned below: > >.local.env @@ -313,8 +313,8 @@ Reference Link - https://pypi.org/project/pytest-xdist/ -F "file=@/path/to/app/file/Application-debug.apk" ``` -* We will receive below sample response which we need to add it in the configs/googlePixel6_browserstack.json and - configs/iPhone13Pro_browserstack.json file +* We will receive below sample response which we need to add it in the env_configs/ios_mobile_BS.json and + env_configs/android_mobile_BS.json file ```shell { @@ -324,7 +324,7 @@ Reference Link - https://pypi.org/project/pytest-xdist/

(back to top)

-Command for local run on chrome +Command for local run on chrome (also ./web_local_run.sh) ```shell -v -s --gherkin-terminal-reporter --driver=Chrome --html="./output/reports/" --self-contained-html --capability headless True --tags="web_tests" --reruns 1 --reruns-delay 2 -n=2 ``` @@ -334,15 +334,15 @@ Command for local run on firefox ``` Command for local run on BS with Chrome: ```shell --v -s --gherkin-terminal-reporter --driver=Remote --selenium-host '[BS_USERNAME]:[BS_KEY]@hub-cloud.browserstack.com' --variables="configs/mac_chrome.json" --html="./output/reports/" --tags="web_tests" -n=3 --reruns 1 --reruns-delay 2 --self-contained-html +-v -s --gherkin-terminal-reporter --driver=Remote --selenium-host '[BS_USERNAME]:[BS_KEY]@hub-cloud.browserstack.com' --variables="env_configs/mac_chrome.json" --html="./output/reports/" --tags="web_tests" --reruns 1 --reruns-delay 2 --self-contained-html ``` Command for local run on local appium server: ```shell --v -s --gherkin-terminal-reporter --driver=Appium --html="./output/reports/" --tags="mobile_test and android" --variables="configs/android_mobile_local.json" --self-contained-html --reruns 1 --reruns-delay 2 +-v -s --gherkin-terminal-reporter --driver=Appium --html="./output/reports/" --tags="mobile_test and android" --variables="env_configs/android_mobile_local.json" --self-contained-html --reruns 1 --reruns-delay 2 ``` Command for local run on BS with IOS: ```shell --v -s --gherkin-terminal-reporter --disable-warnings --driver=Appium --html="./output/reports/" --selenium-host '[BS_USERNAME]:[BS_KEY]@hub-cloud.browserstack.com' --variables="configs/ios_mobile_BS.json" --self-contained-html --tags="mobile_test and ios" --reruns 1 --reruns-delay 2 +-v -s --gherkin-terminal-reporter --disable-warnings --driver=Appium --html="./output/reports/" --selenium-host '[BS_USERNAME]:[BS_KEY]@hub-cloud.browserstack.com' --variables="env_configs/ios_mobile_BS.json" --self-contained-html --tags="mobile_test and ios" --reruns 1 --reruns-delay 2 ``` ### Html Test Reports @@ -358,7 +358,7 @@ For example: Example of full command to generate html reports: ```shell -python -m pytest -v --tags="sample-ui-tests" -n=3 --variables=./configs/web_local.json --driver=chrome --html=./output/reports/ --self-contained-html +python -m pytest -v --tags="sample-ui-tests" -n=3 --variables=./env_configs/web_local.json --driver=chrome --html=./output/reports/ --self-contained-html ``` Please avoid adding `-s` in the CLI since it will not include any logs in the html report.
diff --git a/android_local_run.sh b/android_local_run.sh index fbef14fe..9613bcfa 100755 --- a/android_local_run.sh +++ b/android_local_run.sh @@ -2,4 +2,4 @@ # Run API tests python -m pytest -v -s --disable-warnings --gherkin-terminal-reporter --driver=Appium --html="./output/reports/" --self-contained-html \ ---variables="configs/android_mobile_docker.json" --reruns 1 --reruns-delay 2 --tags="android_mobile_tests" \ No newline at end of file +--variables="env_configs/android_mobile_docker.json" --reruns 1 --reruns-delay 2 --tags="android_mobile_tests" \ No newline at end of file diff --git a/binaries/webdriver/BrowserStackLocal b/binaries/webdriver/BrowserStackLocal deleted file mode 100755 index 997a77c7..00000000 Binary files a/binaries/webdriver/BrowserStackLocal and /dev/null differ diff --git a/binaries/webdriver/chromedriver b/binaries/webdriver/chromedriver deleted file mode 100755 index 40fd834f..00000000 Binary files a/binaries/webdriver/chromedriver and /dev/null differ diff --git a/binaries/webdriver/geckodriver b/binaries/webdriver/geckodriver deleted file mode 100755 index 1564f31c..00000000 Binary files a/binaries/webdriver/geckodriver and /dev/null differ diff --git a/binaries/webdriver/msedgedriver b/binaries/webdriver/msedgedriver deleted file mode 100755 index 05010868..00000000 Binary files a/binaries/webdriver/msedgedriver and /dev/null differ diff --git a/bp_core/frontend/common/step_definitions/environment_variables.py b/bp_core/frontend/common/step_definitions/environment_variables.py index 1021903f..51735a0a 100644 --- a/bp_core/frontend/common/step_definitions/environment_variables.py +++ b/bp_core/frontend/common/step_definitions/environment_variables.py @@ -69,7 +69,7 @@ def write_html_report_os_environ_value(selenium_generics: SeleniumGenerics, env_ @given(parsers.re("I store '(?P.*)' environment variable in .local.env config file")) @when(parsers.re("I store '(?P.*)' environment variable in .local.env config file")) def store_env_variable_in_local_env(key: str): - local_config_file = Path.cwd() / "configs" / ".local.env" + local_config_file = Path.cwd() / "env_configs" / ".local.env" if local_config_file.is_file(): from dotenv import set_key if os.environ.get(key, None): diff --git a/bp_core/installation/installation_tests/test_installation_check.py b/bp_core/installation/installation_tests/test_installation_check.py index 9ccd7259..3765b735 100644 --- a/bp_core/installation/installation_tests/test_installation_check.py +++ b/bp_core/installation/installation_tests/test_installation_check.py @@ -10,8 +10,8 @@ def test_check_root_folder(): assert_that(os.path.isfile("./.editorconfig")).is_true() assert_that(os.path.isfile("./.gitignore")).is_true() assert_that(os.path.isfile("./conftest.py")).is_true() - assert_that(os.path.isfile("./install.sh")).is_true() - assert_that(os.path.isfile("./install.py")).is_true() + assert_that(os.path.isfile("./setup_install.sh")).is_true() + assert_that(os.path.isfile("./setup_install.py")).is_true() assert_that(os.path.isfile("./pytest.ini")).is_true() assert_that(os.path.isfile("./README.md")).is_true() assert_that(os.path.isfile("./requirements.txt")).is_true() @@ -106,8 +106,8 @@ def test_check_utils_folder(): @pytest.mark.automated @pytest.mark.installation_check def test_check_configs_folder(): - assert_that(os.path.isdir("./configs")).is_true() - assert_that(os.path.isfile("./configs/.local.env")).is_true() + assert_that(os.path.isdir("./env_configs")).is_true() + assert_that(os.path.isfile("./env_configs/.local.env")).is_true() @pytest.mark.nondestructive @@ -134,5 +134,4 @@ def test_check_installation_folder(): @pytest.mark.automated @pytest.mark.installation_check def test_check_binaries_folder(): - assert_that(os.path.isdir("./binaries")).is_true() - assert_that(os.path.isdir("./binaries/webdriver")).is_true() + assert_that(os.path.isdir("./webdriver")).is_true() diff --git a/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py b/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py index aea4b82a..d9c19926 100644 --- a/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py +++ b/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py @@ -138,7 +138,7 @@ def pytest_sessionstart(session): tr_configs = functools.reduce( operator.iconcat, [ - tr_cg["configs"] + tr_cg["env_configs"] for tr_cg in tr.configurations.get_configs(project_data["project_id"]) ], ) @@ -708,82 +708,6 @@ def export_tests_results(session, tr: TestRailAPI, project_data: dict, scenarios We can delete it later if no regression. I have tested few scenarios and it worked fine """ - # plan_entry_names = [plan_entry.name for plan_entry in tr_plan.entries] - # feature_names = scenarios_run.keys() - # - # for feature_name in feature_names: - # if feature_name not in plan_entry_names: - # config_ids = [ - # config["id"] - # for config in functools.reduce( - # operator.iconcat, - # [ - # config_groups["configs"] - # for config_groups in tr.configurations.get_configs( - # project_data["project_id"] - # ) - # ], - # ) - # ] - # else: - # config_ids = [ - # config["id"] - # for config in functools.reduce( - # operator.iconcat, - # [ - # config_groups["configs"] - # for config_groups in tr.configurations.get_configs( - # project_data["project_id"] - # ) - # ], - # ) - # if config["name"] == project_data["configuration_name"] - # ] - # if feature_name not in plan_entry_names or ( - # feature_name in plan_entry_names - # and project_data["configuration_name"] - # not in [ - # run.config - # for run in functools.reduce( - # operator.iconcat, - # [ - # plan_entry.runs - # for plan_entry in tr_plan.entries - # if plan_entry.name == feature_name - # ], - # ) - # ] - # ): - # print(f"Adding suite {feature_name} to test plan {tr_plan.name}") - # suite_id = next( - # ( - # tr_suite.id - # for tr_suite in tr.suites.get_suites(project_data["project_id"]) - # # we have only Master suite for TestRail project type #1 - # if tr_suite.name == 'Master' - # ), - # None, - # ) - # runs = [ - # Run( - # { - # "include_all": True, - # "config_ids": [config_id], - # } - # ).raw_data() - # for config_id in config_ids - # ] - # tr_plan_entry = Entry( - # { - # "suite_id": suite_id, - # "name": feature_name, - # "include_all": True, - # "config_ids": config_ids, - # "runs": runs, - # } - # ) - # tr.plans.add_plan_entry(tr_plan.id, tr_plan_entry) - tr_plan = tr.plans.get_plan(project_data["plan_id"]) for tr_plan_entry in tr_plan.entries: for tr_run in tr_plan_entry.runs: diff --git a/bp_core/utils/env_variables.py b/bp_core/utils/env_variables.py index 6e314f81..cc8bfed7 100644 --- a/bp_core/utils/env_variables.py +++ b/bp_core/utils/env_variables.py @@ -17,7 +17,7 @@ def load_env_from_local_dotenv_file( None """ if dotenv_file_path is None: - dotenv_file = Path(__file__ + "/../../../configs/.local.env").resolve() + dotenv_file = Path(__file__ + "/../../../env_configs/.local.env").resolve() else: dotenv_file = Path(dotenv_file_path).resolve() diff --git a/configs/.local.env b/env_configs/.local.env similarity index 100% rename from configs/.local.env rename to env_configs/.local.env diff --git a/configs/android_chrome.json b/env_configs/android_chrome.json similarity index 100% rename from configs/android_chrome.json rename to env_configs/android_chrome.json diff --git a/configs/android_mobile_BS.json b/env_configs/android_mobile_BS.json similarity index 100% rename from configs/android_mobile_BS.json rename to env_configs/android_mobile_BS.json diff --git a/configs/android_mobile_docker.json b/env_configs/android_mobile_docker.json similarity index 100% rename from configs/android_mobile_docker.json rename to env_configs/android_mobile_docker.json diff --git a/configs/android_mobile_local.json b/env_configs/android_mobile_local.json similarity index 100% rename from configs/android_mobile_local.json rename to env_configs/android_mobile_local.json diff --git a/configs/docker_chrome.json b/env_configs/docker_chrome.json similarity index 100% rename from configs/docker_chrome.json rename to env_configs/docker_chrome.json diff --git a/configs/docker_edge.json b/env_configs/docker_edge.json similarity index 100% rename from configs/docker_edge.json rename to env_configs/docker_edge.json diff --git a/configs/docker_firefox.json b/env_configs/docker_firefox.json similarity index 100% rename from configs/docker_firefox.json rename to env_configs/docker_firefox.json diff --git a/configs/ios_chrome.json b/env_configs/ios_chrome.json similarity index 100% rename from configs/ios_chrome.json rename to env_configs/ios_chrome.json diff --git a/configs/ios_mobile_BS.json b/env_configs/ios_mobile_BS.json similarity index 100% rename from configs/ios_mobile_BS.json rename to env_configs/ios_mobile_BS.json diff --git a/configs/ios_mobile_docker.json b/env_configs/ios_mobile_docker.json similarity index 100% rename from configs/ios_mobile_docker.json rename to env_configs/ios_mobile_docker.json diff --git a/configs/ios_mobile_local.json b/env_configs/ios_mobile_local.json similarity index 100% rename from configs/ios_mobile_local.json rename to env_configs/ios_mobile_local.json diff --git a/configs/ios_safari.json b/env_configs/ios_safari.json similarity index 100% rename from configs/ios_safari.json rename to env_configs/ios_safari.json diff --git a/configs/mac_chrome.json b/env_configs/mac_chrome.json similarity index 100% rename from configs/mac_chrome.json rename to env_configs/mac_chrome.json diff --git a/configs/mac_edge.json b/env_configs/mac_edge.json similarity index 100% rename from configs/mac_edge.json rename to env_configs/mac_edge.json diff --git a/configs/mac_firefox.json b/env_configs/mac_firefox.json similarity index 100% rename from configs/mac_firefox.json rename to env_configs/mac_firefox.json diff --git a/configs/mac_safari.json b/env_configs/mac_safari.json similarity index 100% rename from configs/mac_safari.json rename to env_configs/mac_safari.json diff --git a/configs/win_chrome.json b/env_configs/win_chrome.json similarity index 100% rename from configs/win_chrome.json rename to env_configs/win_chrome.json diff --git a/configs/win_edge.json b/env_configs/win_edge.json similarity index 100% rename from configs/win_edge.json rename to env_configs/win_edge.json diff --git a/configs/win_firefox.json b/env_configs/win_firefox.json similarity index 100% rename from configs/win_firefox.json rename to env_configs/win_firefox.json diff --git a/install.py b/setup_install.py similarity index 97% rename from install.py rename to setup_install.py index 90085572..3db88a3b 100755 --- a/install.py +++ b/setup_install.py @@ -9,12 +9,10 @@ from pathlib import Path from bp_core.installation.installation_scripts.text_formatting import BColors, print_red, print_green, print_cyan -TERMINAL_WIDTH = 100 # default 100 +TERMINAL_WIDTH = 100 try: TERMINAL_WIDTH = os.get_terminal_size().columns except OSError: - # while running in IDE/containers, this method might raise OSError. - # in that case stick to default defined above try/except block. pass @@ -29,7 +27,7 @@ def install_selenium_drivers(): PROJECT_DIR = Path.cwd() TEMP_DIR = PROJECT_DIR / "temp" - BINARIES_DIR = PROJECT_DIR / "binaries" / "webdriver" + BINARIES_DIR = PROJECT_DIR / "webdriver" get_bs_local_by_platform(str(TEMP_DIR), str(BINARIES_DIR)) diff --git a/install.sh b/setup_install.sh similarity index 82% rename from install.sh rename to setup_install.sh index f7ca5f72..af37e853 100755 --- a/install.sh +++ b/setup_install.sh @@ -1,10 +1,9 @@ #!/bin/sh -# User should be running this script as `source install.sh`, not `sh install.sh` PLATFORM_TYPE=$(command uname) # Run Steps that is not dependent on python virtual environment -python ./install.py global +python ./setup_install.py global RETCODE=$? if [ $RETCODE = 0 ]; then @@ -18,7 +17,6 @@ if [ $RETCODE = 0 ]; then . $HOME\\.bp-venv\\Scripts\\activate fi else - # Don't Do anything. install.py should take care of it. true fi @@ -26,7 +24,7 @@ echo "Activated Virtual Environment .bp-venv..." echo "\n" # Activate Virtual Environment and then run remaining installation steps that's dependent on venv & dependencies. -python ./install.py venv +python ./setup_install.py venv RETCODE=$? if [ $RETCODE = 0 ]; then @@ -37,6 +35,5 @@ if [ $RETCODE = 0 ]; then echo -e "Yet another Important Note: Please activate virtual environment using command \". $HOME/.bp-venv/bin/activate\" while running test cases from new shell. Need not activate now, since it is already activated." fi else - # Don't Do anything. install.py should take care of it. true fi