From aeaa38fbc9fbd719f7fb484ed946965faca9f159 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Tue, 5 Apr 2022 05:51:43 +0530 Subject: [PATCH 01/25] fixed the channels Signed-off-by: Jyothsna-setti --- .../client_connectivity/test_general_security_modes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py index 2075d181e87..078f141ea15 100644 --- a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py +++ b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py @@ -48,6 +48,7 @@ class TestBridgeModeConnectivitySuiteA(object): @pytest.mark.open @pytest.mark.twog + @pytest.mark.hari @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2809", name="JIRA LINK") def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, lf_test, update_report, From e51b1d0e7f3f5f02a74ebed1165ee6cb85ff077b Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Tue, 5 Apr 2022 10:13:59 +0530 Subject: [PATCH 02/25] channels fixed Signed-off-by: Jyothsna-setti --- .github/actions/run-tests/action.yml | 4 +- .github/workflows/ow_docker-compose.yml | 72 +++++-- .github/workflows/quali-advanced.yml | 8 + .github/workflows/quali.yml | 72 +++++++ .../workflows/test-ucentral-deployment.yaml | 11 +- .github/workflows/uc_loadsim.yml | 53 +++-- .../workflows/ucentralgw-dev-deployment.yaml | 7 +- .../workflows/ucentralgw-qa-deployment.yaml | 9 +- .github/workflows/update-badges.yml | 4 +- README.md | 4 +- docker-compose/openwifi/deploy.sh | 31 ++- helm/ucentral/deploy.sh | 36 +++- .../values.ucentral-qa.separate-lbs.yaml | 38 ++-- .../values.ucentral-qa.test-nodes.yaml | 2 +- helm/ucentral/values.ucentral-qa.yaml | 183 ++++++++++++++++-- libs/controller/controller_2x/controller.py | 16 +- .../dfs_20MHz/test_dfs_20_bridge.py | 180 +++++++++++------ .../dfs_40MHz/test_dfs_40_bridge.py | 76 +++++--- .../dfs_80MHz/test_dfs_80_bridge.py | 45 +++-- .../test_enterprise_tls.py | 32 +-- .../test_general_security_modes.py | 72 ++----- .../test_enterprise_tls.py | 32 +-- .../test_enterprise_ttls.py | 30 +-- .../test_general_security_modes.py | 72 ++----- .../test_general_security_modes.py | 72 ++----- .../iOS/test_general_security_modes.py | 83 ++++++++ .../android/test_general_security_modes.py | 12 +- .../iOS/test_general_security_mode.py | 12 +- tests/fixtures_2x.py | 8 +- 29 files changed, 816 insertions(+), 460 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 353f0a51d45..16d8f001b47 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -144,14 +144,14 @@ runs: exit $EXIT_CODE - name: upload Allure results as artifact - if: ${{ always() }} + if: always() uses: actions/upload-artifact@v2 with: name: ${{ inputs.allure_results_artifact_name }} path: allure-results - name: cleanup - if: ${{ always() }} + if: always() shell: bash run: | kubectl delete ns "${{ inputs.namespace }}" --wait=true diff --git a/.github/workflows/ow_docker-compose.yml b/.github/workflows/ow_docker-compose.yml index 902d8c22f03..e2b4f9c07d3 100644 --- a/.github/workflows/ow_docker-compose.yml +++ b/.github/workflows/ow_docker-compose.yml @@ -17,10 +17,6 @@ on: default: 'master' description: 'OpenWIFI Gateway version to be deployed.' required: false - owgwui_version: - default: 'main' - description: 'OpenWIFI Web UI version to be deployed.' - required: false owsec_version: default: 'main' description: 'OpenWIFI Security version to be deployed.' @@ -33,9 +29,13 @@ on: default: 'main' description: 'OpenWIFI Provisioning version to be deployed.' required: false - owprovui_version: + owanalytics_version: + default: 'main' + description: 'OpenWIFI Analytics version to be deployed.' + required: false + owsub_version: default: 'main' - description: 'OpenWIFI Provisioning Web UI version to be deployed.' + description: 'OpenWIFI Subscription (Userportal) version to be deployed.' required: false id: description: 'run identifier' @@ -110,7 +110,6 @@ jobs: - name: Deploy OpenWIFI Cloud SDK working-directory: wlan-testing/docker-compose/openwifi env: - RTTY_TOKEN: ${{ secrets.RTTY_TOKEN }} OWSEC_AUTHENTICATION_DEFAULT_USERNAME: ${{ secrets.UCENTRALGW_AUTH_USERNAME }} OWSEC_AUTHENTICATION_DEFAULT_PASSWORD: ${{ secrets.UCENTRALGW_AUTH_PASSWORD }} OWFMS_S3_SECRET: ${{ secrets.UCENTRALFMS_S3_SECRET }} @@ -127,7 +126,7 @@ jobs: external-dns.alpha.kubernetes.io/hostname: ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" - service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,443,16001,16004,16005,8443,5912,5913" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,443,16001,16004,16005,8443,5912,5913,16009,16006" labels: app: ow-docker-compose-${{ github.run_id }} spec: @@ -151,6 +150,13 @@ jobs: port: 16003 targetPort: 16003 protocol: TCP + - name: owgw-rttys + port: 5912 + targetPort: 5912 + protocol: TCP + - name: owgw-rttys-view + port: 5913 + targetPort: 5913 - name: owgw-ui-http port: 80 targetPort: 80 @@ -158,6 +164,7 @@ jobs: - name: owgw-ui-https port: 443 targetPort: 443 + protocol: TCP - name: owsec-restapi port: 16001 targetPort: 16001 @@ -165,6 +172,7 @@ jobs: - name: owsec-alivecheck port: 16101 targetPort: 16101 + protocol: TCP - name: owfms-restapi port: 16004 targetPort: 16004 @@ -172,6 +180,7 @@ jobs: - name: owfms-alivecheck port: 16104 targetPort: 16104 + protocol: TCP - name: owprov-restapi port: 16005 targetPort: 16005 @@ -179,6 +188,7 @@ jobs: - name: owprov-alivecheck port: 16105 targetPort: 16105 + protocol: TCP - name: owprov-ui-http port: 8080 targetPort: 8080 @@ -186,13 +196,23 @@ jobs: - name: owprov-ui-https port: 8443 targetPort: 8443 - - name: rttys-dev - port: 5912 - targetPort: 5912 protocol: TCP - - name: rttys-user - port: 5913 - targetPort: 5913 + - name: owanalytics-restapi + port: 16009 + targetPort: 16009 + protocol: TCP + - name: owanalytics-alivecheck + port: 16109 + targetPort: 16109 + protocol: TCP + - name: owsub-restapi + port: 16006 + targetPort: 16006 + protocol: TCP + - name: owsub-alivecheck + port: 16106 + targetPort: 16106 + protocol: TCP --- apiVersion: v1 kind: Pod @@ -241,7 +261,7 @@ jobs: - name: OWGW_TAG value: "${{ github.event.inputs.owgw_version }}" - name: OWGWUI_TAG - value: "${{ github.event.inputs.owgwui_version }}" + value: "main" - name: OWSEC_TAG value: "${{ github.event.inputs.owsec_version }}" - name: OWFMS_TAG @@ -249,7 +269,11 @@ jobs: - name: OWPROV_TAG value: "${{ github.event.inputs.owprov_version }}" - name: OWPROVUI_TAG - value: "${{ github.event.inputs.owprovui_version }}" + value: "main" + - name: OWANALYTICS_TAG + value: "${{ github.event.inputs.owanalytics_version }}" + - name: OWSUB_TAG + value: "${{ github.event.inputs.owsub_version }}" - name: INTERNAL_OWGW_HOSTNAME value: "owgw.wlan.local" - name: INTERNAL_OWSEC_HOSTNAME @@ -258,12 +282,14 @@ jobs: value: "owfms.wlan.local" - name: INTERNAL_OWPROV_HOSTNAME value: "owprov.wlan.local" + - name: INTERNAL_OWANALYTICS_HOSTNAME + value: "owanalytics.wlan.local" + - name: INTERNAL_OWSUB_HOSTNAME + value: "owsub.wlan.local" - name: SYSTEM_URI_UI value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build" - name: DEFAULT_UCENTRALSEC_URL value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build:16001" - - name: RTTY_TOKEN - value: "$RTTY_TOKEN" - name: OWGW_FILEUPLOADER_HOST_NAME value: "ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build" - name: OWGW_FILEUPLOADER_URI @@ -294,6 +320,14 @@ jobs: value: "https://owprov.wlan.local:17005" - name: OWPROV_SYSTEM_URI_PUBLIC value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build:16005" + - name: OWANALYTICS_SYSTEM_URI_PRIVATE + value: "https://owanalytics.wlan.local:17009" + - name: OWANALYTICS_SYSTEM_URI_PUBLIC + value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build:16009" + - name: OWSUB_SYSTEM_URI_PRIVATE + value: "https://owsub.wlan.local:17006" + - name: OWSUB_SYSTEM_URI_PUBLIC + value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build:16006" - name: WEBSOCKET_CERT value: "/tip-cicd-wildcard-certs/websocket-cert.pem" - name: WEBSOCKET_KEY @@ -328,12 +362,14 @@ jobs: OWSEC_DEFAULT_USERNAME: ${{ secrets.OWSEC_DEFAULT_USERNAME }} OWSEC_DEFAULT_PASSWORD: ${{ secrets.OWSEC_DEFAULT_PASSWORD }} OWSEC_NEW_PASSWORD: ${{ secrets.OWSEC_NEW_PASSWORD }} + CHECK_RETRIES: 60 run: | docker run --rm \ -e OWSEC \ -e OWSEC_DEFAULT_USERNAME \ -e OWSEC_DEFAULT_PASSWORD \ -e OWSEC_NEW_PASSWORD \ + -e CHECK_RETRIES \ tip-tip-wlan-cloud-ucentral.jfrog.io/clustersysteminfo:main deploy-virtual-ap-instance: diff --git a/.github/workflows/quali-advanced.yml b/.github/workflows/quali-advanced.yml index d3e6386e2a8..7ccff722844 100644 --- a/.github/workflows/quali-advanced.yml +++ b/.github/workflows/quali-advanced.yml @@ -170,6 +170,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/analytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: stop reservation if: always() run: python .quali/stop_reservation.py ${{ steps.reservation.outputs.identifier }} diff --git a/.github/workflows/quali.yml b/.github/workflows/quali.yml index 9235da64fd3..24e49448976 100644 --- a/.github/workflows/quali.yml +++ b/.github/workflows/quali.yml @@ -169,6 +169,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -270,6 +278,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -371,6 +387,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -472,6 +496,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -573,6 +605,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -674,6 +714,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -775,6 +823,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -876,6 +932,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec @@ -977,6 +1041,14 @@ jobs: if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owprov + - name: show analytics logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owanalytics + + - name: show subscription (userportal) logs + if: failure() + run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsub + - name: show sec logs if: failure() run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec diff --git a/.github/workflows/test-ucentral-deployment.yaml b/.github/workflows/test-ucentral-deployment.yaml index 3df73767292..786a2de640b 100644 --- a/.github/workflows/test-ucentral-deployment.yaml +++ b/.github/workflows/test-ucentral-deployment.yaml @@ -51,6 +51,14 @@ on: default: 'main' description: 'OpenWIFI Provisioning Web UI version to be deployed (git tag or helm package version may be used, main is default)' required: true + owanalytics_version: + default: 'main' + description: 'OpenWIFI Analytics version to be deployed (git tag or helm package version may be used, main is default)' + required: true + owsub_version: + default: 'main' + description: 'OpenWIFI Subscription (Userportal) version to be deployed (git tag or helm package version may be used, main is default)' + required: true jobs: deploy: @@ -85,8 +93,9 @@ jobs: export OWFMS_VERSION=${{ github.event.inputs.owfms_version }} export OWPROV_VERSION=${{ github.event.inputs.owprov_version }} export OWPROVUI_VERSION=${{ github.event.inputs.owprovui_version }} + export OWANALYTICS_VERSION=${{ github.event.inputs.owanalytics_version }} + export OWSUB_VERSION=${{ github.event.inputs.owsub_version }} export VALUES_FILE_LOCATION=values.ucentral-qa.yaml - export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }} export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }} export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }} diff --git a/.github/workflows/uc_loadsim.yml b/.github/workflows/uc_loadsim.yml index 50edb411732..a852cfb8117 100644 --- a/.github/workflows/uc_loadsim.yml +++ b/.github/workflows/uc_loadsim.yml @@ -81,8 +81,9 @@ jobs: export OWFMS_VERSION=main export OWPROV_VERSION=main export OWPROVUI_VERSION=main + export OWANALYTICS_VERSION=main + export OWSUB_VERSION=main export VALUES_FILE_LOCATION=values.ucentral-qa.yaml,values.ucentral-qa.test-nodes.yaml,values.ucentral-qa.owls-enabled.yaml - export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }} export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }} export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }} @@ -367,7 +368,6 @@ jobs: - name: Deploy CloudSDK using Docker-compose working-directory: wlan-testing/docker-compose/openwifi env: - RTTY_TOKEN: ${{ secrets.RTTY_TOKEN }} OWSEC_AUTHENTICATION_DEFAULT_USERNAME: ${{ secrets.UCENTRALGW_AUTH_USERNAME }} OWSEC_AUTHENTICATION_DEFAULT_PASSWORD: ${{ secrets.UCENTRALGW_AUTH_PASSWORD }} OWFMS_S3_SECRET: ${{ secrets.UCENTRALFMS_S3_SECRET }} @@ -384,7 +384,7 @@ jobs: external-dns.alpha.kubernetes.io/hostname: ${{ steps.cloudsdk.outputs.url }} service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" - service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,443,16001,16004,16005,8443,5912,5913" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,443,16001,16004,16005,8443,5912,5913,16009,16006" labels: app: cloudsdk spec: @@ -408,6 +408,13 @@ jobs: port: 16003 targetPort: 16003 protocol: TCP + - name: owgw-rttys + port: 5912 + targetPort: 5912 + protocol: TCP + - name: owgw-rttys-view + port: 5913 + targetPort: 5913 - name: owgw-ui-http port: 80 targetPort: 80 @@ -415,6 +422,7 @@ jobs: - name: owgw-ui-https port: 443 targetPort: 443 + protocol: TCP - name: owsec-restapi port: 16001 targetPort: 16001 @@ -422,6 +430,7 @@ jobs: - name: owsec-alivecheck port: 16101 targetPort: 16101 + protocol: TCP - name: owfms-restapi port: 16004 targetPort: 16004 @@ -429,6 +438,7 @@ jobs: - name: owfms-alivecheck port: 16104 targetPort: 16104 + protocol: TCP - name: owprov-restapi port: 16005 targetPort: 16005 @@ -436,6 +446,7 @@ jobs: - name: owprov-alivecheck port: 16105 targetPort: 16105 + protocol: TCP - name: owprov-ui-http port: 8080 targetPort: 8080 @@ -443,13 +454,23 @@ jobs: - name: owprov-ui-https port: 8443 targetPort: 8443 - - name: rttys-dev - port: 5912 - targetPort: 5912 protocol: TCP - - name: rttys-user - port: 5913 - targetPort: 5913 + - name: owanalytics-restapi + port: 16009 + targetPort: 16009 + protocol: TCP + - name: owanalytics-alivecheck + port: 16109 + targetPort: 16109 + protocol: TCP + - name: owsub-restapi + port: 16006 + targetPort: 16006 + protocol: TCP + - name: owsub-alivecheck + port: 16106 + targetPort: 16106 + protocol: TCP --- apiVersion: v1 kind: Pod @@ -514,14 +535,16 @@ jobs: value: "owfms.wlan.local" - name: INTERNAL_OWPROV_HOSTNAME value: "owprov.wlan.local" + - name: INTERNAL_OWANALYTICS_HOSTNAME + value: "owanalytics.wlan.local" + - name: INTERNAL_OWSUB_HOSTNAME + value: "owsub.wlan.local" - name: DEPLOY_VERSION value: "${{ github.event.inputs.sdk_version }}" - name: SYSTEM_URI_UI value: "https://${{ steps.cloudsdk.outputs.url }}" - name: DEFAULT_UCENTRALSEC_URL value: "https://${{ steps.cloudsdk.outputs.url }}:16001" - - name: RTTY_TOKEN - value: "$RTTY_TOKEN" - name: OWGW_FILEUPLOADER_HOST_NAME value: "${{ steps.cloudsdk.outputs.url }}" - name: OWGW_FILEUPLOADER_URI @@ -552,6 +575,14 @@ jobs: value: "https://owprov.wlan.local:17005" - name: OWPROV_SYSTEM_URI_PUBLIC value: "https://${{ steps.cloudsdk.outputs.url }}:16005" + - name: OWANALYTICS_SYSTEM_URI_PRIVATE + value: "https://owanalytics.wlan.local:17009" + - name: OWANALYTICS_SYSTEM_URI_PUBLIC + value: "https://${{ steps.cloudsdk.outputs.url }}:16009" + - name: OWSUB_SYSTEM_URI_PRIVATE + value: "https://owsub.wlan.local:17006" + - name: OWSUB_SYSTEM_URI_PUBLIC + value: "https://ow-docker-compose-${{ github.run_id }}.cicd.lab.wlan.tip.build:16006" - name: WEBSOCKET_CERT value: "/tip-cicd-wildcard-certs/websocket-cert.pem" - name: WEBSOCKET_KEY diff --git a/.github/workflows/ucentralgw-dev-deployment.yaml b/.github/workflows/ucentralgw-dev-deployment.yaml index 99cbd42ab97..dede2fea0b7 100644 --- a/.github/workflows/ucentralgw-dev-deployment.yaml +++ b/.github/workflows/ucentralgw-dev-deployment.yaml @@ -25,6 +25,8 @@ env: # - owsec_version - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owfms_version - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owprov_version - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - owanalytics_version - OpenWIFI Analytics version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - owsub_version - OpenWIFI Subscription (Userportal) version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owgwui_version - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owprovui_version - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) testbeds: '[ @@ -36,6 +38,8 @@ env: "owsec_version": "main", "owfms_version": "main", "owprov_version": "main", + "owanalytics_version": "main", + "owsub_version": "main", "owgwui_version": "main", "owprovui_version": "main" } @@ -92,8 +96,9 @@ jobs: export OWFMS_VERSION=${{ matrix.owfms_version }} export OWPROV_VERSION=${{ matrix.owprov_version }} export OWPROVUI_VERSION=${{ matrix.owprovui_version }} + export OWANALYTICS_VERSION=${{ matrix.owanalytics_version }} + export OWSUB_VERSION=${{ matrix.owsub_version }} export VALUES_FILE_LOCATION=values.ucentral-qa.yaml - export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }} export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }} export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }} diff --git a/.github/workflows/ucentralgw-qa-deployment.yaml b/.github/workflows/ucentralgw-qa-deployment.yaml index b71078221f6..1e2a0da92af 100644 --- a/.github/workflows/ucentralgw-qa-deployment.yaml +++ b/.github/workflows/ucentralgw-qa-deployment.yaml @@ -25,6 +25,8 @@ env: # - owsec_version - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owfms_version - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owprov_version - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - owanalytics_version - OpenWIFI Analytics version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - owsub_version - OpenWIFI Subscription (Userportal) version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owgwui_version - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) # - owprovui_version - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) testbeds: '[ @@ -36,6 +38,8 @@ env: "owsec_version": "v2.5.0-RC1", "owfms_version": "v2.5.0-RC1", "owprov_version": "v2.5.0-RC1", + "owanalytics_version": "main", + "owsub_version": "main", "owgwui_version": "v2.5.0-RC1", "owprovui_version": "v2.5.0-RC1" }, @@ -47,6 +51,8 @@ env: "owsec_version": "v2.5.0-RC1", "owfms_version": "v2.5.0-RC1", "owprov_version": "v2.5.0-RC1", + "owanalytics_version": "main", + "owsub_version": "main", "owgwui_version": "v2.5.0-RC1", "owprovui_version": "v2.5.0-RC1" } @@ -103,8 +109,9 @@ jobs: export OWFMS_VERSION=${{ matrix.owfms_version }} export OWPROV_VERSION=${{ matrix.owprov_version }} export OWPROVUI_VERSION=${{ matrix.owprovui_version }} + export OWANALYTICS_VERSION=${{ matrix.owanalytics_version }} + export OWSUB_VERSION=${{ matrix.owsub_version }} export VALUES_FILE_LOCATION=values.ucentral-qa.yaml - export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }} export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }} export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }} diff --git a/.github/workflows/update-badges.yml b/.github/workflows/update-badges.yml index 0cb83a9c6a8..81ee7065911 100644 --- a/.github/workflows/update-badges.yml +++ b/.github/workflows/update-badges.yml @@ -38,12 +38,12 @@ jobs: run: | mkdir -p ../.img wget https://img.shields.io/badge/total_tests-$(pytest --collect-only -q | tail -1 | cut -d ' ' -f 1)-green?style=flat-square -O ../badges/total-count.svg - wget https://img.shields.io/badge/interop_tests-$(pytest --collect-only -m "interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/interop-count.svg + wget https://img.shields.io/badge/interop_tests-$(pytest --collect-only -m "interop_uc_sanity and client_connect" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/interop-count.svg wget https://img.shields.io/badge/sanity_tests-$(pytest --collect-only -m "uc_sanity and not interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/sanity-count.svg wget https://img.shields.io/badge/performance_tests-$(pytest --collect-only -m "performance" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/performance-count.svg wget https://img.shields.io/badge/advance_tests-$(pytest --collect-only -m "advance" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/advance-count.svg wget https://img.shields.io/badge/regression_tests-$(pytest --collect-only -m "regression and not interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/regression-count.svg - wget https://img.shields.io/badge/interop_regression_tests-$(pytest --collect-only -m "regression and interop" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/regression-interop-count.svg + wget https://img.shields.io/badge/interop_performance_tests-$(pytest --collect-only -m "interop_uc_sanity and client_connectivity" -q | tail -1 | cut -d '/' -f 1)-green?style=flat-square -O ../badges/performance-interop-count.svg - name: commit changes working-directory: badges diff --git a/README.md b/README.md index c008e420df7..17d6cce2e6c 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ http://pythontesting.net/framework/pytest/pytest-introduction/ [![regression testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/regression.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/regression.yml) ![Regression test count](https://raw.githubusercontent.com/Telecominfraproject/wlan-testing/badges/regression-count.svg) -[![interop regression testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop_regression.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop_regression.yml) -![Interop Regression test count](https://raw.githubusercontent.com/Telecominfraproject/wlan-testing/badges/regression-interop-count.svg) +[![interop performance testing](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop_performance.yml/badge.svg)](https://github.com/Telecominfraproject/wlan-testing/actions/workflows/interop_performance.yml) +![Interop Performance test count](https://raw.githubusercontent.com/Telecominfraproject/wlan-testing/badges/performance-interop-count.svg) ### Best Practice diff --git a/docker-compose/openwifi/deploy.sh b/docker-compose/openwifi/deploy.sh index 4ff817b275f..cd26ccd551b 100755 --- a/docker-compose/openwifi/deploy.sh +++ b/docker-compose/openwifi/deploy.sh @@ -12,19 +12,19 @@ usage () { echo; echo "- DEFAULT_UCENTRALSEC_URL - public URL of the OWSec service" echo "- SYSTEM_URI_UI - public URL of the OWGW-UI service" - echo "- RTTY_TOKEN - token to be used for rttys and OWGW for remote tty sessions" echo; echo "- INTERNAL_OWGW_HOSTNAME - OWGW microservice hostname for Docker internal communication" echo "- INTERNAL_OWSEC_HOSTNAME - OWSec microservice hostname for Docker internal communication" echo "- INTERNAL_OWFMS_HOSTNAME - OWFms microservice hostname for Docker internal communication" echo "- INTERNAL_OWPROV_HOSTNAME - OWProv microservice hostname for Docker internal communication" + echo "- INTERNAL_OWANALYTICS_HOSTNAME - OWAnalytics microservice hostname for Docker internal communication" + echo "- INTERNAL_OWSUB_HOSTNAME - OWSub microservice hostname for Docker internal communication" echo; echo "- OWGW_FILEUPLOADER_HOST_NAME - hostname to be used for OWGW fileupload"; echo "- OWGW_FILEUPLOADER_URI - URL to be used for OWGW fileupload"; echo "- OWGW_SYSTEM_URI_PRIVATE - private URL to be used for OWGW"; echo "- OWGW_SYSTEM_URI_PUBLIC - public URL to be used for OWGW"; echo "- OWGW_RTTY_SERVER - public hostname of the RTTY server"; - echo "- OWGW_RTTY_TOKEN - token to be used for rttys and OWGW for remote tty sessions"; echo; echo "- OWSEC_SYSTEM_URI_PRIVATE - private URL to be used for OWSec"; echo "- OWSEC_SYSTEM_URI_PUBLIC - public URL to be used for OWSec"; @@ -39,6 +39,12 @@ usage () { echo "- OWPROV_SYSTEM_URI_PRIVATE - private URL to be used for OWProv"; echo "- OWPROV_SYSTEM_URI_PUBLIC - public URL to be used for OWProv"; echo; + echo "- OWANALYTICS_SYSTEM_URI_PRIVATE - private URL to be used for OWAnalytics"; + echo "- OWANALYTICS_SYSTEM_URI_PUBLIC - public URL to be used for OWAnalytics"; + echo; + echo "- OWSUB_SYSTEM_URI_PRIVATE - private URL to be used for OWSub"; + echo "- OWSUB_SYSTEM_URI_PUBLIC - public URL to be used for OWSub"; + echo; echo "- WEBSOCKET_CERT - path to the websocket certificate"; echo "- WEBSOCKET_KEY - path to the websocket key"; } @@ -49,12 +55,13 @@ usage () { ## Configuration variables applying to multiple microservices [ -z ${DEFAULT_UCENTRALSEC_URL+x} ] && echo "DEFAULT_UCENTRALSEC_URL is unset" && usage && exit 1 [ -z ${SYSTEM_URI_UI+x} ] && echo "SYSTEM_URI_UI is unset" && usage && exit 1 -[ -z ${RTTY_TOKEN+x} ] && echo "RTTY_TOKEN is unset" && usage && exit 1 ## Internal microservice hostnames [ -z ${INTERNAL_OWGW_HOSTNAME+x} ] && echo "INTERNAL_OWGW_HOSTNAME is unset" && usage && exit 1 [ -z ${INTERNAL_OWSEC_HOSTNAME+x} ] && echo "INTERNAL_OWSEC_HOSTNAME is unset" && usage && exit 1 [ -z ${INTERNAL_OWFMS_HOSTNAME+x} ] && echo "INTERNAL_OWFMS_HOSTNAME is unset" && usage && exit 1 [ -z ${INTERNAL_OWPROV_HOSTNAME+x} ] && echo "INTERNAL_OWPROV_HOSTNAME is unset" && usage && exit 1 +[ -z ${INTERNAL_OWANALYTICS_HOSTNAME+x} ] && echo "INTERNAL_OWANALYTICS_HOSTNAME is unset" && usage && exit 1 +[ -z ${INTERNAL_OWSUB_HOSTNAME+x} ] && echo "INTERNAL_OWSUB_HOSTNAME is unset" && usage && exit 1 ## OWGW configuration variables [ -z ${OWGW_FILEUPLOADER_HOST_NAME+x} ] && echo "OWGW_FILEUPLOADER_HOST_NAME is unset" && usage && exit 1 [ -z ${OWGW_FILEUPLOADER_URI+x} ] && echo "OWGW_FILEUPLOADER_URI is unset" && usage && exit 1 @@ -74,6 +81,12 @@ usage () { ## OWProv configuration variables [ -z ${OWPROV_SYSTEM_URI_PRIVATE+x} ] && echo "OWPROV_SYSTEM_URI_PRIVATE is unset" && usage && exit 1 [ -z ${OWPROV_SYSTEM_URI_PUBLIC+x} ] && echo "OWPROV_SYSTEM_URI_PUBLIC is unset" && usage && exit 1 +## OWAnalytics configuration variables +[ -z ${OWANALYTICS_SYSTEM_URI_PRIVATE+x} ] && echo "OWANALYTICS_SYSTEM_URI_PRIVATE is unset" && usage && exit 1 +[ -z ${OWANALYTICS_SYSTEM_URI_PUBLIC+x} ] && echo "OWANALYTICS_SYSTEM_URI_PUBLIC is unset" && usage && exit 1 +## OWSub configuration variables +[ -z ${OWSUB_SYSTEM_URI_PRIVATE+x} ] && echo "OWSUB_SYSTEM_URI_PRIVATE is unset" && usage && exit 1 +[ -z ${OWSUB_SYSTEM_URI_PUBLIC+x} ] && echo "OWSUB_SYSTEM_URI_PUBLIC is unset" && usage && exit 1 ## cert related variables [ -z ${WEBSOCKET_CERT+x} ] && echo "WEBSOCKET_CERT is unset" && usage && exit 1 [ -z ${WEBSOCKET_KEY+x} ] && echo "WEBSOCKET_KEY is unset" && usage && exit 1 @@ -89,6 +102,8 @@ sed -i "s~\(^INTERNAL_OWGW_HOSTNAME=\).*~\1$INTERNAL_OWGW_HOSTNAME~" .env sed -i "s~\(^INTERNAL_OWSEC_HOSTNAME=\).*~\1$INTERNAL_OWSEC_HOSTNAME~" .env sed -i "s~\(^INTERNAL_OWFMS_HOSTNAME=\).*~\1$INTERNAL_OWFMS_HOSTNAME~" .env sed -i "s~\(^INTERNAL_OWPROV_HOSTNAME=\).*~\1$INTERNAL_OWPROV_HOSTNAME~" .env +sed -i "s~\(^INTERNAL_OWANALYTICS_HOSTNAME=\).*~\1$INTERNAL_OWANALYTICS_HOSTNAME~" .env +sed -i "s~\(^INTERNAL_OWSUB_HOSTNAME=\).*~\1$INTERNAL_OWSUB_HOSTNAME~" .env sed -i "s~\(^FILEUPLOADER_HOST_NAME=\).*~\1$OWGW_FILEUPLOADER_HOST_NAME~" owgw.env sed -i "s~\(^FILEUPLOADER_URI=\).*~\1$OWGW_FILEUPLOADER_URI~" owgw.env @@ -96,7 +111,6 @@ sed -i "s~\(^SYSTEM_URI_PRIVATE=\).*~\1$OWGW_SYSTEM_URI_PRIVATE~" owgw.env sed -i "s~\(^SYSTEM_URI_PUBLIC=\).*~\1$OWGW_SYSTEM_URI_PUBLIC~" owgw.env sed -i "s~\(^SYSTEM_URI_UI=\).*~\1$SYSTEM_URI_UI~" owgw.env sed -i "s~\(^RTTY_SERVER=\).*~\1$OWGW_RTTY_SERVER~" owgw.env -sed -i "s~.*RTTY_TOKEN=.*~RTTY_TOKEN=$RTTY_TOKEN~" owgw.env if [[ ! -z "$SIMULATORID" ]]; then sed -i "s~.*SIMULATORID=.*~SIMULATORID=$SIMULATORID~" owgw.env @@ -121,8 +135,15 @@ sed -i "s~\(^SYSTEM_URI_PUBLIC=\).*~\1$OWPROV_SYSTEM_URI_PUBLIC~" owprov.env sed -i "s~\(^SYSTEM_URI_UI=\).*~\1$SYSTEM_URI_UI~" owprov.env sed -i "s~\(^DEFAULT_UCENTRALSEC_URL=\).*~\1$DEFAULT_UCENTRALSEC_URL~" owprov-ui.env +sed -i "s~\(^REACT_APP_UCENTRALSEC_URL=\).*~\1$REACT_APP_UCENTRALSEC_URL~" owprov-ui.env + +sed -i "s~\(^SYSTEM_URI_PRIVATE=\).*~\1$OWANALYTICS_SYSTEM_URI_PRIVATE~" owanalytics.env +sed -i "s~\(^SYSTEM_URI_PUBLIC=\).*~\1$OWANALYTICS_SYSTEM_URI_PUBLIC~" owanalytics.env +sed -i "s~\(^SYSTEM_URI_UI=\).*~\1$SYSTEM_URI_UI~" owanalytics.env -sed -i "s~\(^token:\).*~\1 $RTTY_TOKEN~" rttys/rttys.conf +sed -i "s~\(^SYSTEM_URI_PRIVATE=\).*~\1$OWSUB_SYSTEM_URI_PRIVATE~" owsub.env +sed -i "s~\(^SYSTEM_URI_PUBLIC=\).*~\1$OWSUB_SYSTEM_URI_PUBLIC~" owsub.env +sed -i "s~\(^SYSTEM_URI_UI=\).*~\1$SYSTEM_URI_UI~" owsub.env # Run the deployment and attach to logs cat $WEBSOCKET_CERT > certs/websocket-cert.pem diff --git a/helm/ucentral/deploy.sh b/helm/ucentral/deploy.sh index df626b1cc82..9a24bf404b6 100755 --- a/helm/ucentral/deploy.sh +++ b/helm/ucentral/deploy.sh @@ -13,7 +13,6 @@ usage () { echo "- CHART_VERSION - version of chart to be deployed from assembly chart (for 'git' method git ref may be passed, for 'bundle' method version of chart may be passed)"; echo; echo "- VALUES_FILE_LOCATION - path to file with override values that may be used for deployment"; - echo "- RTTY_TOKEN - token to be used for rttys and OpenWIFI Gateway for remote tty sessions"; echo "- OWGW_AUTH_USERNAME - username to be used for requests to OpenWIFI Security"; echo "- OWGW_AUTH_PASSWORD - hashed password for OpenWIFI Security (details on this may be found in https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/#authenticationdefaultpassword)"; echo "- OWFMS_S3_SECRET - secret key that is used for OpenWIFI Firmware access to firmwares S3 bucket"; @@ -30,6 +29,8 @@ usage () { echo "- OWFMS_VERSION - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; echo "- OWPROV_VERSION - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; echo "- OWPROVUI_VERSION - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo "- OWANALYTICS_VERSION - OpenWIFI Analytics version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo "- OWSUB_VERSION - OpenWIFI Subscription (Userportal) version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; echo; echo "Optional environment variables:" echo; @@ -67,12 +68,13 @@ else [ -z ${OWFMS_VERSION+x} ] && echo "OWFMS_VERSION is unset" && usage && exit 1 [ -z ${OWPROV_VERSION+x} ] && echo "OWPROV_VERSION is unset" && usage && exit 1 [ -z ${OWPROVUI_VERSION+x} ] && echo "OWPROVUI_VERSION is unset" && usage && exit 1 + [ -z ${OWANALYTICS_VERSION+x} ] && echo "OWANALYTICS_VERSION is unset" && usage && exit 1 + [ -z ${OWSUB_VERSION+x} ] && echo "OWSUB_VERSION is unset" && usage && exit 1 fi ## Environment specifics [ -z ${NAMESPACE+x} ] && echo "NAMESPACE is unset" && usage && exit 1 ## Variables specifics [ -z ${VALUES_FILE_LOCATION+x} ] && echo "VALUES_FILE_LOCATION is unset" && usage && exit 1 -[ -z ${RTTY_TOKEN+x} ] && echo "RTTY_TOKEN is unset" && usage && exit 1 [ -z ${OWGW_AUTH_USERNAME+x} ] && echo "OWGW_AUTH_USERNAME is unset" && usage && exit 1 [ -z ${OWGW_AUTH_PASSWORD+x} ] && echo "OWGW_AUTH_PASSWORD is unset" && usage && exit 1 [ -z ${OWFMS_S3_SECRET+x} ] && echo "OWFMS_S3_SECRET is unset" && usage && exit 1 @@ -91,6 +93,8 @@ export OWSEC_VERSION_TAG=$(echo ${OWSEC_VERSION} | tr '/' '-') export OWFMS_VERSION_TAG=$(echo ${OWFMS_VERSION} | tr '/' '-') export OWPROV_VERSION_TAG=$(echo ${OWPROV_VERSION} | tr '/' '-') export OWPROVUI_VERSION_TAG=$(echo ${OWPROVUI_VERSION} | tr '/' '-') +export OWANALYTICS_VERSION_TAG=$(echo ${OWANALYTICS_VERSION} | tr '/' '-') +export OWSUB_VERSION_TAG=$(echo ${OWSUB_VERSION} | tr '/' '-') # Debug get bash version bash --version > /dev/stderr @@ -111,6 +115,8 @@ if [[ "$DEPLOY_METHOD" == "git" ]]; then sed -i '/wlan-cloud-ucentralfms@/s/ref=.*/ref='${OWFMS_VERSION}'\"/g' Chart.yaml sed -i '/wlan-cloud-owprov@/s/ref=.*/ref='${OWPROV_VERSION}'\"/g' Chart.yaml sed -i '/wlan-cloud-owprov-ui@/s/ref=.*/ref='${OWPROVUI_VERSION}'\"/g' Chart.yaml + sed -i '/wlan-cloud-analytics@/s/ref=.*/ref='${OWANALYTICS_VERSION}'\"/g' Chart.yaml + sed -i '/wlan-cloud-userportal@/s/ref=.*/ref='${OWSUB_VERSION}'\"/g' Chart.yaml fi helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update @@ -139,10 +145,10 @@ for EXTRA_VALUE in ${EXTRA_VALUES_SPLITTED[*]}; do done if [[ "$USE_SEPARATE_OWGW_LB" == "true" ]]; then - export HAPROXY_SERVICE_DNS_RECORDS="sec-${NAMESPACE}.cicd.lab.wlan.tip.build\,fms-${NAMESPACE}.cicd.lab.wlan.tip.build\,prov-${NAMESPACE}.cicd.lab.wlan.tip.build\,rtty-${NAMESPACE}.cicd.lab.wlan.tip.build" + export HAPROXY_SERVICE_DNS_RECORDS="sec-${NAMESPACE}.cicd.lab.wlan.tip.build\,fms-${NAMESPACE}.cicd.lab.wlan.tip.build\,prov-${NAMESPACE}.cicd.lab.wlan.tip.build\,analytics-${NAMESPACE}.cicd.lab.wlan.tip.build\,sub-${NAMESPACE}.cicd.lab.wlan.tip.build" export OWGW_SERVICE_DNS_RECORDS="gw-${NAMESPACE}.cicd.lab.wlan.tip.build" else - export HAPROXY_SERVICE_DNS_RECORDS="gw-${NAMESPACE}.cicd.lab.wlan.tip.build\,sec-${NAMESPACE}.cicd.lab.wlan.tip.build\,fms-${NAMESPACE}.cicd.lab.wlan.tip.build\,prov-${NAMESPACE}.cicd.lab.wlan.tip.build\,rtty-${NAMESPACE}.cicd.lab.wlan.tip.build" + export HAPROXY_SERVICE_DNS_RECORDS="gw-${NAMESPACE}.cicd.lab.wlan.tip.build\,sec-${NAMESPACE}.cicd.lab.wlan.tip.build\,fms-${NAMESPACE}.cicd.lab.wlan.tip.build\,prov-${NAMESPACE}.cicd.lab.wlan.tip.build\,analytics-${NAMESPACE}.cicd.lab.wlan.tip.build\,sub-${NAMESPACE}.cicd.lab.wlan.tip.build" export OWGW_SERVICE_DNS_RECORDS="" fi @@ -152,11 +158,10 @@ helm upgrade --install --create-namespace --wait --timeout 60m \ ${VALUES_FILES_FLAGS[*]} \ --set owgw.services.owgw.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=gw-${NAMESPACE}.cicd.lab.wlan.tip.build \ --set owgw.configProperties."openwifi\.fileuploader\.host\.0\.name"=gw-${NAMESPACE}.cicd.lab.wlan.tip.build \ - --set owgw.configProperties."rtty\.server"=rtty-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owgw.configProperties."rtty\.server"=gw-${NAMESPACE}.cicd.lab.wlan.tip.build \ --set owgw.configProperties."openwifi\.system\.uri\.public"=https://gw-${NAMESPACE}.cicd.lab.wlan.tip.build:16002 \ --set owgw.configProperties."openwifi\.system\.uri\.private"=https://owgw-owgw:17002 \ --set owgw.configProperties."openwifi\.system\.uri\.ui"=https://webui-${NAMESPACE}.cicd.lab.wlan.tip.build \ - --set owgw.configProperties."rtty\.token"=${RTTY_TOKEN} \ --set owgw.public_env_variables.OWSEC=sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ --set owsec.configProperties."authentication\.default\.username"=${OWGW_AUTH_USERNAME} \ --set owsec.configProperties."authentication\.default\.password"=${OWGW_AUTH_PASSWORD} \ @@ -182,8 +187,17 @@ helm upgrade --install --create-namespace --wait --timeout 60m \ --set owprovui.ingresses.default.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=provui-${NAMESPACE}.cicd.lab.wlan.tip.build \ --set owprovui.ingresses.default.hosts={provui-${NAMESPACE}.cicd.lab.wlan.tip.build} \ --set owprovui.public_env_variables.DEFAULT_UCENTRALSEC_URL=https://sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ - --set rttys.config.token=${RTTY_TOKEN} \ - --set rttys.services.rttys.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=rtty-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owprovui.public_env_variables.REACT_APP_UCENTRALSEC_URL=https://sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ + --set owanalytics.services.owanalytics.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=analytics-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owanalytics.configProperties."openwifi\.system\.uri\.public"=https://analytics-${NAMESPACE}.cicd.lab.wlan.tip.build:16009 \ + --set owanalytics.configProperties."openwifi\.system\.uri\.private"=https://owanalytics-owanalytics:17009 \ + --set owanalytics.configProperties."openwifi\.system\.uri\.ui"=https://webui-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owanalytics.public_env_variables.OWSEC=sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ + --set owsub.services.owsub.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=sub-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owsub.configProperties."openwifi\.system\.uri\.public"=https://sub-${NAMESPACE}.cicd.lab.wlan.tip.build:16006 \ + --set owsub.configProperties."openwifi\.system\.uri\.private"=https://owsub-owsub:17006 \ + --set owsub.configProperties."openwifi\.system\.uri\.ui"=https://webui-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set owsub.public_env_variables.OWSEC=sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ --set clustersysteminfo.public_env_variables.OWSEC=sec-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ --set clustersysteminfo.secret_env_variables.OWSEC_NEW_PASSWORD=${OWSEC_NEW_PASSWORD} \ --set owls.services.owls.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=ls-${NAMESPACE}.cicd.lab.wlan.tip.build \ @@ -200,8 +214,6 @@ helm upgrade --install --create-namespace --wait --timeout 60m \ --set-file owgw.certs."restapi-key\.pem"=$KEY_LOCATION \ --set-file owgw.certs."websocket-cert\.pem"=$CERT_LOCATION \ --set-file owgw.certs."websocket-key\.pem"=$KEY_LOCATION \ - --set-file rttys.certs."restapi-cert\.pem"=$CERT_LOCATION \ - --set-file rttys.certs."restapi-key\.pem"=$KEY_LOCATION \ --set-file owsec.certs."restapi-cert\.pem"=$CERT_LOCATION \ --set-file owsec.certs."restapi-key\.pem"=$KEY_LOCATION \ --set-file owfms.certs."restapi-cert\.pem"=$CERT_LOCATION \ @@ -212,4 +224,8 @@ helm upgrade --install --create-namespace --wait --timeout 60m \ --set-file owls.certs."restapi-key\.pem"=$KEY_LOCATION \ --set-file owls.certs."device-cert\.pem"=$DEVICE_CERT_LOCATION \ --set-file owls.certs."device-key\.pem"=$DEVICE_KEY_LOCATION \ + --set-file owanalytics.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file owanalytics.certs."restapi-key\.pem"=$KEY_LOCATION \ + --set-file owsub.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file owsub.certs."restapi-key\.pem"=$KEY_LOCATION \ tip-openwifi $DEPLOY_SOURCE diff --git a/helm/ucentral/values.ucentral-qa.separate-lbs.yaml b/helm/ucentral/values.ucentral-qa.separate-lbs.yaml index cebf51ca407..bb0133fbe8f 100644 --- a/helm/ucentral/values.ucentral-qa.separate-lbs.yaml +++ b/helm/ucentral/values.ucentral-qa.separate-lbs.yaml @@ -8,7 +8,7 @@ owgw: service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "16102" service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" - service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,17002" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16002,16003,17002,5912,5913" owsec: services: @@ -22,18 +22,6 @@ owsec: service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16001,17001" -rttys: - services: - rttys: - type: LoadBalancer - annotations: - service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip" - service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing - service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "5914" - service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl - service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" - service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "5912,5913" - owfms: services: owfms: @@ -58,5 +46,29 @@ owprov: service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16005,17005" +owanalytics: + services: + owanalytics: + type: LoadBalancer + annotations: + service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip" + service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing + service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "16109" + service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl + service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16009,17009" + +owsub: + services: + owsub: + type: LoadBalancer + annotations: + service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip" + service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing + service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "16106" + service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl + service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16006,17006" + haproxy: enabled: false diff --git a/helm/ucentral/values.ucentral-qa.test-nodes.yaml b/helm/ucentral/values.ucentral-qa.test-nodes.yaml index ccacd53456a..f5eb0622646 100644 --- a/helm/ucentral/values.ucentral-qa.test-nodes.yaml +++ b/helm/ucentral/values.ucentral-qa.test-nodes.yaml @@ -94,7 +94,7 @@ owlsui: operator: "Exists" effect: "NoSchedule" -rttys: +owanalytics: nodeSelector: env: tests tolerations: diff --git a/helm/ucentral/values.ucentral-qa.yaml b/helm/ucentral/values.ucentral-qa.yaml index 38889c14198..eec7d968f72 100644 --- a/helm/ucentral/values.ucentral-qa.yaml +++ b/helm/ucentral/values.ucentral-qa.yaml @@ -189,18 +189,6 @@ owsec: secret: secretName: {{ include "owsec.fullname" . }}-owsec-restapi-tls -rttys: - resources: - requests: - cpu: 10m - memory: 15Mi - limits: - cpu: 100m - memory: 100Mi - - podAnnotations: - cluster-autoscaler.kubernetes.io/safe-to-evict: "false" - owgwui: ingresses: default: @@ -321,7 +309,7 @@ owprov: readiness: exec: command: ["true"] - + resources: requests: cpu: 10m @@ -420,6 +408,173 @@ owprovui: podAnnotations: cluster-autoscaler.kubernetes.io/safe-to-evict: "false" +owanalytics: + checks: + owanalytics: + readiness: + exec: + command: ["true"] + + resources: + requests: + cpu: 10m + memory: 100Mi + limits: + cpu: 100m + memory: 500Mi + + podAnnotations: + cluster-autoscaler.kubernetes.io/safe-to-evict: "false" + + certs: + restapi-ca.pem: | + -----BEGIN CERTIFICATE----- + MIIDojCCAoqgAwIBAgIUPVYBpqNbcLYygF6Mx+qxSWwQyFowDQYJKoZIhvcNAQEL + BQAwaTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj + dCwgSW5jLjEMMAoGA1UECxMDVElQMSYwJAYDVQQDEx1UZWxlY29tIEluZnJhIFBy + b2plY3QgUm9vdCBDQTAeFw0yMTA0MTMyMjQyNDRaFw0zMTA0MTMyMjM4NDZaMGkx + CzAJBgNVBAYTAlVTMSQwIgYDVQQKExtUZWxlY29tIEluZnJhIFByb2plY3QsIElu + Yy4xDDAKBgNVBAsTA1RJUDEmMCQGA1UEAxMdVGVsZWNvbSBJbmZyYSBQcm9qZWN0 + IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIGCibwf5u + AAwZ+1H8U0e3u2V+0d2gSctucoK86XwUmfe1V2a/qlCYZd29r80IuN1IIeB0naIm + KnK/MzXW87clF6tFd1+HzEvmlY/W4KyIXalVCTEzirFSvBEG2oZpM0yC3AefytAO + aOpA00LaM3xTfTqMKIRhJBuLy0I4ANUVG6ixVebbGuc78IodleqiLoWy2Q9QHyEO + t/7hZndJhiVogh0PveRhho45EbsACu7ymDY+JhlIleevqwlE3iQoq0YcmYADHno6 + Eq8vcwLpZFxihupUafkd1T3WJYQAJf9coCjBu2qIhNgrcrGD8R9fGswwNRzMRMpX + 720+GjcDW3bJAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFAJG + lmB5sVP2qfL3xZ8hQOTpkQH6MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF + AAOCAQEAVjl9dm4epG9NUYnagT9sg7scVQEPfz3Lt6w1NXJXgD8mAUlK0jXmEyvM + dCPD4514n+8+lM7US8fh+nxc7jO//LwK17Wm9FblgjNFR7+anv0Q99T9fP19DLlF + PSNHL2emogy1bl1lLTAoj8nxg2wVKPDSHBGviQ5LR9fsWUIJDv9Bs5k0qWugWYSj + 19S6qnHeskRDB8MqRLhKMG82oDVLerSnhD0P6HjySBHgTTU7/tYS/OZr1jI6MPbG + L+/DtiR5fDVMNdBSGU89UNTi0wHY9+RFuNlIuvZC+x/swF0V9R5mN+ywquTPtDLA + 5IOM7ItsRmen6u3qu+JXros54e4juQ== + -----END CERTIFICATE----- + + public_env_variables: + SELFSIGNED_CERTS: "true" + + configProperties: + openwifi.internal.restapi.host.0.rootca: $OWANALYTICS_ROOT/certs/restapi-certs/ca.crt + openwifi.internal.restapi.host.0.cert: $OWANALYTICS_ROOT/certs/restapi-certs/tls.crt + openwifi.internal.restapi.host.0.key: $OWANALYTICS_ROOT/certs/restapi-certs/tls.key + openwifi.restapi.host.0.rootca: $OWANALYTICS_ROOT/certs/restapi-certs/ca.crt + openwifi.restapi.host.0.cert: $OWANALYTICS_ROOT/certs/restapi-certs/tls.crt + openwifi.restapi.host.0.key: $OWANALYTICS_ROOT/certs/restapi-certs/tls.key + + volumes: + owanalytics: + - name: config + mountPath: /owanalytics-data/owanalytics.properties + subPath: owanalytics.properties + # Template below will be rendered in template + volumeDefinition: | + secret: + secretName: {{ include "owanalytics.fullname" . }}-config + - name: certs + mountPath: /owanalytics-data/certs + volumeDefinition: | + secret: + secretName: {{ include "owanalytics.fullname" . }}-certs + - name: persist + mountPath: /owanalytics-data/persist + volumeDefinition: | + persistentVolumeClaim: + claimName: {{ template "owanalytics.fullname" . }}-pvc + + - name: restapi-certs + mountPath: /owanalytics-data/certs/restapi-certs + volumeDefinition: | + secret: + secretName: {{ include "owanalytics.fullname" . }}-owanalytics-restapi-tls + - name: restapi-ca + mountPath: /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem + subPath: ca.crt + volumeDefinition: | + secret: + secretName: {{ include "owanalytics.fullname" . }}-owanalytics-restapi-tls + +owsub: + resources: + requests: + cpu: 10m + memory: 100Mi + limits: + cpu: 100m + memory: 500Mi + + podAnnotations: + cluster-autoscaler.kubernetes.io/safe-to-evict: "false" + + certs: + restapi-ca.pem: | + -----BEGIN CERTIFICATE----- + MIIDojCCAoqgAwIBAgIUPVYBpqNbcLYygF6Mx+qxSWwQyFowDQYJKoZIhvcNAQEL + BQAwaTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj + dCwgSW5jLjEMMAoGA1UECxMDVElQMSYwJAYDVQQDEx1UZWxlY29tIEluZnJhIFBy + b2plY3QgUm9vdCBDQTAeFw0yMTA0MTMyMjQyNDRaFw0zMTA0MTMyMjM4NDZaMGkx + CzAJBgNVBAYTAlVTMSQwIgYDVQQKExtUZWxlY29tIEluZnJhIFByb2plY3QsIElu + Yy4xDDAKBgNVBAsTA1RJUDEmMCQGA1UEAxMdVGVsZWNvbSBJbmZyYSBQcm9qZWN0 + IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIGCibwf5u + AAwZ+1H8U0e3u2V+0d2gSctucoK86XwUmfe1V2a/qlCYZd29r80IuN1IIeB0naIm + KnK/MzXW87clF6tFd1+HzEvmlY/W4KyIXalVCTEzirFSvBEG2oZpM0yC3AefytAO + aOpA00LaM3xTfTqMKIRhJBuLy0I4ANUVG6ixVebbGuc78IodleqiLoWy2Q9QHyEO + t/7hZndJhiVogh0PveRhho45EbsACu7ymDY+JhlIleevqwlE3iQoq0YcmYADHno6 + Eq8vcwLpZFxihupUafkd1T3WJYQAJf9coCjBu2qIhNgrcrGD8R9fGswwNRzMRMpX + 720+GjcDW3bJAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFAJG + lmB5sVP2qfL3xZ8hQOTpkQH6MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF + AAOCAQEAVjl9dm4epG9NUYnagT9sg7scVQEPfz3Lt6w1NXJXgD8mAUlK0jXmEyvM + dCPD4514n+8+lM7US8fh+nxc7jO//LwK17Wm9FblgjNFR7+anv0Q99T9fP19DLlF + PSNHL2emogy1bl1lLTAoj8nxg2wVKPDSHBGviQ5LR9fsWUIJDv9Bs5k0qWugWYSj + 19S6qnHeskRDB8MqRLhKMG82oDVLerSnhD0P6HjySBHgTTU7/tYS/OZr1jI6MPbG + L+/DtiR5fDVMNdBSGU89UNTi0wHY9+RFuNlIuvZC+x/swF0V9R5mN+ywquTPtDLA + 5IOM7ItsRmen6u3qu+JXros54e4juQ== + -----END CERTIFICATE----- + + public_env_variables: + SELFSIGNED_CERTS: "true" + + configProperties: + openwifi.internal.restapi.host.0.rootca: $OWSUB_ROOT/certs/restapi-certs/ca.crt + openwifi.internal.restapi.host.0.cert: $OWSUB_ROOT/certs/restapi-certs/tls.crt + openwifi.internal.restapi.host.0.key: $OWSUB_ROOT/certs/restapi-certs/tls.key + openwifi.restapi.host.0.rootca: $OWSUB_ROOT/certs/restapi-certs/ca.crt + openwifi.restapi.host.0.cert: $OWSUB_ROOT/certs/restapi-certs/tls.crt + openwifi.restapi.host.0.key: $OWSUB_ROOT/certs/restapi-certs/tls.key + + volumes: + owsub: + - name: config + mountPath: /owsub-data/owsub.properties + subPath: owsub.properties + # Template below will be rendered in template + volumeDefinition: | + secret: + secretName: {{ include "owsub.fullname" . }}-config + - name: certs + mountPath: /owsub-data/certs + volumeDefinition: | + secret: + secretName: {{ include "owsub.fullname" . }}-certs + - name: persist + mountPath: /owsub-data/persist + volumeDefinition: | + persistentVolumeClaim: + claimName: {{ template "owsub.fullname" . }}-pvc + + - name: restapi-certs + mountPath: /owsub-data/certs/restapi-certs + volumeDefinition: | + secret: + secretName: {{ include "owsub.fullname" . }}-owsub-restapi-tls + - name: restapi-ca + mountPath: /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem + subPath: ca.crt + volumeDefinition: | + secret: + secretName: {{ include "owsub.fullname" . }}-owsub-restapi-tls + + kafka: commonAnnotations: cluster-autoscaler.kubernetes.io/safe-to-evict: "false" @@ -458,7 +613,7 @@ haproxy: service.beta.kubernetes.io/aws-load-balancer-healthcheck-port: "8080" service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-2:289708231103:certificate/bfa89c7a-5b64-4a8a-bcfe-ffec655b5285 - service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16004,17004,16002,16003,17002,16005,17005,16001,17001,5912,5913" + service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "16004,17004,16002,16003,17002,16005,17005,16001,17001,5912,5913,16009" service.beta.kubernetes.io/aws-load-balancer-type: nlb-ip restapiCerts: diff --git a/libs/controller/controller_2x/controller.py b/libs/controller/controller_2x/controller.py index c80bdfd4950..f2782dc8117 100644 --- a/libs/controller/controller_2x/controller.py +++ b/libs/controller/controller_2x/controller.py @@ -468,7 +468,7 @@ def get_ssid_info(self): ssid_info.append(temp) return ssid_info - def set_radio_config(self, radio_config={}, DFS=False, channel=None, bw=None): + def set_radio_config(self, radio_config={}): base_radio_config_2g = { "band": "2G", "country": "CA", @@ -493,17 +493,9 @@ def set_radio_config(self, radio_config={}, DFS=False, channel=None, bw=None): # for keys in radio_config[band]: # base_radio_config_6g[keys] = radio_config[band][keys] - if DFS: - self.base_profile_config["radios"].append({ - "band": "5G", - "country": "CA", - "channel-mode": "VHT", - "channel-width": bw, - "channel": channel - }) - else: - self.base_profile_config["radios"].append(base_radio_config_2g) - self.base_profile_config["radios"].append(base_radio_config_5g) + + self.base_profile_config["radios"].append(base_radio_config_2g) + self.base_profile_config["radios"].append(base_radio_config_5g) print(self.base_profile_config) self.vlan_section["ssids"] = [] self.vlan_ids = [] diff --git a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_20MHz/test_dfs_20_bridge.py b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_20MHz/test_dfs_20_bridge.py index 36e0486ecb3..4054d394dc2 100644 --- a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_20MHz/test_dfs_20_bridge.py +++ b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_20MHz/test_dfs_20_bridge.py @@ -13,11 +13,16 @@ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 52, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 52 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -38,7 +43,7 @@ def test_dfs_channel_52_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general1["dfs"]["channel"] + channel = setup_params_general1["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -87,11 +92,16 @@ def test_dfs_channel_52_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 100, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 100 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -112,7 +122,7 @@ def test_dfs_channel_100_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general2["dfs"]["channel"] + channel = setup_params_general2["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -161,11 +171,16 @@ def test_dfs_channel_100_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 104, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 104 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -186,7 +201,7 @@ def test_dfs_channel_104_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general3["dfs"]["channel"] + channel = setup_params_general3["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -235,11 +250,16 @@ def test_dfs_channel_104_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 56, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 56 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -260,7 +280,7 @@ def test_dfs_channel_56_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general4["dfs"]["channel"] + channel = setup_params_general4["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -309,11 +329,16 @@ def test_dfs_channel_56_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 60, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 60 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -334,7 +359,7 @@ def test_dfs_channel_60_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general5["dfs"]["channel"] + channel = setup_params_general5["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -383,11 +408,16 @@ def test_dfs_channel_60_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 64, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 64 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -408,7 +438,7 @@ def test_dfs_channel_64_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general6["dfs"]["channel"] + channel = setup_params_general6["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -457,11 +487,16 @@ def test_dfs_channel_64_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 108, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 108 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -482,7 +517,7 @@ def test_dfs_channel_108_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general7["dfs"]["channel"] + channel = setup_params_general7["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -531,11 +566,16 @@ def test_dfs_channel_108_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 112, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 112 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -556,7 +596,7 @@ def test_dfs_channel_112_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general8["dfs"]["channel"] + channel = setup_params_general8["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -679,11 +719,16 @@ def test_dfs_channel_112_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 132, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 132 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -704,7 +749,7 @@ def test_dfs_channel_132_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general10["dfs"]["channel"] + channel = setup_params_general10["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -753,11 +798,16 @@ def test_dfs_channel_132_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 136, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 136 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -778,7 +828,7 @@ def test_dfs_channel_136_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general11["dfs"]["channel"] + channel = setup_params_general11["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -827,11 +877,16 @@ def test_dfs_channel_136_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 140, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 140 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -852,7 +907,7 @@ def test_dfs_channel_140_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general12["dfs"]["channel"] + channel = setup_params_general12["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -901,11 +956,16 @@ def test_dfs_channel_140_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 144, - "channel_bandwidth": 20 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 20, + "channel": 144 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -926,7 +986,7 @@ def test_dfs_channel_144_bw_20(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general13["dfs"]["channel"] + channel = setup_params_general13["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" diff --git a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_40MHz/test_dfs_40_bridge.py b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_40MHz/test_dfs_40_bridge.py index 61d6b3bf516..c5379c80c49 100644 --- a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_40MHz/test_dfs_40_bridge.py +++ b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_40MHz/test_dfs_40_bridge.py @@ -13,11 +13,16 @@ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 52, - "channel_bandwidth": 40 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 40, + "channel": 52 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -38,7 +43,7 @@ def test_dfs_channel_52_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general1["dfs"]["channel"] + channel = setup_params_general1["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -87,11 +92,16 @@ def test_dfs_channel_52_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 100, - "channel_bandwidth": 40 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 40, + "channel": 100 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -112,7 +122,7 @@ def test_dfs_channel_100_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general2["dfs"]["channel"] + channel = setup_params_general2["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -309,11 +319,16 @@ def test_dfs_channel_100_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 60, - "channel_bandwidth": 40 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 40, + "channel": 60 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -334,7 +349,7 @@ def test_dfs_channel_60_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general5["dfs"]["channel"] + channel = setup_params_general5["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -457,11 +472,16 @@ def test_dfs_channel_60_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 108, - "channel_bandwidth": 40 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 40, + "channel": 108 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -482,7 +502,7 @@ def test_dfs_channel_108_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general7["dfs"]["channel"] + channel = setup_params_general7["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -753,11 +773,17 @@ def test_dfs_channel_108_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 132, - "channel_bandwidth": 40 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 40, + "channel": 132 + } + }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -778,7 +804,7 @@ def test_dfs_channel_132_bw_40(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general11["dfs"]["channel"] + channel = setup_params_general11["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" diff --git a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_80MHz/test_dfs_80_bridge.py b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_80MHz/test_dfs_80_bridge.py index 9e3d354267e..fa90244c380 100644 --- a/tests/e2e/basic/dfs_test/wpa2_personal/dfs_80MHz/test_dfs_80_bridge.py +++ b/tests/e2e/basic/dfs_test/wpa2_personal/dfs_80MHz/test_dfs_80_bridge.py @@ -13,11 +13,16 @@ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 52, - "channel_bandwidth": 80 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 80, + "channel": 52 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -38,7 +43,7 @@ def test_dfs_channel_52_bw_80(self, lf_test, lf_tools, station_names_fiveg, dfs_ profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general1["dfs"]["channel"] + channel = setup_params_general1["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -87,11 +92,16 @@ def test_dfs_channel_52_bw_80(self, lf_test, lf_tools, station_names_fiveg, dfs_ {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 100, - "channel_bandwidth": 80 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 80, + "channel": 100 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -112,7 +122,7 @@ def test_dfs_channel_100_bw_80(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general2["dfs"]["channel"] + channel = setup_params_general2["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" @@ -753,11 +763,16 @@ def test_dfs_channel_100_bw_80(self, lf_test, lf_tools, station_names_fiveg, dfs {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} ] }, - "dfs": { - "channel": 132, - "channel_bandwidth": 80 + "rf": { + "5G": { + "band": "5G", + "country": "CA", + "allow-dfs": True, + "channel-mode": "VHT", + "channel-width": 80, + "channel": 132 + } }, - "rf": {}, "radius": False } @pytest.mark.parametrize( @@ -778,7 +793,7 @@ def test_dfs_channel_132_bw_80(self, lf_test, lf_tools, station_names_fiveg, dfs profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security_key = profile_data["security_key"] - channel = setup_params_general11["dfs"]["channel"] + channel = setup_params_general11["rf"]["5G"]["channel"] security = "wpa2" band = "fiveg" mode = "BRIDGE" diff --git a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_tls.py b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_tls.py index 2290f4a7ac2..c8684c0b632 100644 --- a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_tls.py +++ b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_tls.py @@ -37,7 +37,7 @@ class TestBridgeModeEnterpriseTLSSuiteA(object): @pytest.mark.wpa_enterprise @pytest.mark.twog - def test_tls_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -66,7 +66,7 @@ def test_tls_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa_enterprise @pytest.mark.fiveg - def test_tls_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -96,7 +96,7 @@ def test_tls_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_enterprise @pytest.mark.twog - def test_tls_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa2_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -124,7 +124,7 @@ def test_tls_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_enterprise @pytest.mark.fiveg - def test_tls_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -154,7 +154,7 @@ def test_tls_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.twog @pytest.mark.shivam - def test_tls_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa3_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -182,7 +182,7 @@ def test_tls_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.fiveg - def test_tls_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa3_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -242,7 +242,7 @@ class TestBridgeModeEnterpriseTLSSuiteTwo(object): @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.twog - def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -258,9 +258,6 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -270,7 +267,7 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.fiveg - def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -286,9 +283,6 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -298,7 +292,7 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.twog - def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -313,9 +307,6 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -325,7 +316,7 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.fiveg - def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -341,9 +332,6 @@ def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, diff --git a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py index 078f141ea15..2272a10ee34 100644 --- a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py +++ b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py @@ -50,7 +50,7 @@ class TestBridgeModeConnectivitySuiteA(object): @pytest.mark.twog @pytest.mark.hari @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2809", name="JIRA LINK") - def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, lf_test, + def test_open_ssid_2g(self, get_ap_logs, get_lf_logs, lf_test, update_report, station_names_twog, test_cases): @@ -64,10 +64,6 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, lf_test, mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -77,7 +73,7 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, lf_test, @pytest.mark.open @pytest.mark.fiveg @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK") - def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, station_names_fiveg, get_lf_logs, + def test_open_ssid_5g(self, get_ap_logs, lf_test, test_cases, station_names_fiveg, get_lf_logs, update_report): """Client Connectivity open ssid 5G pytest -m "client_connectivity and bridge and general and open and fiveg" @@ -89,10 +85,6 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, st mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -104,7 +96,7 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, st @pytest.mark.twog @allure.story('wpa 2.4 GHZ Band') @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK") - def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs, + def test_wpa_ssid_2g(self, get_ap_logs, update_report, get_lf_logs, lf_test, test_cases, station_names_twog): """Client Connectivity wpa ssid 2.4G pytest -m "client_connectivity and bridge and general and wpa and twog" @@ -116,10 +108,6 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_log mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -130,7 +118,7 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_log @pytest.mark.wpa @pytest.mark.fiveg @allure.story('wpa 5 GHZ Band') - def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, get_lf_logs, + def test_wpa_ssid_5g(self, get_ap_logs, lf_test, update_report, get_lf_logs, test_cases, station_names_fiveg): """Client Connectivity wpa ssid 5G pytest -m "client_connectivity and bridge and general and wpa and fiveg" @@ -142,10 +130,6 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, g mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -156,7 +140,7 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, g @pytest.mark.wpa2_personal @pytest.mark.twog @allure.story('wpa2_personal 2.4 GHZ Band') - def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa2_personal_ssid_2g(self, get_ap_logs, get_lf_logs, lf_test, update_report, test_cases, station_names_twog): """Client Connectivity wpa2_personal ssid 2.4G @@ -169,10 +153,6 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -183,7 +163,7 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_personal @pytest.mark.fiveg @allure.story('wpa2_personal 5 GHZ Band') - def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, update_report, test_cases, + def test_wpa2_personal_ssid_5g(self, get_ap_logs, update_report, test_cases, station_names_fiveg, get_lf_logs, lf_test): """Client Connectivity wpa2_personal ssid 5G @@ -196,10 +176,6 @@ def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, update_report, mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -247,7 +223,7 @@ class TestBridgeModeConnectivitySuiteTwo(object): @pytest.mark.wpa3_personal @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, lf_test, + def test_wpa3_personal_ssid_2g(self, get_ap_logs, station_names_twog, lf_test, update_report, test_cases): """Client Connectivity open ssid 2.4G @@ -260,10 +236,6 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_t mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -273,7 +245,7 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_t @pytest.mark.wpa3_personal @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, + def test_wpa3_personal_ssid_5g(self, get_ap_logs, station_names_fiveg, lf_test, test_cases, get_lf_logs, update_report): """Client Connectivity open ssid 2.4G @@ -286,10 +258,6 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_f mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -299,7 +267,7 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_f @pytest.mark.wpa3_personal_mixed @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, + def test_wpa3_personal_mixed_ssid_2g(self, get_ap_logs, station_names_twog, lf_test, get_lf_logs, update_report, test_cases): @@ -313,10 +281,6 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, station_n mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -326,7 +290,7 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, station_n @pytest.mark.wpa3_personal_mixed @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test, + def test_wpa3_personal_mixed_ssid_5g(self, get_ap_logs, station_names_fiveg, lf_test, test_cases, get_lf_logs, update_report): """Client Connectivity open ssid 2.4G @@ -339,10 +303,6 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, station_n mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -352,7 +312,7 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, station_n @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.twog @allure.story('wpa wpa2 personal mixed 2.4 GHZ Band') - def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, + def test_wpa_wpa2_personal_ssid_2g(self, get_ap_logs, station_names_twog, lf_test, get_lf_logs, update_report, test_cases): @@ -367,10 +327,6 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_nam mode = "BRIDGE" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -380,7 +336,7 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_nam @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.fiveg @allure.story('wpa wpa2 personal mixed 5 GHZ Band') - def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, get_lf_logs, + def test_wpa_wpa2_personal_ssid_5g(self, get_ap_logs, station_names_fiveg, get_lf_logs, lf_test, test_cases, update_report): """Client Connectivity open ssid 2.4G @@ -394,10 +350,6 @@ def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_nam mode = "BRIDGE" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) diff --git a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_tls.py b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_tls.py index cb793754974..7890dfa4fe2 100644 --- a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_tls.py +++ b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_tls.py @@ -34,7 +34,7 @@ class TestNATModeEnterpriseTLSSuiteOne(object): @pytest.mark.wpa_enterprise @pytest.mark.twog - def test_tls_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -63,7 +63,7 @@ def test_tls_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa_enterprise @pytest.mark.fiveg - def test_tls_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -105,7 +105,7 @@ def test_tls_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_enterprise @pytest.mark.twog - def test_tls_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa2_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -133,7 +133,7 @@ def test_tls_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_enterprise @pytest.mark.fiveg - def test_tls_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -174,7 +174,7 @@ def test_tls_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.twog - def test_tls_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa3_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -202,7 +202,7 @@ def test_tls_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.fiveg - def test_tls_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_tls_wpa3_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa3 enterprise 5g @@ -263,7 +263,7 @@ class TestNATModeEnterpriseTLSSuiteTwo(object): @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.twog - def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -279,9 +279,6 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -291,7 +288,7 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.fiveg - def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -307,9 +304,6 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -319,7 +313,7 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.twog - def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): """ wpa enterprise 2g @@ -334,9 +328,6 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, @@ -346,7 +337,7 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.fiveg - def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -362,9 +353,6 @@ def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, tls_passwd = radius_info["password"] eap = "TLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=tls_passwd, identity=identity, diff --git a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py index 62dfab45fe3..63203079e35 100644 --- a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py +++ b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py @@ -121,7 +121,7 @@ def test_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.twog - def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0] @@ -133,9 +133,6 @@ def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, ieee80211w=2, key_mgmt="WPA-EAP-SHA256", eap=eap, ttls_passwd=ttls_passwd, identity=identity, @@ -145,7 +142,7 @@ def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise @pytest.mark.fiveg - def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_5g(self, station_names_fiveg, get_ap_logs, get_lf_logs, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1] @@ -157,9 +154,6 @@ def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, ieee80211w=2, key_mgmt="WPA-EAP-SHA256", eap=eap, ttls_passwd=ttls_passwd, identity=identity, @@ -195,7 +189,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object): @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.twog - def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0] @@ -208,9 +202,6 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=ttls_passwd, identity=identity, @@ -220,7 +211,7 @@ def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.fiveg - def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_enterprise_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1] @@ -233,9 +224,6 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, extra_securities=extra_secu, mode=mode, band=band, eap=eap, ttls_passwd=ttls_passwd, identity=identity, @@ -245,7 +233,7 @@ def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.twog - def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0] @@ -257,9 +245,6 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=ttls_passwd, identity=identity, @@ -269,7 +254,7 @@ def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_enterprise_mixed @pytest.mark.fiveg - def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_enterprise_mixed_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, setup_profiles, lf_test, update_report, exit_on_fail, test_cases, radius_info): @@ -282,9 +267,6 @@ def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs, ttls_passwd = radius_info["password"] eap = "TTLS" identity = radius_info['user'] - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes = lf_test.EAP_Connect(ssid=ssid_name, security=security, mode=mode, band=band, eap=eap, ttls_passwd=ttls_passwd, identity=identity, diff --git a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_general_security_modes.py b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_general_security_modes.py index 311411d1d64..31f97b48958 100644 --- a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_general_security_modes.py +++ b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_general_security_modes.py @@ -48,7 +48,7 @@ class TestNATModeConnectivitySuiteA(object): @pytest.mark.open @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_open_ssid_2g(self, get_ap_logs, get_lf_logs, setup_profiles, lf_test, update_report, station_names_twog, test_cases): @@ -64,10 +64,6 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -77,7 +73,7 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.open @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_open_ssid_5g(self, get_ap_logs, get_lf_logs, lf_test, test_cases, station_names_fiveg, update_report): """Client Connectivity open ssid 5G @@ -90,10 +86,6 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -104,7 +96,7 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa @pytest.mark.twog @allure.story('wpa 2.4 GHZ Band') - def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs, + def test_wpa_ssid_2g(self, get_ap_logs, update_report, get_lf_logs, lf_test, test_cases, station_names_twog): """Client Connectivity wpa ssid 2.4G pytest -m "client_connectivity and NAT and general and wpa and twog" @@ -116,10 +108,6 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_lo mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -129,7 +117,7 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_lo @pytest.mark.wpa @pytest.mark.fiveg @allure.story('wpa 5 GHZ Band') - def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_ssid_5g(self, get_ap_logs, get_lf_logs, lf_test, update_report, test_cases, station_names_fiveg): """Client Connectivity wpa ssid 5G pytest -m "client_connectivity and NAT and general and wpa and fiveg" @@ -141,10 +129,6 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -155,7 +139,7 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_personal @pytest.mark.twog @allure.story('wpa2_personal 2.4 GHZ Band') - def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa2_personal_ssid_2g(self, get_ap_logs, get_lf_logs, lf_test, update_report, test_cases, station_names_twog): """Client Connectivity wpa2_personal ssid 2.4G @@ -168,10 +152,6 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -182,7 +162,7 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_personal @pytest.mark.fiveg @allure.story('wpa2_personal 5 GHZ Band') - def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa2_personal_ssid_5g(self, get_ap_logs, get_lf_logs, update_report, test_cases, station_names_fiveg, lf_test): @@ -196,10 +176,6 @@ def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -245,7 +221,7 @@ class TestNATModeConnectivitySuiteB(object): @pytest.mark.wpa3_personal @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_personal_ssid_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases): @@ -259,10 +235,6 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -272,7 +244,7 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_personal @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_personal_ssid_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, lf_test, test_cases, update_report): """Client Connectivity open ssid 2.4G @@ -285,10 +257,6 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -298,7 +266,7 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_personal_mixed @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, + def test_wpa3_personal_mixed_ssid_2g(self, get_ap_logs, station_names_twog, setup_profiles, lf_test, get_lf_logs, update_report, @@ -313,10 +281,6 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -326,7 +290,7 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, @pytest.mark.wpa3_personal_mixed @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_personal_mixed_ssid_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, lf_test, test_cases, update_report): @@ -340,10 +304,6 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_lo mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -353,7 +313,7 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_lo @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.twog @allure.story('wpa wpa2 personal mixed 2.4 GHZ Band') - def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_personal_ssid_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, @@ -369,10 +329,6 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs mode = "NAT" band = "twog" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -382,7 +338,7 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.fiveg @allure.story('wpa wpa2 personal mixed 5 GHZ Band') - def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_personal_ssid_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, lf_test, test_cases, update_report): """Client Connectivity open ssid 2.4G @@ -396,10 +352,6 @@ def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs mode = "NAT" band = "fiveg" vlan = 1 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) diff --git a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_general_security_modes.py b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_general_security_modes.py index 097703e2049..656f904335c 100644 --- a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_general_security_modes.py +++ b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_general_security_modes.py @@ -46,7 +46,7 @@ class TestvlanModeConnectivitySuiteA(object): @pytest.mark.open @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_open_ssid_2g(self, get_ap_logs, get_lf_logs, setup_profiles, lf_test, update_report, station_names_twog, test_cases): @@ -60,10 +60,6 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -72,7 +68,7 @@ def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.open @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_open_ssid_5g(self, get_ap_logs, get_lf_logs, lf_test, test_cases, station_names_fiveg, update_report): """Client Connectivity open ssid 5G @@ -85,10 +81,6 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -99,7 +91,7 @@ def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa @pytest.mark.twog @allure.story('wpa 2.4 GHZ Band') - def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, + def test_wpa_ssid_2g(self, get_ap_logs, update_report, get_lf_logs, lf_test, test_cases, station_names_twog): """Client Connectivity wpa ssid 2.4G @@ -112,10 +104,6 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -126,7 +114,7 @@ def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, @pytest.mark.wpa @pytest.mark.fiveg @allure.story('wpa 5 GHZ Band') - def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_ssid_5g(self, get_ap_logs, get_lf_logs, lf_test, update_report, test_cases, station_names_fiveg): """Client Connectivity wpa ssid 5G pytest -m "client_connectivity and vlan and general and wpa and fiveg" @@ -138,10 +126,6 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -152,7 +136,7 @@ def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_personal @pytest.mark.twog @allure.story('wpa2_personal 2.4 GHZ Band') - def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa2_personal_ssid_2g(self, get_ap_logs, get_lf_logs, lf_test, update_report, test_cases, station_names_twog): """Client Connectivity wpa2_personal ssid 2.4G @@ -165,10 +149,6 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -179,7 +159,7 @@ def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa2_personal @pytest.mark.fiveg @allure.story('wpa2_personal 5 GHZ Band') - def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa2_personal_ssid_5g(self, get_ap_logs, get_lf_logs, update_report, test_cases, station_names_fiveg, lf_test): @@ -193,10 +173,6 @@ def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -243,7 +219,7 @@ class TestvlanModeConnectivitySuiteTwo(object): @pytest.mark.wpa3_personal @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_personal_ssid_2g(self, get_ap_logs, get_lf_logs, station_names_twog, setup_profiles, lf_test, update_report, test_cases): @@ -257,10 +233,6 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -271,7 +243,7 @@ def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_personal @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa3_personal_ssid_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, lf_test, test_cases, update_report): """Client Connectivity open ssid 2.4G @@ -284,10 +256,6 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -297,7 +265,7 @@ def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, @pytest.mark.wpa3_personal_mixed @pytest.mark.twog @allure.story('open 2.4 GHZ Band') - def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, + def test_wpa3_personal_mixed_ssid_2g(self, get_ap_logs, station_names_twog, setup_profiles, lf_test, get_lf_logs, update_report, @@ -312,10 +280,6 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -325,7 +289,7 @@ def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, @pytest.mark.wpa3_personal_mixed @pytest.mark.fiveg @allure.story('open 5 GHZ Band') - def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, + def test_wpa3_personal_mixed_ssid_5g(self, get_ap_logs, station_names_fiveg, lf_test, test_cases, get_lf_logs, update_report): @@ -339,10 +303,6 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) @@ -352,7 +312,7 @@ def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.twog @allure.story('wpa wpa2 personal mixed 2.4 GHZ Band') - def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, + def test_wpa_wpa2_personal_ssid_2g(self, get_ap_logs, station_names_twog, setup_profiles, lf_test, get_lf_logs, update_report, @@ -368,10 +328,6 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, mode = "VLAN" band = "twog" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_twog, vlan_id=vlan) @@ -381,7 +337,7 @@ def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, @pytest.mark.wpa_wpa2_personal_mixed @pytest.mark.fiveg @allure.story('wpa wpa2 personal mixed 5 GHZ Band') - def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs, + def test_wpa_wpa2_personal_ssid_5g(self, get_ap_logs, get_lf_logs, station_names_fiveg, lf_test, test_cases, update_report): """Client Connectivity open ssid 2.4G @@ -395,10 +351,6 @@ def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs mode = "VLAN" band = "fiveg" vlan = 100 - get_vif_state.append(ssid_name) - if ssid_name not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") passes, result = lf_test.Client_Connectivity(ssid=ssid_name, security=security, extra_securities=extra_secu, passkey=security_key, mode=mode, band=band, station_name=station_names_fiveg, vlan_id=vlan) diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py index 5af4d603a7a..865e8b34739 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py @@ -556,3 +556,86 @@ def test_ClientConnect_2g_wpa_wpa2_personal_mixed_Bridge(self, request, get_vif_ else: allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) assert False + + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'Us', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +# @allure.suite(suite_name="interop country code") +# @allure.sub_suite(sub_suite_name="Bridge Mode country code") +# @pytest.mark.InteropsuiteA +# @allure.feature("BRIDGE MODE CLIENT CONNECT") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne + """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.fiction + def test_ClientConnect_bridge_wpa2_chn36_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + diff --git a/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/android/test_general_security_modes.py b/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/android/test_general_security_modes.py index b0afb5f77e3..a99566b0638 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/android/test_general_security_modes.py +++ b/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/android/test_general_security_modes.py @@ -288,16 +288,16 @@ def test_ClientConnect_2g_Open_Vlan(self, request, get_vif_state, get_ap_logs, g "mode": "VLAN", "ssid_modes": { "wpa3_personal": [ - {"ssid_name": "ssid_wpa3_p_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa3_p_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa3_p_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa3_p_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}], "wpa3_personal_mixed": [ - {"ssid_name": "ssid_wpa3_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa3_p_m_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa3_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa3_p_m_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}], "wpa_wpa2_personal_mixed": [ - {"ssid_name": "ssid_wpa_wpa2_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa_wpa2_p_m_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa_wpa2_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa_wpa2_p_m_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}] }, "rf": {}, diff --git a/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/iOS/test_general_security_mode.py b/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/iOS/test_general_security_mode.py index ceeb97b86d9..b79b8c027cb 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/iOS/test_general_security_mode.py +++ b/tests/e2e/interOp/validation_of_operating_modes/vlan_mode/client_connect_test/iOS/test_general_security_mode.py @@ -284,16 +284,16 @@ def test_ClientConnect_2g_Open_VLAN(self, request, get_vif_state, get_ap_logs, g "mode": "VLAN", "ssid_modes": { "wpa3_personal": [ - {"ssid_name": "ssid_wpa3_p_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa3_p_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa3_p_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa3_p_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}], "wpa3_personal_mixed": [ - {"ssid_name": "ssid_wpa3_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa3_p_m_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa3_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa3_p_m_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}], "wpa_wpa2_personal_mixed": [ - {"ssid_name": "ssid_wpa_wpa2_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, - {"ssid_name": "ssid_wpa_wpa2_p_m_5g_vlan", "appliedRadios": ["5G"], + {"ssid_name": "wpa_wpa2_p_m_2g_vlan", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100}, + {"ssid_name": "wpa_wpa2_p_m_5g_vlan", "appliedRadios": ["5G"], "security_key": "something", "vlan": 100}] }, "rf": {}, diff --git a/tests/fixtures_2x.py b/tests/fixtures_2x.py index 0e9d3aa022c..93da5350cf1 100644 --- a/tests/fixtures_2x.py +++ b/tests/fixtures_2x.py @@ -380,11 +380,6 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen test_cases = {} profile_data = {} var = "" - list_key = list(parameter.keys()) - - if "dfs" in list_key: - print("In dfs") - instantiate_profile_obj.set_radio_config(DFS=True, channel=parameter["dfs"]["channel"], bw=parameter["dfs"]["channel_bandwidth"]) if len(parameter['rf']) > 0: print("Country code channel division") instantiate_profile_obj.set_radio_config(radio_config=parameter['rf']) @@ -758,8 +753,7 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen else: print("AP is Not Broadcasting Applied Config") allure.attach(name="Failed to Apply Config : Active Config in AP : ", body=str(ap_config_active)) - time.sleep(10) - + time.sleep(50) try: iwinfo = ap_ssh.iwinfo() allure.attach(name="iwinfo: ", body=str(iwinfo)) From 0112ce88f957574015cbb7806330aed6191b83a5 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Sun, 24 Apr 2022 17:26:57 +0530 Subject: [PATCH 03/25] Removed unwanted code Signed-off-by: Jyothsna-setti --- .../test_general_security_modes.py | 1 - .../iOS/test_general_security_modes.py | 81 ------------------- 2 files changed, 82 deletions(-) diff --git a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py index 2272a10ee34..7681ba0e442 100644 --- a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py +++ b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_general_security_modes.py @@ -48,7 +48,6 @@ class TestBridgeModeConnectivitySuiteA(object): @pytest.mark.open @pytest.mark.twog - @pytest.mark.hari @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2809", name="JIRA LINK") def test_open_ssid_2g(self, get_ap_logs, get_lf_logs, lf_test, update_report, diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py index 865e8b34739..aa9ea09e141 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py @@ -558,84 +558,3 @@ def test_ClientConnect_2g_wpa_wpa2_personal_mixed_Bridge(self, request, get_vif_ assert False -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'Us', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -# @allure.suite(suite_name="interop country code") -# @allure.sub_suite(sub_suite_name="Bridge Mode country code") -# @pytest.mark.InteropsuiteA -# @allure.feature("BRIDGE MODE CLIENT CONNECT") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - """ Client Connect SuiteOne - """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.fiction - def test_ClientConnect_bridge_wpa2_chn36_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - From bcec9cc0d5e29466859aca392b3281595add7909 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Sun, 24 Apr 2022 20:51:21 +0530 Subject: [PATCH 04/25] Removed unwanted markers and made some changes in country code SG(android) Signed-off-by: Jyothsna-setti --- .../channel_code_SG/android/test_SG_20mhz.py | 1710 +++++++++++++++++ .../channel_code_SG/android/test_SG_40mhz.py | 1152 +++++++++++ .../channel_code_SG/android/test_SG_80mhz.py | 1019 ++++++++++ 3 files changed, 3881 insertions(+) create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py new file mode 100644 index 00000000000..bfe51613c6c --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py @@ -0,0 +1,1710 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG1 + , pytest.mark.bridge] + +from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn36_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn1_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 40}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn40_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.japan + def test_ClientConnect_bridge_wpa2_chn2_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn44_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn3_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 48}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn48_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn4_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn52_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn5_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn56_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn6_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn60_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn7_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn64_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn8_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn100_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn9_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn104_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn10_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn108_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn11_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general12 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 112}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general12['ssid_modes'].keys(): + for i in range(len(setup_params_general12['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general12], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwelve(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn112_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general13 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 116}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general13['ssid_modes'].keys(): + for i in range(len(setup_params_general13['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general13], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThirteen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn116_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general14 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general14['ssid_modes'].keys(): + for i in range(len(setup_params_general14['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general14], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFourteen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn132_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general14["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general15 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 136}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general15['ssid_modes'].keys(): + for i in range(len(setup_params_general15['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general15], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFifteen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn136_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general15["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general16 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general16['ssid_modes'].keys(): + for i in range(len(setup_params_general16['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general16], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSixteen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn140_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general16["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general17 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 144}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general17['ssid_modes'].keys(): + for i in range(len(setup_params_general17['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general17], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeventeen(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn144_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general17["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py new file mode 100644 index 00000000000..ea399918429 --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py @@ -0,0 +1,1152 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG2 + , pytest.mark.bridge] + +from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn36_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn1_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn44_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn2_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn52_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn3_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn60_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn4_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn100_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn5_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn108_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn6_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn132_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn7_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn140_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn8_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn9_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn10_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.plott + def test_ClientConnect_bridge_wpa2_chn11_40Mhz_RU_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py new file mode 100644 index 00000000000..cd99630e80c --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py @@ -0,0 +1,1019 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG3 + , pytest.mark.bridge] + +from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn36_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn1_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn52_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn2_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn100_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn3_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn48_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn4_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn5_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn6_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn7_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn8_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn9_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn10_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'SG', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") + @pytest.mark.twog + @pytest.mark.wpa2_personal + def test_ClientConnect_bridge_wpa2_chn11_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + From 130c33f821168d362a4b01b1ece1b2339dd40268 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 25 Apr 2022 11:37:13 +0530 Subject: [PATCH 05/25] Removed unwanted files Signed-off-by: Jyothsna-setti --- .../channel_code_SG/android/test_SG_20mhz.py | 1710 ----------------- .../channel_code_SG/android/test_SG_40mhz.py | 1152 ----------- .../channel_code_SG/android/test_SG_80mhz.py | 1019 ---------- 3 files changed, 3881 deletions(-) delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py deleted file mode 100644 index bfe51613c6c..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_20mhz.py +++ /dev/null @@ -1,1710 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG1 - , pytest.mark.bridge] - -from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn36_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn1_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 40}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn40_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.japan - def test_ClientConnect_bridge_wpa2_chn2_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 44}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn44_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn3_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 48}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn48_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn4_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general5], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn52_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn5_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 56}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general6], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn56_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn6_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general7], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn60_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn7_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 64}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn64_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn8_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general9], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn100_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn9_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general10], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn104_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn10_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general11], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn108_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7603", name="WIFI-7603") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn11_20Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general12 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 112}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general12['ssid_modes'].keys(): - for i in range(len(setup_params_general12['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general12], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwelve(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn112_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general13 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 116}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general13['ssid_modes'].keys(): - for i in range(len(setup_params_general13['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general13], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThirteen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn116_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general14 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general14['ssid_modes'].keys(): - for i in range(len(setup_params_general14['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general14], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFourteen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn132_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general14["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general15 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 136}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general15['ssid_modes'].keys(): - for i in range(len(setup_params_general15['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general15], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFifteen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn136_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general15["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general16 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 140}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general16['ssid_modes'].keys(): - for i in range(len(setup_params_general16['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general16], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSixteen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn140_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general16["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general17 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 144}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general17['ssid_modes'].keys(): - for i in range(len(setup_params_general17['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general17], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeventeen(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7597", name="WIFI-7597") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn144_20Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general17["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py deleted file mode 100644 index ea399918429..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_40mhz.py +++ /dev/null @@ -1,1152 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG2 - , pytest.mark.bridge] - -from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn36_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn1_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 44}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn44_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn2_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn52_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn3_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn60_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn4_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general5], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn100_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn5_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general6], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn108_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn6_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general7], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn132_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn7_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 140}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7599", name="WIFI-7599") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn140_40Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn8_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general9], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn9_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general10], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn10_40Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general11], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7592", name="WIFI-7592") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.plott - def test_ClientConnect_bridge_wpa2_chn11_40Mhz_RU_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py deleted file mode 100644 index cd99630e80c..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/channel_code_SG/android/test_SG_80mhz.py +++ /dev/null @@ -1,1019 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_codeSG3 - , pytest.mark.bridge] - -from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, get_ip_address_and - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn36_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn1_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn52_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn2_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn100_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn3_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7304", name="WIFI-7304") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn48_80Mhz_SG_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn4_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general5], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn5_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 56}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general6], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn6_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general7], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn7_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 64}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn8_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general9], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn9_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general10], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn10_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'SG', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(SG)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE SG") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general11], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7593", name="WIFI-7593") - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ClientConnect_bridge_wpa2_chn11_80Mhz_SG_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - From 7d39e07b9b7e24d259ad7c35a2fe715fa4c2e05c Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 25 Apr 2022 12:42:45 +0530 Subject: [PATCH 06/25] Removed unnecessary spaces in test_general_security_modes Signed-off-by: Jyothsna-setti --- .../client_connect_test/iOS/test_general_security_modes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py index aa9ea09e141..47903783238 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/iOS/test_general_security_modes.py @@ -555,6 +555,4 @@ def test_ClientConnect_2g_wpa_wpa2_personal_mixed_Bridge(self, request, get_vif_ assert True else: allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - + assert False \ No newline at end of file From 1b9d372462fba33f1764809a9ee764add489a7f4 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 25 Apr 2022 14:56:22 +0530 Subject: [PATCH 07/25] Added a new marker in country code JP(IOS) Signed-off-by: Jyothsna-setti --- .../country_code_JP/iOS/test_JP_20Mhz.py | 1747 +++++++++++++++++ .../country_code_JP/iOS/test_JP_40Mhz.py | 1164 +++++++++++ .../country_code_JP/iOS/test_JP_80Mhz.py | 1030 ++++++++++ 3 files changed, 3941 insertions(+) create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py new file mode 100644 index 00000000000..0947c801366 --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py @@ -0,0 +1,1747 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code + , pytest.mark.bridge] + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'Us', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne + """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn36_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn1_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 40}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo + """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn40_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn2_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn44_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn3_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 48}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn48_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn4_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + """ Client Connect SuiteFive """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn52_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn5_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + """ Client Connect SuiteSix """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn56_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn6_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + """ Client Connect SuiteSeven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn60_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn7_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + """ Client Connect SuiteEight """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn64_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn8_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + """ Client Connect SuiteNine """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn100_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn9_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'USP', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + """ Client Connect SuiteTen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn104_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn10_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + """ Client Connect SuiteEleven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.plot + def test_ClientConnect_bridge_wpa2_chn108_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.plot + def test_ClientConnect_bridge_wpa2_chn11_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general12 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 112}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general12['ssid_modes'].keys(): + for i in range(len(setup_params_general12['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general12], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwelve(object): + """ Client Connect SuiteTwelve """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.subbu + def test_ClientConnect_bridge_wpa2_chn112_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general13 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 116}, + "2G": + {'band': '2G', + 'country': 'USP', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general13['ssid_modes'].keys(): + for i in range(len(setup_params_general13['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general13], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThirteen(object): + """ Client Connect SuiteThirteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.subbu + def test_ClientConnect_bridge_wpa2_chn116_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general14 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'USP', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general14['ssid_modes'].keys(): + for i in range(len(setup_params_general14['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general14], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFourteen(object): + """ Client Connect SuiteFourteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.subbu + def test_ClientConnect_bridge_wpa2_chn132_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general14["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general15 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 136}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general15['ssid_modes'].keys(): + for i in range(len(setup_params_general15['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general15], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFifteen(object): + """ Client Connect SuiteFifteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.subbu + def test_ClientConnect_bridge_wpa2_chn136_20Mhz_USP_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general15["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general16 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general16['ssid_modes'].keys(): + for i in range(len(setup_params_general16['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general16], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSixteen(object): + """ Client Connect SuiteSixteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + @pytest.mark.twenty + def test_ClientConnect_bridge_wpa2_chn140_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general16["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general17 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 144}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general17['ssid_modes'].keys(): + for i in range(len(setup_params_general17['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general17], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeventeen(object): + """ Client Connect SuiteSeventeen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn144_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general17["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py new file mode 100644 index 00000000000..420d475142d --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py @@ -0,0 +1,1164 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code + , pytest.mark.bridge] + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn36_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn1_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'USP', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn44_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn2_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn52_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn3_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn60_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn4_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + """ Client Connect SuiteFuve """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn100_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn5_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + """ Client Connect SuiteSix """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn108_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn6_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + """ Client Connect SuiteSeven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn132_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn7_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + """ Client Connect SuiteEight """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn140_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn8_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + """ Client Connect SuiteEight """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn9_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'USP', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + """ Client Connect SuiteEight """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn10_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + """ Client Connect SuiteEight """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") + @pytest.mark.twog + @pytest.mark.wpa2_personal + def test_ClientConnect_bridge_wpa2_chn11_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py new file mode 100644 index 00000000000..3a32526deec --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py @@ -0,0 +1,1030 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code + , pytest.mark.bridge] + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn36_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn1_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn52_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + def test_ClientConnect_bridge_wpa2_chn2_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn100_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn3_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn48_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn4_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn5_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn6_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn7_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn8_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + @pytest.mark.thirdrun + def test_ClientConnect_bridge_wpa2_chn9_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn10_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn11_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + From 420077cd34f5c65a27f3b713e3cbb9d2d8c35d04 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 25 Apr 2022 14:59:05 +0530 Subject: [PATCH 08/25] removed unnecessary files Signed-off-by: Jyothsna-setti --- .../country_code_JP/iOS/test_JP_20Mhz.py | 1747 ----------------- .../country_code_JP/iOS/test_JP_40Mhz.py | 1164 ----------- .../country_code_JP/iOS/test_JP_80Mhz.py | 1030 ---------- 3 files changed, 3941 deletions(-) delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py delete mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py deleted file mode 100644 index 0947c801366..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_20Mhz.py +++ /dev/null @@ -1,1747 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code - , pytest.mark.bridge] - -from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ - Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ - verifyUploadDownloadSpeediOS, get_ip_address_ios - - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'Us', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - """ Client Connect SuiteOne - """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn36_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn1_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 40}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - """ Client Connect SuiteTwo - """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn40_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn2_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 44}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - """ Client Connect SuiteThree """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn44_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn3_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 48}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - """ Client Connect SuiteFour """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn48_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn4_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general5], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - """ Client Connect SuiteFive """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn52_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn5_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 56}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general6], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - """ Client Connect SuiteSix """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn56_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn6_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general7], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - """ Client Connect SuiteSeven """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn60_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn7_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 64}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - """ Client Connect SuiteEight """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn64_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn8_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general9], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - """ Client Connect SuiteNine """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn100_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn9_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'USP', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general10], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - """ Client Connect SuiteTen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn104_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn10_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general11], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - """ Client Connect SuiteEleven """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.plot - def test_ClientConnect_bridge_wpa2_chn108_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7650", name="WIFI-7650") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.plot - def test_ClientConnect_bridge_wpa2_chn11_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general12 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 112}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general12['ssid_modes'].keys(): - for i in range(len(setup_params_general12['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general12], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwelve(object): - """ Client Connect SuiteTwelve """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.subbu - def test_ClientConnect_bridge_wpa2_chn112_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general13 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 116}, - "2G": - {'band': '2G', - 'country': 'USP', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general13['ssid_modes'].keys(): - for i in range(len(setup_params_general13['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general13], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThirteen(object): - """ Client Connect SuiteThirteen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.subbu - def test_ClientConnect_bridge_wpa2_chn116_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general14 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'USP', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general14['ssid_modes'].keys(): - for i in range(len(setup_params_general14['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general14], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFourteen(object): - """ Client Connect SuiteFourteen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.subbu - def test_ClientConnect_bridge_wpa2_chn132_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general14["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general15 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 136}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general15['ssid_modes'].keys(): - for i in range(len(setup_params_general15['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general15], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFifteen(object): - """ Client Connect SuiteFifteen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.subbu - def test_ClientConnect_bridge_wpa2_chn136_20Mhz_USP_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general15["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general16 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 140}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general16['ssid_modes'].keys(): - for i in range(len(setup_params_general16['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general16], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSixteen(object): - """ Client Connect SuiteSixteen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - @pytest.mark.twenty - def test_ClientConnect_bridge_wpa2_chn140_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general16["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general17 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 144}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 20, - "channel": 12} - }, - "radius": False -} - -for sec_modes in setup_params_general17['ssid_modes'].keys(): - for i in range(len(setup_params_general17['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general17], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeventeen(object): - """ Client Connect SuiteSeventeen """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7659", name="WIFI-7659") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.twentyMhz - def test_ClientConnect_bridge_wpa2_chn144_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general17["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py deleted file mode 100644 index 420d475142d..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_40Mhz.py +++ /dev/null @@ -1,1164 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code - , pytest.mark.bridge] - -from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ - Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ - verifyUploadDownloadSpeediOS, get_ip_address_ios - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - """ Client Connect SuiteOne """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn36_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn1_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 44}, - "2G": - {'band': '2G', - 'country': 'USP', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - """ Client Connect SuiteTwo """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn44_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn2_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - """ Client Connect SuiteThree """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn52_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn3_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - """ Client Connect SuiteFour """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn60_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn4_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general5], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - """ Client Connect SuiteFuve """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn100_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn5_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general6], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - """ Client Connect SuiteSix """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn108_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn6_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general7], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - """ Client Connect SuiteSeven """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn132_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn7_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 140}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - """ Client Connect SuiteEight """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7664", name="WIFI-7664") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn140_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn8_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - """ Client Connect SuiteEight """ - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn9_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'USP', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - """ Client Connect SuiteEight """ - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.fourtyMhz - def test_ClientConnect_bridge_wpa2_chn10_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 40, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general8], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - """ Client Connect SuiteEight """ - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7651", name="WIFI-7651") - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ClientConnect_bridge_wpa2_chn11_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py deleted file mode 100644 index 3a32526deec..00000000000 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_JP/iOS/test_JP_80Mhz.py +++ /dev/null @@ -1,1030 +0,0 @@ -from logging import exception -import unittest -import warnings -from perfecto.test import TestResultFactory -import pytest -import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException -import random -import string -import sys -import allure - -if 'perfecto_libs' not in sys.path: - sys.path.append(f'../libs/perfecto_libs') - -pytestmark = [pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.interop_country_code_JP, pytest.mark.interop_country_code - , pytest.mark.bridge] - -from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ - Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ - verifyUploadDownloadSpeediOS, get_ip_address_ios - -setup_params_general1 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 36}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 1} - }, - "radius": False -} - -for sec_modes in setup_params_general1['ssid_modes'].keys(): - for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general1], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteOne(object): - """ Client Connect SuiteOne """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn36_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn1_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general2 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 2} - }, - "radius": False -} - -for sec_modes in setup_params_general2['ssid_modes'].keys(): - for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general2], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTwo(object): - """ Client Connect SuiteTwo """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn52_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ClientConnect_bridge_wpa2_chn2_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general3 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 3} - }, - "radius": False -} - -for sec_modes in setup_params_general3['ssid_modes'].keys(): - for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general3], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteThree(object): - """ Client Connect SuiteThree """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn100_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn3_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general4 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 132}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 4} - }, - "radius": False -} - -for sec_modes in setup_params_general4['ssid_modes'].keys(): - for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFour(object): - """ Client Connect SuiteFour """ - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7292", name="WIFI-7292") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn48_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn4_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general5 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 52}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 5} - }, - "radius": False -} - -for sec_modes in setup_params_general5['ssid_modes'].keys(): - for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteFive(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn5_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general6 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 56}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 6} - }, - "radius": False -} - -for sec_modes in setup_params_general6['ssid_modes'].keys(): - for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSix(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn6_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general7 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 60}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 7} - }, - "radius": False -} - -for sec_modes in setup_params_general7['ssid_modes'].keys(): - for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteSeven(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn7_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general8 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 64}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 8} - }, - "radius": False -} - -for sec_modes in setup_params_general8['ssid_modes'].keys(): - for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEight(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn8_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general9 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 100}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 9} - }, - "radius": False -} - -for sec_modes in setup_params_general9['ssid_modes'].keys(): - for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteNine(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - @pytest.mark.thirdrun - def test_ClientConnect_bridge_wpa2_chn9_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - -setup_params_general10 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 104}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 10} - }, - "radius": False -} - -for sec_modes in setup_params_general10['ssid_modes'].keys(): - for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteTen(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn10_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - -setup_params_general11 = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} - ]}, - "rf": {"5G": - {'band': '5G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 108}, - "2G": - {'band': '2G', - 'country': 'US', - "channel-mode": "VHT", - 'channel-width': 80, - "channel": 11} - }, - "radius": False -} - -for sec_modes in setup_params_general11['ssid_modes'].keys(): - for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - - -@allure.suite(suite_name="interop country code") -@allure.sub_suite(sub_suite_name="Bridge Mode country code(JP)") -@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE JP") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general4], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestBridgeModeConnectSuiteEleven(object): - - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7652", name="WIFI-7652") - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.eightyMhz - def test_ClientConnect_bridge_wpa2_chn11_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): - profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] - ssidName = profile_data["ssid_name"] - ssidPassword = profile_data["security_key"] - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - if ssidName not in get_vif_state: - allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - - report = setup_perfectoMobile_iOS[1] - driver = setup_perfectoMobile_iOS[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) - - if ip: - if is_internet: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - assert True - else: - allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) - assert False - - From 250ed4f2ca4a699b99d7d6299be215fe9bbe5ab8 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 25 Apr 2022 16:38:25 +0530 Subject: [PATCH 09/25] added a new marker in country US(IOS) Signed-off-by: Jyothsna-setti --- .../country_code_US/iOS/test_US_20mhz.py | 1729 +++++++++++++++++ .../country_code_US/iOS/test_US_40mhz.py | 1166 +++++++++++ .../country_code_US/iOS/test_US_80mhz.py | 1028 ++++++++++ 3 files changed, 3923 insertions(+) create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_20mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_40mhz.py create mode 100644 tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_80mhz.py diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_20mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_20mhz.py new file mode 100644 index 00000000000..7830234426a --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_20mhz.py @@ -0,0 +1,1729 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.interop_country_code_US, pytest.mark.interop_country_code, + pytest.mark.bridge] + + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne + """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn36_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn1_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 40}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo + """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn40_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn2_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn44_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn3_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 48}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn48_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn4_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + """ Client Connect SuiteFive """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn52_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn5_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + """ Client Connect SuiteSix """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn56_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn6_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + """ Client Connect SuiteSeven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn60_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn7_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + """ Client Connect SuiteEight """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn64_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn8_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + """ Client Connect SuiteNine """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn100_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn9_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + """ Client Connect SuiteTen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn104_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn10_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + """ Client Connect SuiteEleven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn108_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7641", name="WIFI-7641") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn11_20Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general12 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 112}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general12['ssid_modes'].keys(): + for i in range(len(setup_params_general12['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general12['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general12], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwelve(object): + """ Client Connect SuiteTwelve """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn112_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general12["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general13 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 116}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general13['ssid_modes'].keys(): + for i in range(len(setup_params_general13['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general13['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general13], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThirteen(object): + """ Client Connect SuiteThirteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn116_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general13["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general14 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general14['ssid_modes'].keys(): + for i in range(len(setup_params_general14['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general14['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general14], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFourteen(object): + """ Client Connect SuiteFourteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn132_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general14["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general15 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 136}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general15['ssid_modes'].keys(): + for i in range(len(setup_params_general15['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general15['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general15], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFifteen(object): + """ Client Connect SuiteFifteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn136_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general15["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general16 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general16['ssid_modes'].keys(): + for i in range(len(setup_params_general16['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general16['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general16], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSixteen(object): + """ Client Connect SuiteSixteen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn140_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general16["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general17 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 144}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 20, + "channel": 12} + }, + "radius": False +} + +for sec_modes in setup_params_general17['ssid_modes'].keys(): + for i in range(len(setup_params_general17['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general17['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general17], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeventeen(object): + """ Client Connect SuiteSeventeen """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7656", name="WIFI-7656") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.twentyMhz + def test_ClientConnect_bridge_wpa2_chn144_20Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general17["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_40mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_40mhz.py new file mode 100644 index 00000000000..8230b176b1b --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_40mhz.py @@ -0,0 +1,1166 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.interop_country_code_US, pytest.mark.interop_country_code, + pytest.mark.bridge] + + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn36_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn1_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 44}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn44_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn2_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn52_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn3_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn60_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn4_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + """ Client Connect SuiteFuve """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn100_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn5_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + """ Client Connect SuiteSix """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn108_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn6_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + """ Client Connect SuiteSeven """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn132_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn7_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 140}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + """ Client Connect SuiteEight """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7661", name="WIFI-7661") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn140_40Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn8_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + """ Client Connect SuiteNine """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn9_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + """ Client Connect SuiteTen """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.fourtyMhz + def test_ClientConnect_bridge_wpa2_chn10_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 40, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + """ Client Connect SuiteEleven """ + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7642", name="WIFI-7642") + @pytest.mark.twog + @pytest.mark.wpa2_personal + def test_ClientConnect_bridge_wpa2_chn11_40Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_80mhz.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_80mhz.py new file mode 100644 index 00000000000..c19d39c58de --- /dev/null +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/country_code_channel_division/country_code_US/iOS/test_US_80mhz.py @@ -0,0 +1,1028 @@ +from logging import exception +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException +import random +import string +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.interop_country_code_US, pytest.mark.interop_country_code, + pytest.mark.bridge] + + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios + + +setup_params_general1 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 36}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 1} + }, + "radius": False +} + +for sec_modes in setup_params_general1['ssid_modes'].keys(): + for i in range(len(setup_params_general1['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general1['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general1], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteOne(object): + """ Client Connect SuiteOne """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7666", name="WIFI-7666") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn36_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn1_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general2 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 2} + }, + "radius": False +} + +for sec_modes in setup_params_general2['ssid_modes'].keys(): + for i in range(len(setup_params_general2['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general2['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general2], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTwo(object): + """ Client Connect SuiteTwo """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7666", name="WIFI-7666") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn52_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn2_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general3 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 3} + }, + "radius": False +} + +for sec_modes in setup_params_general3['ssid_modes'].keys(): + for i in range(len(setup_params_general3['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general3['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general3], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteThree(object): + """ Client Connect SuiteThree """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7666", name="WIFI-7666") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn100_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn3_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general3["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general4 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 132}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 4} + }, + "radius": False +} + +for sec_modes in setup_params_general4['ssid_modes'].keys(): + for i in range(len(setup_params_general4['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general4['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general4], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFour(object): + """ Client Connect SuiteFour """ + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7666", name="WIFI-7666") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn132_80Mhz_US_5g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][1] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn4_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general4["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general5 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 52}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 5} + }, + "radius": False +} + +for sec_modes in setup_params_general5['ssid_modes'].keys(): + for i in range(len(setup_params_general5['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general5['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general5], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteFive(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn5_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general5["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general6 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 56}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 6} + }, + "radius": False +} + +for sec_modes in setup_params_general6['ssid_modes'].keys(): + for i in range(len(setup_params_general6['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general6['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general6], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSix(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn6_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general6["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general7 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 60}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 7} + }, + "radius": False +} + +for sec_modes in setup_params_general7['ssid_modes'].keys(): + for i in range(len(setup_params_general7['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general7['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general7], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteSeven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn7_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general7["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general8 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 64}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 8} + }, + "radius": False +} + +for sec_modes in setup_params_general8['ssid_modes'].keys(): + for i in range(len(setup_params_general8['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general8['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general8], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEight(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn8_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general8["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general9 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 100}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 9} + }, + "radius": False +} + +for sec_modes in setup_params_general9['ssid_modes'].keys(): + for i in range(len(setup_params_general9['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general9['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general9], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteNine(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn9_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general9["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + +setup_params_general10 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 104}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 10} + }, + "radius": False +} + +for sec_modes in setup_params_general10['ssid_modes'].keys(): + for i in range(len(setup_params_general10['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general10['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general10], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteTen(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn10_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general10["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + +setup_params_general11 = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"} + ]}, + "rf": {"5G": + {'band': '5G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 108}, + "2G": + {'band': '2G', + 'country': 'US', + "channel-mode": "VHT", + 'channel-width': 80, + "channel": 11} + }, + "radius": False +} + +for sec_modes in setup_params_general11['ssid_modes'].keys(): + for i in range(len(setup_params_general11['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general11['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + + +@allure.suite(suite_name="interop country code") +@allure.sub_suite(sub_suite_name="Bridge Mode country code(US)") +@allure.feature("BRIDGE MODE CLIENT CONNECT WITH COUNTRY CODE US") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general11], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestBridgeModeConnectSuiteEleven(object): + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-7643", name="WIFI-7643") + @pytest.mark.twog + @pytest.mark.wpa2_personal + @pytest.mark.eightyMhz + def test_ClientConnect_bridge_wpa2_chn11_80Mhz_US_2g(self, request, get_vif_state, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0] + ssidName = profile_data["ssid_name"] + ssidPassword = profile_data["security_key"] + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + if ssidName not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + + From 11812e14dfe4449e1baae84a6fdd6a34475efc52 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 20 May 2022 11:55:06 +0530 Subject: [PATCH 10/25] Maverick Testcase Signed-off-by: Jyothsna-setti --- libs/apnos/apnos.py | 13 +++ .../interOp/Maverick/android/test_maverick.py | 92 +++++++++++++++++++ tests/e2e/interOp/conftest.py | 13 +++ tests/fixtures_2x.py | 5 + 4 files changed, 123 insertions(+) create mode 100644 tests/e2e/interOp/Maverick/android/test_maverick.py diff --git a/libs/apnos/apnos.py b/libs/apnos/apnos.py index c4b389b2660..c3800c5181f 100644 --- a/libs/apnos/apnos.py +++ b/libs/apnos/apnos.py @@ -483,6 +483,19 @@ def iwinfo(self): client.close() return o + def set_maverick(self): + client = self.ssh_cli_connect() + cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh" + if self.mode: + cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ + f"cmd --value \"{cmd}\" " + stdin, stdout, stderr = client.exec_command(cmd) + output = stdout.read().replace(b":~# /etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh ", b"").decode('utf-8') + o = output + client.close() + return o + + def gettxpower(self): client = self.ssh_cli_connect() cmd = "iw dev | grep txpower" diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py new file mode 100644 index 00000000000..110af04e880 --- /dev/null +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -0,0 +1,92 @@ +import time + +import allure +import pytest + + +@pytest.mark.uc_sanity +@allure.feature("SDK REST API") +@pytest.mark.gateway_ap_api +class TestAP(object): + @pytest.mark.Namooo + def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + allure.attach(name="Status before reboot:", body=str(gw, connected, iwinfo)) + device_name = get_configuration['access_point'][0]['serial'] + payload = { + "serialNumber": device_name, + "when": 0 + } + resp = setup_controller.ap_reboot(device_name, payload) + time.sleep(120) + print(resp.json()) + allure.attach(name="Reboot", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw1 = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw1) + connected1, latest1, active1 = ap_ssh.get_ucentral_status() + print("Connected1:") + print(connected1) + iwinfo1 = ap_ssh.get_iwinfo() + print("iwinfo1:") + print(iwinfo1) + allure.attach(name="Status after reboot:", body=str(gw1, connected1, iwinfo1)) + assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + + def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) + device_name = get_configuration['access_point'][0]['serial'] + payload = { + "serialNumber": device_name, + "when": 0, + "keepRedirector": True + } + resp = setup_controller.ap_factory_reset(device_name, payload) + time.sleep(150) + print(resp.json()) + allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw1 = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw1) + connected1, latest1, active1 = ap_ssh.get_ucentral_status() + print("Connected1:") + print(connected1) + iwinfo1 = ap_ssh.get_iwinfo() + print("iwinfo1:") + print(iwinfo1) + allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) + assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index 679dde2baa8..1660d57bf93 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -280,6 +280,19 @@ def get_vif_state(get_apnos, get_configuration, request, lf_tools, skip_lf): yield lf_tools.ssid_list else: yield empty_get_vif_state_list +@pytest.fixture(scope="class") +def set_maverick(get_apnos, get_configuration, request, lf_tools, skip_lf, self): + client = self.ssh_cli_connect() + cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh" + if self.mode: + cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ + f"cmd --value \"{cmd}\" " + stdin, stdout, stderr = client.exec_command(cmd) + output = stdout.read().replace(b":~# iwinfo", b"").decode('utf-8') + o = output + client.close() + return o + @pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call): diff --git a/tests/fixtures_2x.py b/tests/fixtures_2x.py index 7b182034e52..f4f413f3d60 100644 --- a/tests/fixtures_2x.py +++ b/tests/fixtures_2x.py @@ -408,6 +408,11 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen mode = "BRIDGE" instantiate_profile_obj.set_mode(mode=mode) vlan_id = 1 + if parameter['mode'] == "NONE": + mode = "NONE" + instantiate_profile_obj.set_mode(mode=mode) + vlan_id = 1 + print("No Mode is selected!..") if parameter['mode'] == "VLAN": mode = "VLAN" instantiate_profile_obj.set_mode(mode=mode) From 533057a925f6059b4731d89ab2ce3c63bbb76819 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 20 May 2022 12:16:49 +0530 Subject: [PATCH 11/25] Added maverick code Signed-off-by: Jyothsna-setti --- .../interOp/Maverick/android/test_maverick.py | 91 ++++++++++--------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 110af04e880..0c6932ba594 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -23,16 +23,19 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) - allure.attach(name="Status before reboot:", body=str(gw, connected, iwinfo)) + maverick = ap_ssh.set_maverick() + print("maverick:") + print(maverick) + allure.attach(name="Status before maverick:", body=str(gw, connected, iwinfo)) device_name = get_configuration['access_point'][0]['serial'] payload = { "serialNumber": device_name, "when": 0 } - resp = setup_controller.ap_reboot(device_name, payload) + resp = setup_controller.ap_maverick(device_name, payload) time.sleep(120) print(resp.json()) - allure.attach(name="Reboot", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + allure.attach(name="Maverick", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) for ap in get_configuration['access_point']: cmd = "uci show ucentral" print(get_configuration['access_point']) @@ -46,47 +49,47 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): iwinfo1 = ap_ssh.get_iwinfo() print("iwinfo1:") print(iwinfo1) - allure.attach(name="Status after reboot:", body=str(gw1, connected1, iwinfo1)) + allure.attach(name="Status after maverick:", body=str(gw1, connected1, iwinfo1)) assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) - def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw) - connected, latest, active = ap_ssh.get_ucentral_status() - print("Connected:") - print(connected) - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) - allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) - device_name = get_configuration['access_point'][0]['serial'] - payload = { - "serialNumber": device_name, - "when": 0, - "keepRedirector": True - } - resp = setup_controller.ap_factory_reset(device_name, payload) - time.sleep(150) - print(resp.json()) - allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw1 = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw1) - connected1, latest1, active1 = ap_ssh.get_ucentral_status() - print("Connected1:") - print(connected1) - iwinfo1 = ap_ssh.get_iwinfo() - print("iwinfo1:") - print(iwinfo1) - allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) - assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + # def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): + # for ap in get_configuration['access_point']: + # cmd = "uci show ucentral" + # print(get_configuration['access_point']) + # ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + # gw = ap_ssh.run_generic_command(cmd) + # print("Status:") + # print(gw) + # connected, latest, active = ap_ssh.get_ucentral_status() + # print("Connected:") + # print(connected) + # iwinfo = ap_ssh.get_iwinfo() + # print("iwinfo:") + # print(iwinfo) + # allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) + # device_name = get_configuration['access_point'][0]['serial'] + # payload = { + # "serialNumber": device_name, + # "when": 0, + # "keepRedirector": True + # } + # resp = setup_controller.ap_factory_reset(device_name, payload) + # time.sleep(150) + # print(resp.json()) + # allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + # for ap in get_configuration['access_point']: + # cmd = "uci show ucentral" + # print(get_configuration['access_point']) + # ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + # gw1 = ap_ssh.run_generic_command(cmd) + # print("Status:") + # print(gw1) + # connected1, latest1, active1 = ap_ssh.get_ucentral_status() + # print("Connected1:") + # print(connected1) + # iwinfo1 = ap_ssh.get_iwinfo() + # print("iwinfo1:") + # print(iwinfo1) + # allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) + # assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) From ba65ea56bfd3f899b58911af804a466b92e3ca1c Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 20 May 2022 12:54:50 +0530 Subject: [PATCH 12/25] Maverick Signed-off-by: Jyothsna-setti --- tests/e2e/interOp/Maverick/android/test_maverick.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 0c6932ba594..8bb8b5da2b8 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -23,9 +23,6 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) - maverick = ap_ssh.set_maverick() - print("maverick:") - print(maverick) allure.attach(name="Status before maverick:", body=str(gw, connected, iwinfo)) device_name = get_configuration['access_point'][0]['serial'] payload = { @@ -46,6 +43,9 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): connected1, latest1, active1 = ap_ssh.get_ucentral_status() print("Connected1:") print(connected1) + maverick = ap_ssh.set_maverick() + print("setting maverick was done!") + iwinfo1 = ap_ssh.get_iwinfo() print("iwinfo1:") print(iwinfo1) From baf49c625082a1150504487f31fcb97b0134f843 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 20 May 2022 13:15:34 +0530 Subject: [PATCH 13/25] trail code in maverick Signed-off-by: Jyothsna-setti --- .../client_connect_test/android/test_general_security_modes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/android/test_general_security_modes.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/android/test_general_security_modes.py index 86a89b4398f..e76044870a1 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/android/test_general_security_modes.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/client_connect_test/android/test_general_security_modes.py @@ -77,6 +77,7 @@ class TestBridgeModeConnectSuiteOne(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4570", name="WIFI-4570") @pytest.mark.fiveg @pytest.mark.wpa2_personal + @pytest.mark.Sub def test_ClientConnect_5g_WPA2_Personal_Bridge(self, request, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, setup_perfectoMobile_android): From 73c8e67492bab04d936884d92c16ae6579b067d6 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 20 May 2022 13:36:29 +0530 Subject: [PATCH 14/25] Trail maverick testcase Signed-off-by: Jyothsna-setti --- .../interOp/Maverick/android/test_maverick.py | 91 +++++++++---------- .../Maverick/android/test_maverick2.py | 0 2 files changed, 44 insertions(+), 47 deletions(-) create mode 100644 tests/e2e/interOp/Maverick/android/test_maverick2.py diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 8bb8b5da2b8..110af04e880 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -23,16 +23,16 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) - allure.attach(name="Status before maverick:", body=str(gw, connected, iwinfo)) + allure.attach(name="Status before reboot:", body=str(gw, connected, iwinfo)) device_name = get_configuration['access_point'][0]['serial'] payload = { "serialNumber": device_name, "when": 0 } - resp = setup_controller.ap_maverick(device_name, payload) + resp = setup_controller.ap_reboot(device_name, payload) time.sleep(120) print(resp.json()) - allure.attach(name="Maverick", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + allure.attach(name="Reboot", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) for ap in get_configuration['access_point']: cmd = "uci show ucentral" print(get_configuration['access_point']) @@ -43,53 +43,50 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): connected1, latest1, active1 = ap_ssh.get_ucentral_status() print("Connected1:") print(connected1) - maverick = ap_ssh.set_maverick() - print("setting maverick was done!") - iwinfo1 = ap_ssh.get_iwinfo() print("iwinfo1:") print(iwinfo1) - allure.attach(name="Status after maverick:", body=str(gw1, connected1, iwinfo1)) + allure.attach(name="Status after reboot:", body=str(gw1, connected1, iwinfo1)) assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) - # def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): - # for ap in get_configuration['access_point']: - # cmd = "uci show ucentral" - # print(get_configuration['access_point']) - # ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - # gw = ap_ssh.run_generic_command(cmd) - # print("Status:") - # print(gw) - # connected, latest, active = ap_ssh.get_ucentral_status() - # print("Connected:") - # print(connected) - # iwinfo = ap_ssh.get_iwinfo() - # print("iwinfo:") - # print(iwinfo) - # allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) - # device_name = get_configuration['access_point'][0]['serial'] - # payload = { - # "serialNumber": device_name, - # "when": 0, - # "keepRedirector": True - # } - # resp = setup_controller.ap_factory_reset(device_name, payload) - # time.sleep(150) - # print(resp.json()) - # allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) - # for ap in get_configuration['access_point']: - # cmd = "uci show ucentral" - # print(get_configuration['access_point']) - # ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - # gw1 = ap_ssh.run_generic_command(cmd) - # print("Status:") - # print(gw1) - # connected1, latest1, active1 = ap_ssh.get_ucentral_status() - # print("Connected1:") - # print(connected1) - # iwinfo1 = ap_ssh.get_iwinfo() - # print("iwinfo1:") - # print(iwinfo1) - # allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) - # assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) + device_name = get_configuration['access_point'][0]['serial'] + payload = { + "serialNumber": device_name, + "when": 0, + "keepRedirector": True + } + resp = setup_controller.ap_factory_reset(device_name, payload) + time.sleep(150) + print(resp.json()) + allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw1 = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw1) + connected1, latest1, active1 = ap_ssh.get_ucentral_status() + print("Connected1:") + print(connected1) + iwinfo1 = ap_ssh.get_iwinfo() + print("iwinfo1:") + print(iwinfo1) + allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) + assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) diff --git a/tests/e2e/interOp/Maverick/android/test_maverick2.py b/tests/e2e/interOp/Maverick/android/test_maverick2.py new file mode 100644 index 00000000000..e69de29bb2d From 634799907f9bb9e5af449942bb25d0cea54708f4 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 23 May 2022 11:35:02 +0530 Subject: [PATCH 15/25] Ap succesfully converted to maverick state Signed-off-by: Jyothsna-setti --- libs/apnos/apnos.py | 26 ++++ .../Maverick/android/test_maverick2.py | 124 ++++++++++++++++++ 2 files changed, 150 insertions(+) diff --git a/libs/apnos/apnos.py b/libs/apnos/apnos.py index c3800c5181f..8a79e15463e 100644 --- a/libs/apnos/apnos.py +++ b/libs/apnos/apnos.py @@ -445,6 +445,31 @@ def get_wifi_status(self): print(e) return json_output + def set_maverick(self): + try: + client = self.ssh_cli_connect() + cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh" + if self.mode: + cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ + f"cmd --value \"{cmd}\" " + stdin, stdout, stderr = client.exec_command(cmd) + output = stdout.read().replace(b":~# /etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh", b"").decode('utf-8') + o = output.split() + maverick_bssid_data = {} + for i in range(len(o)): + if o[i].__contains__("ESSID"): + if o[i + 9].__contains__("2.4"): + band = "2G" + else: + band = "5G" + maverick_bssid_data[o[i - 1]] = [o[i + 1].replace('"', ''), o[i + 4], band] + client.close() + except Exception as e: + maverick_bssid_data = False + print(e) + return maverick_bssid_data + + def get_iwinfo(self): try: # [['ssid_wpa2_2g', 'wpa', 'something', '2G'], ['ssid_wpa2_2g', 'wpa', 'something', '5G']] @@ -471,6 +496,7 @@ def get_iwinfo(self): print(e) return iwinfo_bssid_data + def iwinfo(self): client = self.ssh_cli_connect() cmd = "iwinfo" diff --git a/tests/e2e/interOp/Maverick/android/test_maverick2.py b/tests/e2e/interOp/Maverick/android/test_maverick2.py index e69de29bb2d..89d56c1290e 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick2.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick2.py @@ -0,0 +1,124 @@ +import time +import pytest +import sys +import allure +import random +import string + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.ToggleWifiMode, + pytest.mark.client_reconnect, pytest.mark.enterprise] +from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_WifiMode_android, ForgetWifiConnection, openApp,\ + gets_ip_add_for_checking_and_forgets_ssid, verifyUploadDownloadSpeed_android, wifi_connect, wifi_disconnect_and_forget, gets_ip_add_eap_and_does_not_forget_ssid + +setup_params_enterprise = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa_enterprise": [ + {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]}, + {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}], + "wpa2_enterprise": [ + {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"]}, + {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"]}], + "wpa3_enterprise": [ + {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]}, + {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]}, + + "rf": {}, + "radius": True +} +for sec_modes in setup_params_enterprise['ssid_modes'].keys(): + for i in range(len(setup_params_enterprise['ssid_modes'][sec_modes])): + N = 3 + rand_string = (''.join(random.choices(string.ascii_uppercase + + string.digits, k=N)))+str(int(time.time_ns())%10000) + setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string + +@allure.suite(suite_name="interop regression") +@allure.sub_suite(sub_suite_name="Bridge Mode EAP Client ReConnect : Suite-A") +@pytest.mark.suiteA +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_enterprise], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") + + +@allure.feature("Maverick") +@pytest.mark.maverick +class TestMaverick(object): + @pytest.mark.nolme + def test_ap_maverick(self,request, lf_tools, setup_controller, get_vif_state, get_configuration, get_ap_logs, get_apnos): + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + maverick = ap_ssh.set_maverick() + print("maverick:") + print(maverick) + # reboot = ap_ssh.reboot() + # print("rebooted") + # print(reboot) + + # def test_maverick_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data + # , setup_perfectoMobile_android, radius_info, get_ap_logs): + # + # profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1] + # ssidName = profile_data["ssid_name"] + # # ssidPassword = profile_data["security_key"] + # print("SSID_NAME: " + ssidName) + # # print ("SSID_PASS: " + ssidPassword) + # ttls_passwd = radius_info["password"] + # identity = radius_info['user'] + # get_vif_state.append(ssidName) + # if ssidName not in get_vif_state: + # allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + # pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + # + # report = setup_perfectoMobile_android[1] + # driver = setup_perfectoMobile_android[0] + # connData = get_ToggleAirplaneMode_data + # + # # Set Wifi/AP Mode + # ip, is_internet = gets_ip_add_eap_and_does_not_forget_ssid(request, ssidName, identity, ttls_passwd, + # setup_perfectoMobile_android, connData) + # # + # if is_internet: + # if ip: + # text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + # else: + # text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") + # print(text_body) + # allure.attach(name="Connection Status: ", body=str(text_body)) + # + # # wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + # Toggle_WifiMode_android(request, setup_perfectoMobile_android, ssidName, connData) + # ip_check, is_internet_check = gets_ip_add_for_checking_and_forgets_ssid(request, ssidName, identity, + # ttls_passwd, + # setup_perfectoMobile_android, + # connData) + # if (ip_check == ip): + # assert True + # else: + # assert False + # else: + # allure.attach(name="Connection Status: ", body=str("No Internet access")) + # assert False + # + # + # + # + From 0066c97297666ab630e13cc567e52a98b88a30a1 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Mon, 23 May 2022 11:43:54 +0530 Subject: [PATCH 16/25] Removed unnecessary code Signed-off-by: Jyothsna-setti --- .../Maverick/android/test_maverick2.py | 89 +------------------ 1 file changed, 2 insertions(+), 87 deletions(-) diff --git a/tests/e2e/interOp/Maverick/android/test_maverick2.py b/tests/e2e/interOp/Maverick/android/test_maverick2.py index 89d56c1290e..9ef0cffb768 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick2.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick2.py @@ -2,51 +2,12 @@ import pytest import sys import allure -import random -import string if 'perfecto_libs' not in sys.path: sys.path.append(f'../libs/perfecto_libs') pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.ToggleWifiMode, pytest.mark.client_reconnect, pytest.mark.enterprise] -from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_WifiMode_android, ForgetWifiConnection, openApp,\ - gets_ip_add_for_checking_and_forgets_ssid, verifyUploadDownloadSpeed_android, wifi_connect, wifi_disconnect_and_forget, gets_ip_add_eap_and_does_not_forget_ssid - -setup_params_enterprise = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa_enterprise": [ - {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}], - "wpa2_enterprise": [ - {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"]}], - "wpa3_enterprise": [ - {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]}, - - "rf": {}, - "radius": True -} -for sec_modes in setup_params_enterprise['ssid_modes'].keys(): - for i in range(len(setup_params_enterprise['ssid_modes'][sec_modes])): - N = 3 - rand_string = (''.join(random.choices(string.ascii_uppercase + - string.digits, k=N)))+str(int(time.time_ns())%10000) - setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string - -@allure.suite(suite_name="interop regression") -@allure.sub_suite(sub_suite_name="Bridge Mode EAP Client ReConnect : Suite-A") -@pytest.mark.suiteA -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_enterprise], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") - @allure.feature("Maverick") @pytest.mark.maverick @@ -72,53 +33,7 @@ def test_ap_maverick(self,request, lf_tools, setup_controller, get_vif_state, ge # reboot = ap_ssh.reboot() # print("rebooted") # print(reboot) + return True + - # def test_maverick_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data - # , setup_perfectoMobile_android, radius_info, get_ap_logs): - # - # profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1] - # ssidName = profile_data["ssid_name"] - # # ssidPassword = profile_data["security_key"] - # print("SSID_NAME: " + ssidName) - # # print ("SSID_PASS: " + ssidPassword) - # ttls_passwd = radius_info["password"] - # identity = radius_info['user'] - # get_vif_state.append(ssidName) - # if ssidName not in get_vif_state: - # allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) - # pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") - # - # report = setup_perfectoMobile_android[1] - # driver = setup_perfectoMobile_android[0] - # connData = get_ToggleAirplaneMode_data - # - # # Set Wifi/AP Mode - # ip, is_internet = gets_ip_add_eap_and_does_not_forget_ssid(request, ssidName, identity, ttls_passwd, - # setup_perfectoMobile_android, connData) - # # - # if is_internet: - # if ip: - # text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - # else: - # text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") - # print(text_body) - # allure.attach(name="Connection Status: ", body=str(text_body)) - # - # # wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - # Toggle_WifiMode_android(request, setup_perfectoMobile_android, ssidName, connData) - # ip_check, is_internet_check = gets_ip_add_for_checking_and_forgets_ssid(request, ssidName, identity, - # ttls_passwd, - # setup_perfectoMobile_android, - # connData) - # if (ip_check == ip): - # assert True - # else: - # assert False - # else: - # allure.attach(name="Connection Status: ", body=str("No Internet access")) - # assert False - # - # - # - # From 1126dad83cde8391edee9f0d537d4f52f57db1a9 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 3 Jun 2022 10:54:14 +0530 Subject: [PATCH 17/25] MAVERICK testcases Signed-off-by: Jyothsna-setti --- libs/perfecto_libs/android_lib.py | 6221 +++++++++++------ libs/perfecto_libs/iOS_lib.py | 353 +- .../interOp/Maverick/android/test_maverick.py | 122 +- .../Maverick/android/test_maverick2.py | 53 +- .../Maverick/android/test_maverick_ios.py | 80 + tests/e2e/interOp/conftest.py | 19 + 6 files changed, 4526 insertions(+), 2322 deletions(-) create mode 100644 tests/e2e/interOp/Maverick/android/test_maverick_ios.py diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index a0392355971..bb30a98a7f8 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -1888,16 +1888,16 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet -#only to connect to wifi -def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): +#mavericknew +def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") print("Verifying Wifi Connection Details....") - #allure.attach(name= body=str("\n-------------------------------------")) report = setup_perfectoMobile[1] driver = setup_perfectoMobile[0] + ip_address_element_text = False ssid_with_internet = False report.step_start("Switching Driver Context") @@ -1909,7 +1909,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): openApp(connData["appPackage-android"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) - #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) + if deviceModelName != ("Pixel 4"): report.step_start("Set Wifi Network to " + WifiName) @@ -1926,7 +1926,9 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") - wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") + time.sleep(3) + wifiElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH,"//*[@text='Wi-Fi']"))) wifiElement.click() @@ -1962,75 +1964,101 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): if get_switch_text == "Off": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- - try: #To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: #To forget exhisting ssid - print("To forget ssid") + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": + try: #To deal with already connected SSID check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() - try: + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forget old ssid") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + print("Couldn't get into additional details") except: - print("Couldn't get into additional details") - except: - print("No Connected SSIDS") + print("No Connected SSIDS") + else: + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + try: #To forget exhisting ssid + print("To forget ssid in osversion 12") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() + try: + print("To forget ssid in osversion 12-1206") + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") #----------------------This is to Forget current connected SSID-------------------------------- - - print("Searching for Wifi: " + WifiName) - #allure.attach(name= body=str("Searching for Wifi: " + WifiName)) - time.sleep(2) + # time.sleep(2) print("Selecting Wifi: " + WifiName) + #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) ssid_found = False available_ssids = False - # This is To get all available ssids - # ------------------------------------------------------ + #This is To get all available ssids + #------------------------------------------------------ try: - for check_for_all_ssids in range(2): + for k in range(9): available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: if WifiName not in available_ssids: scrollDown(setup_perfectoMobile) time.sleep(2) else: ssid_found = True - print(WifiName + " : Found in Device") - #allure.attach(name= body=str(WifiName + " : Found in Device")) + print(WifiName+" : Found in Device") + #allure.attach(name= body=str(WifiName+" : Found in Device")) break except: - print("1538") - pass + print("couldn't find wifi in available ssid") if not ssid_found: - print("could not found" + WifiName + " in device") + print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet except: closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- + return ip_address_element_text, ssid_with_internet + #------------------------------------------------------- @@ -2038,17 +2066,16 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # ------------------------------------------------------- try: report.step_start("Selecting Wifi: " + WifiName) + print(("Clicking WIFI")) wifiSelectionElement = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) wifiSelectionElement.click() check_if_no_internet_popup(driver) - #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - #allure.attach(name= body=str("Exception on Selecting Wifi Network. Please check wifi Name or signal")) request.config.cache.set(key="SelectingWifiFailed", value=str(e)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2056,9 +2083,10 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # ------------------------------------------------------- try: check_if_no_internet_popup(driver) + time.sleep(3) report.step_start("Set Wifi Password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext']") + print("Set Wifi password") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -2068,450 +2096,271 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): #Click on connect button # ------------------------------------------------------- try: + time.sleep(5) report.step_start("Click Connect Button") + print("Click Connect") joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) # ------------------------------------------------------- - # //*[@resource-id='com.android.settings:id/summary' and @text="Sign in to the network."]/parent::*/android.widget.TextView[@text='XWF-OWF_DSx'] + #Verify if WiFi is connected # ------------------------------------------------------- - try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - #allure.attach(name= body=str("Wifi Successfully Connected")) - # time.sleep(5) - check_if_no_internet_popup(driver) - except: + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": try: - check_if_no_internet_popup(driver) + report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" - + WifiName + "']"))) - print("Wifi Successfully Connected without internet") - #allure.attach(name= body=str("Wifi Successfully Connected without internet")) + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) check_if_no_internet_popup(driver) except: try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - #allure.attach(name=body=str("Wifi Successfully Connected")) + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) except: try: - report.step_start("Unknown WIFI status found") - ssid_with_internet = False - print("Unknown WIFI status found") + report.step_start("Verify if Wifi is Connected - 2") + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - - - except NoSuchElementException: - print("No Switch element found") - #allure.attach(name= body=str("No Switch element found")) - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - - except NoSuchElementException: - print("Couldn't find wifi Button") - #allure.attach(name= body=str("Couldn't find wifi Button")) - # ------------------Open WIFI page---------------------------------- - - except NoSuchElementException: - print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - #allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) - # -----------------To Open Connections page--------------------------- - else: #--------------Pixel 4 code-------------------------- - report.step_start("Set Wifi Network to " + WifiName) - - # -----------------To Open Connections page----------------------- - try: - print("Verifying Connected Wifi Connection") - report.step_start("Click Network & internet in pixel4") - connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") - connElement.click() + return ip_address_element_text, ssid_with_internet + else: + try: + report.step_start("Verifying wifi connection status connected/connected without internet") + check_if_no_internet_popup(driver) + check_if_no_internet_popup(driver) - # ---------------------Open WIFI page------------------------------- - try: - report.step_start("Clicking Wi-Fi") - print("Clicking WIFI") - time.sleep(3) - wifiElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) - wifiElement.click() + wifi_connection_name = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + ))) + if wifi_connection_name.text == WifiName: + wifi_connection_status = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary']" + ))) + if wifi_connection_status.text == "Connected": + ssid_with_internet = True + print("Connected with internet") - # --------------------To Turn on WIFi Switch if already OFF-------------------------------- - try: - driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='android:id/icon']") - get_switch_text = get_switch_text_element.click() - if get_switch_text is not None: - switch_text = "Off" - else: - switch_text = "On" - print("get_switch_text: ", switch_text) - print("Find wifi switch") - try: # To Turn on Wi-Fi Switch - if switch_text == "Off": - # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(1) - get_switch_element.click() - driver.implicitly_wait(1) - i = 0 - for i in range(5): - if switch_text == "On": - print("WIFI Switch is ON") - break else: - try: - get_switch_text_element = driver.find_element_by_xpath( - "//*[@text='Add network']") - get_switch_text = get_switch_text_element.text - if get_switch_text == "Add network": - switch_text = "On" - else: - switch_text = "Off" - except NoSuchElementException: - print("Exception: Verify Xpath") - # Scroll Down - scrollDown(setup_perfectoMobile) - print("Sleeping for: ", i) - time.sleep(i) - pass - if switch_text == "Off": - print("Switch is Still OFF") + ssid_with_internet = False + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + # Go into additional details here + else: + # Connected to some other wifi, makes sense to close app and fail this testcase closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - else: - print("Switch is already On") - check_if_no_internet_popup(driver) - except: - print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ---------------------This is to Forget current connected SSID------------------------------- - try: # To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath("//*[@text='Connected']") - try: # To forget existing ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - additional_details_element.click() - except: - print("Couldn't get into additional details") - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") - forget_ssid.click() - print("Forget old ssid") + return ip_address_element_text, ssid_with_internet except: - print("Couldn't forget ssid") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - except: - print("No Connected SSIDS") - # ----------------------This is to Forget current connected SSID-------------------------------- + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- - time.sleep(2) - print("Selecting Wifi: " + WifiName) - # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) - ssid_found = False - available_ssids = False - # This is To get all available ssids - # ------------------------------------------------------ - try: - for k in range(5): - available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - #allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + #Get into Additional Details + #To Get an IP Address + #To Forget connection + #To turn off auto. connect + # ------------------------------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": + try: + print("Into additional details") + time.sleep(2) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() try: - if WifiName not in available_ssids: - scrollDown(setup_perfectoMobile) - time.sleep(2) - else: - ssid_found = True - print(WifiName + " : Found in Device") - # allure.attach(name= body=str(WifiName+" : Found in Device")) - break + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) except: - print("couldn't find wifi in available ssid") - if not ssid_found: - ssid_not_found = False - for k in range(5): - available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: - if WifiName not in available_ssids: - scroll_up(setup_perfectoMobile) - time.sleep(2) - else: - ssid_not_found = True - print(WifiName + " : Found in Device") - # allure.attach(name= body=str(WifiName+" : Found in Device")) - break + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) except: - print("couldn't find wifi in available ssid") - if not ssid_not_found: - print("could not found " + WifiName + " in device") - # allure.attach(name= body=str("could not found" + WifiName + " in device")) + print("IP address element not found") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + # allure.attach(name= body=str("IP address element not found")) + # --------------------Added for ssid security check-------------------------- + try: + time.sleep(2) + security_name_element = driver.find_element_by_xpath( + "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + security_name_element_text = security_name_element.text + print("Ssid security is :", security_name_element_text) + allure.attach(name="Ssid Security:", body=str(security_name_element_text)) + except: + print("Security is not available") + # --------------------Added for ssid Name check-------------------------- + try: + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- + assert False + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + try: + check_if_no_internet_popup(driver) + driver.implicitly_wait(3) + time.sleep(2) + auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off_text = auto_reconnect_off.text + if auto_reconnect_off_text != "Off": + auto_reconnect_off.click() + print("Auto reconnect turning off") + else: + print("Auto reconnect is already off") + except: + print("Couldn't find auto reconnect element") - # Selecting WIFI - # ------------------------------------------------------- - try: - report.step_start("Selecting Wifi: " + WifiName) - wifiSelectionElement = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifiSelectionElement.click() - check_if_no_internet_popup(driver) - except Exception as e: - print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- + # ------------------------------- Forget SSID ---------------- + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forgetting ssid") - # Set password if Needed - # ------------------------------------------------------- - try: - check_if_no_internet_popup(driver) - report.step_start("Set Wifi Password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") - wifiPasswordElement.send_keys(WifiPass) - except NoSuchElementException: - print("Password Page Not Loaded, password May be cached in the System") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + else: + try: + print("Into additional details") + time.sleep(2) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() - # Click on connect button - # ------------------------------------------------------- - try: - report.step_start("Click Connect Button") - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") - joinBTNElement.click() - except NoSuchElementException: - print("Connect Button Not Enabled...Verify if Password is set properly ") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- + try: + print("click on view more") + additional_details_element = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']"))) + additional_details_element.click() + except: + pass - # Verify if WiFi is connected - # ------------------------------------------------------- - try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - # time.sleep(5) - check_if_no_internet_popup(driver) - except: - try: - print("Not able to verify the connected WiFi. Scrolling up.") - scroll_up(setup_perfectoMobile) - scroll_up(setup_perfectoMobile) - # check_if_no_internet_popup(driver) - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - print("Wifi Successfully Connected without internet") - check_if_no_internet_popup(driver) - except: try: - report.step_start("Verify if Wifi is Connected") - print("Verifying after scrolling") - scroll_up(setup_perfectoMobile) - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - except NoSuchElementException: - print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - - - except NoSuchElementException: - print("No Switch element found") - # allure.attach(name= body=str("No Switch element found")) - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - - except NoSuchElementException: - print("Couldn't find wifi Button") - # allure.attach(name= body=str("Couldn't find wifi Button")) - # ------------------Open WIFI page---------------------------------- - - except NoSuchElementException: - print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) - # -----------------To Open Connections page--------------------------- - - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - -#To disconnect and forget network -def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile, connData): - print("\n-------------------------------------") - print("WIFI Disconnect") - print("-------------------------------------") - #allure.attach(name= body=str("------------------- WIFI Disconnect ------------------")) - - report = setup_perfectoMobile[1] - driver = setup_perfectoMobile[0] - - report.step_start("Switching Driver Context") - print("Switching Context to Native") - contexts = driver.contexts - driver.switch_to.context(contexts[0]) - - # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) - deviceModelName = getDeviceModelName(setup_perfectoMobile) - print("Selected Device Model: " + deviceModelName) - - if deviceModelName != ("Pixel 4"): - report.step_start("Set Wifi Network to " + WifiName) - - - # -----------------To Open Connections page----------------------- - try: - print("Verifying Connected Wifi Connection") - report.step_start("Click Connections") - connElement = driver.find_element_by_xpath("//*[@text='Connections']") - connElement.click() + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") + pass + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + ip_address_element_text = "SSID Match, S20 Does Not support scrolling" + ssid_with_internet = "SSID Match, S20 Does Not support scrolling" + # return ip_address_element_text, ssid_with_internet + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) - # ---------------------Open WIFI page------------------------------- - try: - report.step_start("Clicking Wi-Fi") - print("Clicking WIFI") - wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") - wifiElement.click() + report.step_start("Scrolling for ip address - 1") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + report.step_start("Scrolling for ip address - 2") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) - # --------------------To Turn on WIFi Switch if already OFF-------------------------------- - try: - driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") - get_switch_text = get_switch_text_element.text - print("get_switch_text: ",get_switch_text) - print("Find wifi switch") - try: #To Turn on Wi-Fi Switch - if get_switch_text == "Off": - # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(1) - get_switch_element.click() - driver.implicitly_wait(1) - i = 0 - for i in range(5): - if get_switch_text == "On": - print("WIFI Switch is ON") - break - else: - try: - get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") - get_switch_text = get_switch_text_element.text - except: - pass - print("Sleeping for: ", i) - time.sleep(i) - pass - if get_switch_text == "Off": - print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - else: - print("Switch is already On") - check_if_no_internet_popup(driver) - except: - print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + report.step_start("Scrolling for ip address - 3") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + report.step_start("looking for ip address") - #---------------------This is to Forget current connected SSID------------------------------- - try: #To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: #To forget exhisting ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forget old ssid") - #allure.attach(name=body=str("Forget old ssid")) + ip_address_element_text = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + ip_address_element_text = ip_address_element_text.text + ssid_with_internet = True except: - print("Couldn't forget ssid") - #allure.attach(name=body=str("Couldn't forget ssid")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - except: - #allure.attach(name=body=str("Couldn't get into additional details")) - print("Couldn't get into additional details") - except: - #allure.attach(name=body=str("No Connected SSIDS")) - print("No Connected SSIDS") - #----------------------This is to Forget current connected SSID-------------------------------- + print("Unable to get IP address") + pass - try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() - except: - print("couldn't click on wifi switch") + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- - except NoSuchElementException: + # ------------------------------------------------------- + except: print("No Switch element found") # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except NoSuchElementException: + except: print("Couldn't find wifi Button") # ------------------Open WIFI page---------------------------------- - except NoSuchElementException: + except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - else:#-----------------------Pixel4 code------------------------- + #--------------------Pixel 4 code--------------------------- + else: report.step_start("Set Wifi Network to " + WifiName) # -----------------To Open Connections page----------------------- try: print("Verifying Connected Wifi Connection") - report.step_start("Click Network & internet") + report.step_start("Click Network & internet in pixel4") connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") connElement.click() @@ -2528,17 +2377,17 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='android:id/icon']") - get_switch_text = get_switch_text_element.click() - if get_switch_text is not None: - switch_text = "Off" - else: - switch_text = "On" - + "//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_text = get_switch_text_element.text + # if get_switch_text is not None: + # switch_text = "OFF" + # else: + # switch_text = "ON" + switch_text = get_switch_text print("get_switch_text: ", switch_text) print("Find wifi switch") try: # To Turn on Wi-Fi Switch - if switch_text == "Off": + if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/switch_widget']") @@ -2547,7 +2396,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile driver.implicitly_wait(1) i = 0 for i in range(5): - if switch_text == "On": + if switch_text == "ON": print("WIFI Switch is ON") break else: @@ -2556,9 +2405,9 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile "//*[@text='Add network']") get_switch_text = get_switch_text_element.text if get_switch_text == "Add network": - switch_text = "On" + switch_text = "ON" else: - switch_text = "Off" + switch_text = "OFF" except NoSuchElementException: print("Exception: Verify Xpath") # Scroll Down @@ -2566,263 +2415,1193 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile print("Sleeping for: ", i) time.sleep(i) pass - if switch_text == "Off": + if switch_text == "OFF": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - # ---------------------This is to Forget current connected SSID------------------------------- - try: # To deal with already connected SSID + return ip_address_element_text, ssid_with_internet + + # ---------------------This is to Forget current connected SSID------------------------------- + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath("//*[@text='Connected']") + try: # To forget existing ssid + print("To forget ssid") check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath("//*[@text='Connected']") - try: # To forget existing ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - additional_details_element.click() - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - except: - #allure.attach(name=body=str("Couldn't get into additional details")) - print("Couldn't get into additional details") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() except: - #allure.attach(name=body=str("No Connected SSIDS")) - print("No Connected SSIDS") - #----------------------This is to Forget current connected SSID-------------------------------- + print("Couldn't get into additional details") + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/button1']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("No Connected SSIDS") + # ----------------------This is to Forget current connected SSID-------------------------------- + time.sleep(2) + print("Selecting Wifi: " + WifiName) + # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + ssid_not_found = False + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scroll_up(setup_perfectoMobile) + time.sleep(2) + else: + ssid_not_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_not_found: + print("could not found " + WifiName + " in device") + # allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet except: - print("couldn't click on wifi switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- - except NoSuchElementException: + # Set password if Needed + # ------------------------------------------------------- + try: + time.sleep(3) + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + print("Entering password") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Click on connect button + # ------------------------------------------------------- + try: + report.step_start("Click Connect Button") + time.sleep(5) + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + print("Not able to verify the connected WiFi. Scrolling up.") + scroll_up(setup_perfectoMobile) + scroll_up(setup_perfectoMobile) + # check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + print("Verifying after scrolling") + scroll_up(setup_perfectoMobile) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Get into Additional Details + # To Get an IP Address + # To Forget connection + # To turn off auto. connect + # ------------------------------------------------------- + try: + print("Into additional details") + time.sleep(5) + report.step_start("Going for ip address") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + print("Entered ssid") + try: + time.sleep(10) + print("clicking Advanced") + report.step_start("clicking Advanced") + advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']") + advanced_element.click() + print("clicked Advanced") + #print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + advanced_element.click() + #print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + advanced_element.click() + except: + print("No advanced options") + # allure.attach(name= body=str("IP address element not found")) + + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + # Scroll Down + scrollDown(setup_perfectoMobile) + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + #------------------------------- Forget SSID ---------------- + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() + except: + print("couldn't click on wifi switch") + # allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + except: print("No Switch element found") # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except NoSuchElementException: + except: print("Couldn't find wifi Button") # ------------------Open WIFI page---------------------------------- - except NoSuchElementException: + except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet -# try: -# elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") -# print("elements: ", elements) -# print(len(elements)) -# for i in range(len(elements)): -# print("elements[i]", elements[i]) -# print("elements[i].text", elements[i].text) -# except: -# print("No SSIDS available") -def get_all_available_ssids(driver, deviceModelName): - active_ssid_list = [] +#only to connect to wifi +def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("Select Wifi/AccessPoint Connection") + print("-------------------------------------") + print("Verifying Wifi Connection Details....") + #allure.attach(name= body=str("\n-------------------------------------")) + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + ssid_with_internet = False + + report.step_start("Switching Driver Context") + print("Switching Context to Native") + contexts = driver.contexts + driver.switch_to.context(contexts[0]) + + # Open Settings Application + openApp(connData["appPackage-android"], setup_perfectoMobile) + deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) + #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) if deviceModelName != ("Pixel 4"): + report.step_start("Set Wifi Network to " + WifiName) + + + # -----------------To Open Connections page----------------------- try: - time.sleep(8) - driver.implicitly_wait(10) - elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") - # print("elements: ", elements) - print(len(elements)) - for i in range(len(elements)): - # print("elements[i]", elements[i]) - # print("elements[i].text", elements[i].text) - active_ssid_list.append(elements[i].text) - except: - print("No SSIDS available") - else: - try: - time.sleep(8) - driver.implicitly_wait(10) - elements = driver.find_elements_by_xpath("//*[@resource-id='android:id/title']") - # print("elements: ", elements) - print(len(elements)) - for i in range(len(elements)): - # print("elements[i]", elements[i]) - # print("elements[i].text", elements[i].text) + print("Verifying Connected Wifi Connection") + report.step_start("Click Connections") + connElement = driver.find_element_by_xpath("//*[@text='Connections']") + connElement.click() + + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") + wifiElement.click() + + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: - active_ssid_list.append(elements[i].text) - except: - print("Encountered a cache SSID which is no longer in the DOM.Moving to next SSID.") - except: - print("No SSIDS available") - return active_ssid_list + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + print("get_switch_text: ",get_switch_text) + print("Find wifi switch") + try: #To Turn on Wi-Fi Switch + if get_switch_text == "Off": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if get_switch_text == "On": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + except: + pass + print("Sleeping for: ", i) + time.sleep(i) + pass + if get_switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet -def reportClient(value): - global reporting_client # declare a to be a global - reporting_client = value # this sets the global value of a + #---------------------This is to Forget current connected SSID------------------------------- + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- -# This is a functon to get all of the ssid details -# This function needs to be called from a standalone script and not throuh testcase -# def get_all_available_ssids(): -# from appium import webdriver -# driver = None -# reporting_client = None -# -# warnings.simplefilter("ignore", ResourceWarning) -# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) -# -# capabilities = { -# 'platformName': 'Android', -# 'model': 'Galaxy S9', -# 'browserName': 'mobileOS', -# # 'automationName' : 'Appium', -# 'securityToken': 'eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3NzkzZGM0Ni1jZmU4LTQ4ODMtYjhiOS02ZWFlZGU2OTc2MDkifQ.eyJpYXQiOjE2MjE4NjgyOTksImp0aSI6IjIzNGFiOTM1LWIxYjQtNGZiOC1hZmJiLTM0OTQwNzU5MjIwMyIsImlzcyI6Imh0dHBzOi8vYXV0aDIucGVyZmVjdG9tb2JpbGUuY29tL2F1dGgvcmVhbG1zL3RpcC1wZXJmZWN0b21vYmlsZS1jb20iLCJhdWQiOiJodHRwczovL2F1dGgyLnBlcmZlY3RvbW9iaWxlLmNvbS9hdXRoL3JlYWxtcy90aXAtcGVyZmVjdG9tb2JpbGUtY29tIiwic3ViIjoiN2I1MzBhZTAtODgxOC00N2I5LTgzZjMtN2ZhMGZiMGRkYjRlIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6Im9mZmxpbmUtdG9rZW4tZ2VuZXJhdG9yIiwibm9uY2UiOiI1MzI2NDQxNS0xYTQwLTQ1ZTctOGVkMi1hOTNiYWZmZWNjYjIiLCJzZXNzaW9uX3N0YXRlIjoiY2YzY2JlOGMtY2Y5OC00NzRlLWJmODctYTIxNzU0NzVhM2EzIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBvZmZsaW5lX2FjY2VzcyBlbWFpbCJ9.4a4v6AKxmY95Zb-l84K_Od49WPikwOHP7ryctfmnn-w', -# 'useAppiumForWeb': 'false', -# 'useAppiumForHybrid': 'false', -# # 'bundleId' : request.config.getini("appPackage-android"), -# } -# -# app_data = { -# "webURL": "https://www.google.com", -# "lblSearch": "//*[@class='gLFyf']", -# "elelSearch": "(//*[@class='sbic sb43'])[1]", -# "BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']", -# "bundleId-iOS-Settings": 'com.apple.Preferences', -# "bundleId-iOS-Safari": 'com.apple.mobilesafari', -# "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", -# "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", -# # Android -# "platformName-android": 'Android', -# "appPackage-android": 'com.android.settings' -# } -# -# driver = webdriver.Remote( -# "https://tip.perfectomobile.com/nexperience/perfectomobile/wd/hub", -# capabilities -# ) -# -# try: -# print(driver) -# driver.implicitly_wait(35) -# #Driver Ends here -# -# projectname = "TIP-PyTest-Execution" -# projectversion = 1.0 -# jobname = "tip-sushant-android" -# jobnumber = 2 -# tags = "TestTag" -# testCaseName = "getting_ssids" -# -# # print("\nSetting Perfecto ReportClient....") -# perfecto_execution_context = PerfectoExecutionContext(driver, tags, Job(jobname, jobnumber), -# Project(projectname, projectversion)) -# reporting_client = PerfectoReportiumClient(perfecto_execution_context) -# reporting_client.test_start(testCaseName, TestContext([], "Perforce")) -# reportClient(reporting_client) -# -# -# setup_perfectoMobile = (driver, reporting_client) -# print("setup_perfectoMobile_android: ", setup_perfectoMobile) -# print(type(setup_perfectoMobile)) -# -# print("\n-------------------------------------") -# print("Select Wifi/AccessPoint Connection") -# print("-------------------------------------") -# print("Verifying Wifi Connection Details....") -# report = setup_perfectoMobile[1] -# driver = setup_perfectoMobile[0] -# -# -# -# ip_address_element_text = False -# ssid_with_internet = False -# ssid_list = [] -# -# report.step_start("Switching Driver Context") -# print("Switching Context to Native") -# contexts = driver.contexts -# print("contexts", contexts) -# driver.switch_to.context(contexts[0]) -# print("1508") -# -# # Open Settings Application -# openApp(app_data["appPackage-android"], setup_perfectoMobile) -# -# deviceModelName = driver.execute_script('mobile:handset:info', {'property': 'model'}) -# -# # deviceModelName = getDeviceModelName(setup_perfectoMobile) -# print("Selected Device Model: " + deviceModelName) -# -# if deviceModelName != ("Pixel 4"): -# # -----------------To Open Connections page----------------------- -# try: -# print("Verifying Connected Wifi Connection") -# report.step_start("Click Connections") -# connElement = driver.find_element_by_xpath("//*[@text='Connections']") -# connElement.click() -# -# # ---------------------Open WIFI page------------------------------- -# try: -# report.step_start("Clicking Wi-Fi") -# print("Clicking WIFI") -# wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") -# wifiElement.click() -# -# # --------------------To Turn on WIFi Switch if already OFF-------------------------------- -# try: -# driver.implicitly_wait(1) -# get_switch_text_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_text']") -# get_switch_text = get_switch_text_element.text -# print("get_switch_text: ", get_switch_text) -# # print("Find wifi switch") -# try: # To Turn on Wi-Fi Switch -# if get_switch_text == "Off": -# # driver.implicitly_wait(3) -# get_switch_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_widget']") -# # driver.implicitly_wait(1) -# get_switch_element.click() -# driver.implicitly_wait(1) -# i = 0 -# for i in range(5): -# if get_switch_text == "On": -# print("WIFI Switch is ON") -# break -# else: -# try: -# get_switch_text_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_text']") -# get_switch_text = get_switch_text_element.text -# except: -# pass -# print("Sleeping for: ", i) -# time.sleep(i) -# pass -# if get_switch_text == "Off": -# print("Switch is Still OFF") -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) -# close_driver(driver) -# return ip_address_element_text -# else: -# print("Switch is already On") -# check_if_no_internet_popup(driver) -# except: -# print("Couldn't turn on WIFI sewitch") -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) + + print("Searching for Wifi: " + WifiName) + #allure.attach(name= body=str("Searching for Wifi: " + WifiName)) + time.sleep(2) + print("Selecting Wifi: " + WifiName) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ + try: + for check_for_all_ssids in range(2): + available_ssids = get_all_available_ssids(driver, deviceModelName) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + #allure.attach(name= body=str(WifiName + " : Found in Device")) + break + except: + print("1538") + pass + if not ssid_found: + print("could not found" + WifiName + " in device") + #allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + # ------------------------------------------------------- + + + + #Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + #allure.attach(name= body=str("Exception on Selecting Wifi Network. Please check wifi Name or signal")) + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + # ------------------------------------------------------- + + + #Set password if Needed + # ------------------------------------------------------- + try: + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + #Click on connect button + # ------------------------------------------------------- + try: + report.step_start("Click Connect Button") + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + # //*[@resource-id='com.android.settings:id/summary' and @text="Sign in to the network."]/parent::*/android.widget.TextView[@text='XWF-OWF_DSx'] + #Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + #allure.attach(name= body=str("Wifi Successfully Connected")) + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + #allure.attach(name= body=str("Wifi Successfully Connected without internet")) + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + #allure.attach(name=body=str("Wifi Successfully Connected")) + except: + try: + report.step_start("Unknown WIFI status found") + ssid_with_internet = False + print("Unknown WIFI status found") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + + + except NoSuchElementException: + print("No Switch element found") + #allure.attach(name= body=str("No Switch element found")) + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except NoSuchElementException: + print("Couldn't find wifi Button") + #allure.attach(name= body=str("Couldn't find wifi Button")) + # ------------------Open WIFI page---------------------------------- + + except NoSuchElementException: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + #allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) + # -----------------To Open Connections page--------------------------- + else: #--------------Pixel 4 code-------------------------- + report.step_start("Set Wifi Network to " + WifiName) + + # -----------------To Open Connections page----------------------- + try: + print("Verifying Connected Wifi Connection") + report.step_start("Click Network & internet in pixel4") + connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") + connElement.click() + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + time.sleep(3) + wifiElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) + wifiElement.click() + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='android:id/icon']") + get_switch_text = get_switch_text_element.click() + if get_switch_text is not None: + switch_text = "Off" + else: + switch_text = "On" + print("get_switch_text: ", switch_text) + print("Find wifi switch") + try: # To Turn on Wi-Fi Switch + if switch_text == "Off": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if switch_text == "On": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@text='Add network']") + get_switch_text = get_switch_text_element.text + if get_switch_text == "Add network": + switch_text = "On" + else: + switch_text = "Off" + except NoSuchElementException: + print("Exception: Verify Xpath") + # Scroll Down + scrollDown(setup_perfectoMobile) + print("Sleeping for: ", i) + time.sleep(i) + pass + if switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + # ---------------------This is to Forget current connected SSID------------------------------- + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath("//*[@text='Connected']") + try: # To forget existing ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + except: + print("Couldn't get into additional details") + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/button1']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + except: + print("No Connected SSIDS") + # ----------------------This is to Forget current connected SSID-------------------------------- + + time.sleep(2) + print("Selecting Wifi: " + WifiName) + # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ + try: + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + #allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + ssid_not_found = False + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scroll_up(setup_perfectoMobile) + time.sleep(2) + else: + ssid_not_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_not_found: + print("could not found " + WifiName + " in device") + # allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + # ------------------------------------------------------- + + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + # ------------------------------------------------------- + + # Set password if Needed + # ------------------------------------------------------- + try: + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Click on connect button + # ------------------------------------------------------- + try: + report.step_start("Click Connect Button") + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + print("Not able to verify the connected WiFi. Scrolling up.") + scroll_up(setup_perfectoMobile) + scroll_up(setup_perfectoMobile) + # check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + print("Verifying after scrolling") + scroll_up(setup_perfectoMobile) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + + + except NoSuchElementException: + print("No Switch element found") + # allure.attach(name= body=str("No Switch element found")) + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except NoSuchElementException: + print("Couldn't find wifi Button") + # allure.attach(name= body=str("Couldn't find wifi Button")) + # ------------------Open WIFI page---------------------------------- + + except NoSuchElementException: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) + # -----------------To Open Connections page--------------------------- + + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet + +#To disconnect and forget network +def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("WIFI Disconnect") + print("-------------------------------------") + #allure.attach(name= body=str("------------------- WIFI Disconnect ------------------")) + + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + report.step_start("Switching Driver Context") + print("Switching Context to Native") + contexts = driver.contexts + driver.switch_to.context(contexts[0]) + + # Open Settings Application + openApp(connData["appPackage-android"], setup_perfectoMobile) + deviceModelName = getDeviceModelName(setup_perfectoMobile) + print("Selected Device Model: " + deviceModelName) + + if deviceModelName != ("Pixel 4"): + report.step_start("Set Wifi Network to " + WifiName) + + + # -----------------To Open Connections page----------------------- + try: + print("Verifying Connected Wifi Connection") + report.step_start("Click Connections") + connElement = driver.find_element_by_xpath("//*[@text='Connections']") + connElement.click() + + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") + wifiElement.click() + + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + print("get_switch_text: ",get_switch_text) + print("Find wifi switch") + try: #To Turn on Wi-Fi Switch + if get_switch_text == "Off": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if get_switch_text == "On": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + except: + pass + print("Sleeping for: ", i) + time.sleep(i) + pass + if get_switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + + #---------------------This is to Forget current connected SSID------------------------------- + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + #allure.attach(name=body=str("Forget old ssid")) + except: + print("Couldn't forget ssid") + #allure.attach(name=body=str("Couldn't forget ssid")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + except: + #allure.attach(name=body=str("Couldn't get into additional details")) + print("Couldn't get into additional details") + except: + #allure.attach(name=body=str("No Connected SSIDS")) + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- + + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() + except: + print("couldn't click on wifi switch") + + + except NoSuchElementException: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except NoSuchElementException: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + + except NoSuchElementException: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- + else:#-----------------------Pixel4 code------------------------- + report.step_start("Set Wifi Network to " + WifiName) + + # -----------------To Open Connections page----------------------- + try: + print("Verifying Connected Wifi Connection") + report.step_start("Click Network & internet") + connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") + connElement.click() + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + time.sleep(3) + wifiElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) + wifiElement.click() + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='android:id/icon']") + get_switch_text = get_switch_text_element.click() + if get_switch_text is not None: + switch_text = "Off" + else: + switch_text = "On" + + print("get_switch_text: ", switch_text) + print("Find wifi switch") + try: # To Turn on Wi-Fi Switch + if switch_text == "Off": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if switch_text == "On": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@text='Add network']") + get_switch_text = get_switch_text_element.text + if get_switch_text == "Add network": + switch_text = "On" + else: + switch_text = "Off" + except NoSuchElementException: + print("Exception: Verify Xpath") + # Scroll Down + scrollDown(setup_perfectoMobile) + print("Sleeping for: ", i) + time.sleep(i) + pass + if switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + # ---------------------This is to Forget current connected SSID------------------------------- + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath("//*[@text='Connected']") + try: # To forget existing ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/button1']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + except: + #allure.attach(name=body=str("Couldn't get into additional details")) + print("Couldn't get into additional details") + except: + #allure.attach(name=body=str("No Connected SSIDS")) + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- + + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() + except: + print("couldn't click on wifi switch") + + + except NoSuchElementException: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except NoSuchElementException: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + + except NoSuchElementException: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + + closeApp(connData["appPackage-android"], setup_perfectoMobile) + + + +# try: +# elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") +# print("elements: ", elements) +# print(len(elements)) +# for i in range(len(elements)): +# print("elements[i]", elements[i]) +# print("elements[i].text", elements[i].text) +# except: +# print("No SSIDS available") +def get_all_available_ssids(driver, deviceModelName): + active_ssid_list = [] + print("Selected Device Model: " + deviceModelName) + if deviceModelName != ("Pixel 4"): + try: + time.sleep(8) + driver.implicitly_wait(10) + elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") + # print("elements: ", elements) + print(len(elements)) + for i in range(len(elements)): + # print("elements[i]", elements[i]) + # print("elements[i].text", elements[i].text) + active_ssid_list.append(elements[i].text) + except: + print("No SSIDS available") + else: + try: + time.sleep(8) + driver.implicitly_wait(10) + elements = driver.find_elements_by_xpath("//*[@resource-id='android:id/title']") + # print("elements: ", elements) + print(len(elements)) + for i in range(len(elements)): + # print("elements[i]", elements[i]) + # print("elements[i].text", elements[i].text) + try: + active_ssid_list.append(elements[i].text) + except: + print("Encountered a cache SSID which is no longer in the DOM.Moving to next SSID.") + except: + print("No SSIDS available") + return active_ssid_list + +def reportClient(value): + global reporting_client # declare a to be a global + reporting_client = value # this sets the global value of a + +# This is a functon to get all of the ssid details +# This function needs to be called from a standalone script and not throuh testcase +# def get_all_available_ssids(): +# from appium import webdriver +# driver = None +# reporting_client = None +# +# warnings.simplefilter("ignore", ResourceWarning) +# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) +# +# capabilities = { +# 'platformName': 'Android', +# 'model': 'Galaxy S9', +# 'browserName': 'mobileOS', +# # 'automationName' : 'Appium', +# 'securityToken': 'eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3NzkzZGM0Ni1jZmU4LTQ4ODMtYjhiOS02ZWFlZGU2OTc2MDkifQ.eyJpYXQiOjE2MjE4NjgyOTksImp0aSI6IjIzNGFiOTM1LWIxYjQtNGZiOC1hZmJiLTM0OTQwNzU5MjIwMyIsImlzcyI6Imh0dHBzOi8vYXV0aDIucGVyZmVjdG9tb2JpbGUuY29tL2F1dGgvcmVhbG1zL3RpcC1wZXJmZWN0b21vYmlsZS1jb20iLCJhdWQiOiJodHRwczovL2F1dGgyLnBlcmZlY3RvbW9iaWxlLmNvbS9hdXRoL3JlYWxtcy90aXAtcGVyZmVjdG9tb2JpbGUtY29tIiwic3ViIjoiN2I1MzBhZTAtODgxOC00N2I5LTgzZjMtN2ZhMGZiMGRkYjRlIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6Im9mZmxpbmUtdG9rZW4tZ2VuZXJhdG9yIiwibm9uY2UiOiI1MzI2NDQxNS0xYTQwLTQ1ZTctOGVkMi1hOTNiYWZmZWNjYjIiLCJzZXNzaW9uX3N0YXRlIjoiY2YzY2JlOGMtY2Y5OC00NzRlLWJmODctYTIxNzU0NzVhM2EzIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBvZmZsaW5lX2FjY2VzcyBlbWFpbCJ9.4a4v6AKxmY95Zb-l84K_Od49WPikwOHP7ryctfmnn-w', +# 'useAppiumForWeb': 'false', +# 'useAppiumForHybrid': 'false', +# # 'bundleId' : request.config.getini("appPackage-android"), +# } +# +# app_data = { +# "webURL": "https://www.google.com", +# "lblSearch": "//*[@class='gLFyf']", +# "elelSearch": "(//*[@class='sbic sb43'])[1]", +# "BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']", +# "bundleId-iOS-Settings": 'com.apple.Preferences', +# "bundleId-iOS-Safari": 'com.apple.mobilesafari', +# "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", +# "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", +# # Android +# "platformName-android": 'Android', +# "appPackage-android": 'com.android.settings' +# } +# +# driver = webdriver.Remote( +# "https://tip.perfectomobile.com/nexperience/perfectomobile/wd/hub", +# capabilities +# ) +# +# try: +# print(driver) +# driver.implicitly_wait(35) +# #Driver Ends here +# +# projectname = "TIP-PyTest-Execution" +# projectversion = 1.0 +# jobname = "tip-sushant-android" +# jobnumber = 2 +# tags = "TestTag" +# testCaseName = "getting_ssids" +# +# # print("\nSetting Perfecto ReportClient....") +# perfecto_execution_context = PerfectoExecutionContext(driver, tags, Job(jobname, jobnumber), +# Project(projectname, projectversion)) +# reporting_client = PerfectoReportiumClient(perfecto_execution_context) +# reporting_client.test_start(testCaseName, TestContext([], "Perforce")) +# reportClient(reporting_client) +# +# +# setup_perfectoMobile = (driver, reporting_client) +# print("setup_perfectoMobile_android: ", setup_perfectoMobile) +# print(type(setup_perfectoMobile)) +# +# print("\n-------------------------------------") +# print("Select Wifi/AccessPoint Connection") +# print("-------------------------------------") +# print("Verifying Wifi Connection Details....") +# report = setup_perfectoMobile[1] +# driver = setup_perfectoMobile[0] +# +# +# +# ip_address_element_text = False +# ssid_with_internet = False +# ssid_list = [] +# +# report.step_start("Switching Driver Context") +# print("Switching Context to Native") +# contexts = driver.contexts +# print("contexts", contexts) +# driver.switch_to.context(contexts[0]) +# print("1508") +# +# # Open Settings Application +# openApp(app_data["appPackage-android"], setup_perfectoMobile) +# +# deviceModelName = driver.execute_script('mobile:handset:info', {'property': 'model'}) +# +# # deviceModelName = getDeviceModelName(setup_perfectoMobile) +# print("Selected Device Model: " + deviceModelName) +# +# if deviceModelName != ("Pixel 4"): +# # -----------------To Open Connections page----------------------- +# try: +# print("Verifying Connected Wifi Connection") +# report.step_start("Click Connections") +# connElement = driver.find_element_by_xpath("//*[@text='Connections']") +# connElement.click() +# +# # ---------------------Open WIFI page------------------------------- +# try: +# report.step_start("Clicking Wi-Fi") +# print("Clicking WIFI") +# wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") +# wifiElement.click() +# +# # --------------------To Turn on WIFi Switch if already OFF-------------------------------- +# try: +# driver.implicitly_wait(1) +# get_switch_text_element = driver.find_element_by_xpath( +# "//*[@resource-id='com.android.settings:id/switch_text']") +# get_switch_text = get_switch_text_element.text +# print("get_switch_text: ", get_switch_text) +# # print("Find wifi switch") +# try: # To Turn on Wi-Fi Switch +# if get_switch_text == "Off": +# # driver.implicitly_wait(3) +# get_switch_element = driver.find_element_by_xpath( +# "//*[@resource-id='com.android.settings:id/switch_widget']") +# # driver.implicitly_wait(1) +# get_switch_element.click() +# driver.implicitly_wait(1) +# i = 0 +# for i in range(5): +# if get_switch_text == "On": +# print("WIFI Switch is ON") +# break +# else: +# try: +# get_switch_text_element = driver.find_element_by_xpath( +# "//*[@resource-id='com.android.settings:id/switch_text']") +# get_switch_text = get_switch_text_element.text +# except: +# pass +# print("Sleeping for: ", i) +# time.sleep(i) +# pass +# if get_switch_text == "Off": +# print("Switch is Still OFF") +# closeApp(app_data["appPackage-android"], setup_perfectoMobile) +# close_driver(driver) +# return ip_address_element_text +# else: +# print("Switch is already On") +# check_if_no_internet_popup(driver) +# except: +# print("Couldn't turn on WIFI sewitch") +# closeApp(app_data["appPackage-android"], setup_perfectoMobile) # close_driver(driver) # return ip_address_element_text # @@ -2951,7 +3730,856 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report = setup_perfectoMobile[1] driver = setup_perfectoMobile[0] - ip_address_element_text = False + ip_address_element_text = False + ssid_with_internet = False + + report.step_start("Switching Driver Context") + print("Switching Context to Native") + contexts = driver.contexts + driver.switch_to.context(contexts[0]) + + # Open Settings Application + openApp(connData["appPackage-android"], setup_perfectoMobile) + deviceModelName = getDeviceModelName(setup_perfectoMobile) + print("Selected Device Model: " + deviceModelName) + + if deviceModelName != ("Pixel 4"): + report.step_start("Set Wifi Network to " + WifiName) + + + # -----------------To Open Connections page----------------------- + try: + print("Verifying Connected Wifi Connection") + report.step_start("Click Connections") + connElement = driver.find_element_by_xpath("//*[@text='Connections']") + connElement.click() + + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + time.sleep(3) + wifiElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH,"//*[@text='Wi-Fi']"))) + wifiElement.click() + + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + print("get_switch_text: ",get_switch_text) + print("Find wifi switch") + try: #To Turn on Wi-Fi Switch + if get_switch_text == "Off": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if get_switch_text == "On": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text = get_switch_text_element.text + except: + pass + print("Sleeping for: ", i) + time.sleep(i) + pass + if get_switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + + #---------------------This is to Forget current connected SSID------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + else: + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + try: #To forget exhisting ssid + print("To forget ssid in osversion 12") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() + try: + print("To forget ssid in os version 12") + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- + + time.sleep(2) + print("Selecting Wifi: " + WifiName) + #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + #This is To get all available ssids + #------------------------------------------------------ + try: + for k in range(10): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName+" : Found in Device") + #allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + print("could not found " + WifiName + " in device") + #allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + #------------------------------------------------------- + + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + print("Selecting Wifi") + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Set username + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Set User name") + print("Set User name") + wifiUserElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) + wifiUserElement.send_keys(User) + except NoSuchElementException: + print("User name not Loaded") + # ------------------------------------------------------- + + # Set Password + # ------------------------------------------------------- + try: + # driver.implicitly_wait(6) + report.step_start("Set Password") + print("Set Password") + wifiPasswordElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Enter password']"))) + wifiPasswordElement.send_keys(ttls_passwd) + print("Entered Password") + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + # ------------------------------------------------------- + # Selecting certificate + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Selecting CA Cert") + print("Selecting CA Cert") + certElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Select certificate']"))) + certElement.click() + except NoSuchElementException: + print("Selecting certificate failed") + # ------------------------------------------------------- + # Validating certificate + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Validting CA Cert") + print("Validting CA Cert") + certElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text=\"Don't validate\"]"))) + certElement.click() + except NoSuchElementException: + print("validation failed") + # ------------------------------------------------------- + if (deviceModelName == "Galaxy S9"): + driver.hide_keyboard() + print("Hide keyboard") + # Click on connect button + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Click Connect Button") + print("Click Connect Button") + joinBTNElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']"))) + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + #Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Get into Additional Details + # To Get an IP Address + # To Forget connection + # To turn off auto. connect + # ------------------------------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, + search_this="osVersion") != "12": + try: + print("Into additional details") + time.sleep(2) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + # allure.attach(name= body=str("IP address element not found")) + # --------------------Added for ssid security check-------------------------- + try: + time.sleep(2) + security_name_element = driver.find_element_by_xpath( + "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + security_name_element_text = security_name_element.text + print("Ssid security is :", security_name_element_text) + allure.attach(name="Ssid Security:", body=str(security_name_element_text)) + except: + print("Security is not available") + # --------------------Added for ssid Name check-------------------------- + try: + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + try: + check_if_no_internet_popup(driver) + driver.implicitly_wait(3) + time.sleep(2) + auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off_text = auto_reconnect_off.text + if auto_reconnect_off_text != "Off": + auto_reconnect_off.click() + print("Auto reconnect turning off") + else: + print("Auto reconnect is already off") + except: + print("Couldn't find auto reconnect element") + + # ------------------------------- Forget SSID ---------------- + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + else: + try: + print("Into additional details") + time.sleep(2) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() + + try: + print("click on view more") + additional_details_element = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']"))) + additional_details_element.click() + except: + pass + + try: + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") + pass + + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + ip_address_element_text = "SSID Match, S20 Does Not support scrolling" + ssid_with_internet = "SSID Match, S20 Does Not support scrolling" + # return ip_address_element_text, ssid_with_internet + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + + report.step_start("Scrolling for ip address - 1") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + + report.step_start("Scrolling for ip address - 2") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + + report.step_start("Scrolling for ip address - 3") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + report.step_start("looking for ip address") + + try: + ip_address_element_text = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + ip_address_element_text = ip_address_element_text.text + ssid_with_internet = True + except: + pass + + report.step_start("Forget SSID") + + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@text='Forget']") + forget_ssid.click() + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + + # ------------------------------------------------------- + except: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + + except: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- + else: #--------------------Pixel code----------------------------------- + report.step_start("Set Wifi Network to " + WifiName) + + # -----------------To Open Connections page----------------------- + try: + print("Verifying Connected Wifi Connection in Pixel") + report.step_start("Click Network & internet in pixel4") + conn_element = driver.find_element_by_xpath("//*[@text='Network & internet']") + conn_element.click() + + # ---------------------Open WIFI page------------------------------- + try: + report.step_start("Clicking Wi-Fi") + print("Clicking WIFI") + time.sleep(3) + wifi_element = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) + wifi_element.click() + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + driver.implicitly_wait(1) + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_text = get_switch_text_element.text + # if get_switch_text is not None: + # switch_text = "OFF" + # else: + # switch_text = "ON" + switch_text = get_switch_text + print("get_switch_text: ", switch_text) + print("Find wifi switch") + try: # To Turn on Wi-Fi Switch + if switch_text == "OFF": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if switch_text == "ON": + print("WIFI Switch is ON") + break + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@text='Add network']") + get_switch_text = get_switch_text_element.text + if get_switch_text == "Add network": + switch_text = "ON" + else: + switch_text = "OFF" + except NoSuchElementException: + print("Exception: Verify Xpath") + # Scroll Down + scrollDown(setup_perfectoMobile) + print("Sleeping for: ", i) + time.sleep(i) + pass + if switch_text == "OFF": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) + except: + print("Couldn't turn on WIFI switch") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + + # ---------------------This is to Forget current connected SSID------------------------------- + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath("//*[@text='Connected']") + try: # To forget existing ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + except: + print("Couldn't get into additional details") + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/button1']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("No Connected SSIDS") + # ----------------------This is to Forget current connected SSID-------------------------------- + + time.sleep(2) + print("Selecting Wifi: " + WifiName) + # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ + try: + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + ssid_not_found = False + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scroll_up(setup_perfectoMobile) + time.sleep(2) + else: + ssid_not_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_not_found: + print("could not found " + WifiName + " in device") + # allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + # ------------------------------------------------------- + + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifi_selection_element = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifi_selection_element.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + # ------------------------------------------------------- + # Selecting certificate + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Selecting CA Cert") + print("Selecting certificate") + cert_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/ca_cert']") + cert_element.click() + except NoSuchElementException: + print("Selecting certificate failed") + # ------------------------------------------------------- + # Validating certificate + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Validting CA Cert") + print("validation") + cert_element = driver.find_element_by_xpath( + "//*[@text='Do not validate']") + cert_element.click() + except NoSuchElementException: + print("validation failed") + # Set username + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Set User name") + print("Set User name") + wifi_user_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/identity']") + wifi_user_element.send_keys(User) + except NoSuchElementException: + print("User name not Loaded") + # ------------------------------------------------------- + # Scroll Down + scroll_down_pixel(setup_perfectoMobile) + time.sleep(2) + # Set Password + # ------------------------------------------------------- + try: + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + print("Entering password") + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement.send_keys(ttls_passwd) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + + # ------------------------------------------------------- + + # Click on connect button + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Click Connect Button") + print("Click Connect Button") + join_element = driver.find_element_by_xpath("//*[@text='Connect']") + join_element.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + print("Not able to verify the connected WiFi. Scrolling up.") + scroll_up(setup_perfectoMobile) + scroll_up(setup_perfectoMobile) + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + scroll_up(setup_perfectoMobile) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Get into Additional Details + # To Get an IP Address + # To Forget connection + # To turn off auto. connect + # ------------------------------------------------------- + try: + print("Into additional details") + time.sleep(5) + report.step_start("Going for ip address") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + print("Entered ssid") + try: + time.sleep(10) + print("clicking Advanced") + report.step_start("clicking Advanced") + advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']") + advanced_element.click() + print("clicked Advanced") + #print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + advanced_element.click() + #print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + advanced_element.click() + except: + print("No advanced options") + # allure.attach(name= body=str("IP address element not found")) + + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + # Scroll Down + scrollDown(setup_perfectoMobile) + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + #------------------------------- Forget SSID ---------------- + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + forget_ssid.click() + print("Forgetting ssid") + #------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("Couldn't forget ssid") + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + except: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + + except: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet +#only to connect to wifi +def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("Select Wifi/AccessPoint Connection") + print("-------------------------------------") + print("Verifying Wifi Connection Details....") + #allure.attach(name= body=str("\n-------------------------------------")) + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + ssid_with_internet = False report.step_start("Switching Driver Context") @@ -2963,7 +4591,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM openApp(connData["appPackage-android"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) - + #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) if deviceModelName != ("Pixel 4"): report.step_start("Set Wifi Network to " + WifiName) @@ -2980,9 +4608,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") - time.sleep(3) - wifiElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH,"//*[@text='Wi-Fi']"))) + wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") wifiElement.click() @@ -3018,101 +4644,75 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM if get_switch_text == "Off": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- - if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": - try: #To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: #To forget exhisting ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - except: - print("Couldn't get into additional details") - except: - print("No Connected SSIDS") - else: - try: #To deal with already connected SSID + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") - try: #To forget exhisting ssid - print("To forget ssid in osversion 12") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") - additional_details_element.click() - try: - print("To forget ssid in os version 12") - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") except: - print("Couldn't get into additional details") + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ssid_with_internet except: - print("No Connected SSIDS") + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") #----------------------This is to Forget current connected SSID-------------------------------- + + print("Searching for Wifi: " + WifiName) + #allure.attach(name= body=str("Searching for Wifi: " + WifiName)) time.sleep(2) print("Selecting Wifi: " + WifiName) - #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) ssid_found = False available_ssids = False - #This is To get all available ssids - #------------------------------------------------------ + # This is To get all available ssids + # ------------------------------------------------------ try: - for k in range(10): + for check_for_all_ssids in range(2): available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) try: if WifiName not in available_ssids: scrollDown(setup_perfectoMobile) time.sleep(2) else: ssid_found = True - print(WifiName+" : Found in Device") - #allure.attach(name= body=str(WifiName+" : Found in Device")) + print(WifiName + " : Found in Device") + #allure.attach(name= body=str(WifiName + " : Found in Device")) break except: - print("couldn't find wifi in available ssid") + print("1538") + pass if not ssid_found: - print("could not found " + WifiName + " in device") + print("could not found" + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet except: closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - #------------------------------------------------------- + return ssid_with_internet + # ------------------------------------------------------- # Selecting WIFI # ------------------------------------------------------- @@ -3127,17 +4727,17 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet # ------------------------------------------------------- # Set username # ------------------------------------------------------- try: - # driver.implicitly_wait(3) + driver.implicitly_wait(3) report.step_start("Set User name") print("Set User name") - wifiUserElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) + wifiUserElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/edittext' and @password='false']") wifiUserElement.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -3146,11 +4746,11 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # Set Password # ------------------------------------------------------- try: - # driver.implicitly_wait(6) + driver.implicitly_wait(6) report.step_start("Set Password") print("Set Password") - wifiPasswordElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Enter password']"))) + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@text='Enter password']") wifiPasswordElement.send_keys(ttls_passwd) print("Entered Password") except NoSuchElementException: @@ -3159,287 +4759,96 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # Selecting certificate # ------------------------------------------------------- try: - # driver.implicitly_wait(3) - report.step_start("Selecting CA Cert") - print("Selecting CA Cert") - certElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Select certificate']"))) - certElement.click() - except NoSuchElementException: - print("Selecting certificate failed") - # ------------------------------------------------------- - # Validating certificate - # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Validting CA Cert") - print("Validting CA Cert") - certElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text=\"Don't validate\"]"))) - certElement.click() - except NoSuchElementException: - print("validation failed") - # ------------------------------------------------------- - if (deviceModelName == "Galaxy S9"): - driver.hide_keyboard() - print("Hide keyboard") - # Click on connect button - # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Click Connect Button") - print("Click Connect Button") - joinBTNElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']"))) - joinBTNElement.click() - except NoSuchElementException: - print("Connect Button Not Enabled...Verify if Password is set properly ") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- - - #Verify if WiFi is connected - # ------------------------------------------------------- - try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - # time.sleep(5) - check_if_no_internet_popup(driver) - except: - try: - check_if_no_internet_popup(driver) - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" - + WifiName + "']"))) - print("Wifi Successfully Connected without internet") - check_if_no_internet_popup(driver) - except: - try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - except NoSuchElementException: - print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- - - # Get into Additional Details - # To Get an IP Address - # To Forget connection - # To turn off auto. connect - # ------------------------------------------------------- - if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, - search_this="osVersion") != "12": - try: - print("Into additional details") - time.sleep(2) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() - try: - time.sleep(2) - ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") - ip_address_element_text = ip_address_element.text - print("Device IP address is :", ip_address_element_text) - except: - try: - time.sleep(2) - ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") - ip_address_element_text = ip_address_element.text - print("Device IP address is :", ip_address_element_text) - except: - print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - assert False - # allure.attach(name= body=str("IP address element not found")) - # --------------------Added for ssid security check-------------------------- - try: - time.sleep(2) - security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") - security_name_element_text = security_name_element.text - print("Ssid security is :", security_name_element_text) - allure.attach(name="Ssid Security:", body=str(security_name_element_text)) - except: - print("Security is not available") - # --------------------Added for ssid Name check-------------------------- - try: - time.sleep(2) - ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") - ssid_name_element_text = ssid_name_element.text - print("Ssid Name is :", ssid_name_element_text) - allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) - except: - print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - assert False - if (ssid_name_element_text == WifiName): - print("Wifi is connected to the expected ssid") - else: - print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - assert False - try: - check_if_no_internet_popup(driver) - driver.implicitly_wait(3) - time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") - auto_reconnect_off_text = auto_reconnect_off.text - if auto_reconnect_off_text != "Off": - auto_reconnect_off.click() - print("Auto reconnect turning off") - else: - print("Auto reconnect is already off") - except: - print("Couldn't find auto reconnect element") - - # ------------------------------- Forget SSID ---------------- - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet - except: - print("Couldn't get into Additional settings") - # ------------------------------------------------------- - else: - try: - print("Into additional details") - time.sleep(2) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") - additional_details_element.click() - - try: - print("click on view more") - additional_details_element = WebDriverWait(driver, 50).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']"))) - additional_details_element.click() - except: - pass - - try: - time.sleep(2) - ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") - ssid_name_element_text = ssid_name_element.text - print("Ssid Name is :", ssid_name_element_text) - allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) - except: - print("Ssid name not available") - pass - - if (ssid_name_element_text == WifiName): - print("Wifi is connected to the expected ssid") - ip_address_element_text = "SSID Match, S20 Does Not support scrolling" - ssid_with_internet = "SSID Match, S20 Does Not support scrolling" - # return ip_address_element_text, ssid_with_internet - else: - print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - - report.step_start("Scrolling for ip address - 1") - # if deviceModelName == "Galaxy S20": - # print("Scrolling for S20") - driver.swipe(470, 1400, 470, 1000, 400) - # else: - # scrollDown(setup_perfectoMobile) - - report.step_start("Scrolling for ip address - 2") - # if deviceModelName == "Galaxy S20": - # print("Scrolling for S20") - driver.swipe(470, 1400, 470, 1000, 400) - # else: - # scrollDown(setup_perfectoMobile) + driver.implicitly_wait(3) + report.step_start("Selecting CA Cert") + certElement = driver.find_element_by_xpath( + "//*[@text='Select certificate']") + certElement.click() + except NoSuchElementException: + print("Selecting certificate failed") + # ------------------------------------------------------- + # Validating certificate + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Validting CA Cert") + certElement = driver.find_element_by_xpath( + "//*[@text=\"Don't validate\"]") + certElement.click() + except NoSuchElementException: + print("validation failed") + # ------------------------------------------------------- - report.step_start("Scrolling for ip address - 3") - # if deviceModelName == "Galaxy S20": - # print("Scrolling for S20") - driver.swipe(470, 1400, 470, 1000, 400) - # else: - # scrollDown(setup_perfectoMobile) - report.step_start("looking for ip address") + # Click on connect button + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Click Connect Button") + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + #Verify if WiFi is connected + # ------------------------------------------------------- + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + #allure.attach(name= body=str("Wifi Successfully Connected")) + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + #allure.attach(name= body=str("Wifi Successfully Connected without internet")) + check_if_no_internet_popup(driver) + except: try: - ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") - ip_address_element_text = ip_address_element_text.text + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True - except: - pass - - report.step_start("Forget SSID") - - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@text='Forget']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") + print("Wifi Successfully Connected") + #allure.attach(name=body=str("Wifi Successfully Connected")) + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - except: - print("Couldn't get into Additional settings") - # ------------------------------------------------------- + return ssid_with_internet - # ------------------------------------------------------- - except: + + except NoSuchElementException: print("No Switch element found") + #allure.attach(name= body=str("No Switch element found")) # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except: + except NoSuchElementException: print("Couldn't find wifi Button") + #allure.attach(name= body=str("Couldn't find wifi Button")) # ------------------Open WIFI page---------------------------------- - except: + except NoSuchElementException: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + #allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- - else: #--------------------Pixel code----------------------------------- + else: #--------------Pixel 4 code-------------------------- report.step_start("Set Wifi Network to " + WifiName) # -----------------To Open Connections page----------------------- try: - print("Verifying Connected Wifi Connection in Pixel") + print("Verifying Connected Wifi Connection") report.step_start("Click Network & internet in pixel4") conn_element = driver.find_element_by_xpath("//*[@text='Network & internet']") conn_element.click() @@ -3498,14 +4907,14 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM if switch_text == "OFF": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- try: # To deal with already connected SSID @@ -3528,7 +4937,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM except: print("Couldn't forget ssid") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet except: print("No Connected SSIDS") # ----------------------This is to Forget current connected SSID-------------------------------- @@ -3577,11 +4986,10 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return ssid_with_internet except: closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- + return ssid_with_internet # ------------------------------------------------------- # Selecting WIFI @@ -3596,15 +5004,13 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- + return ssid_with_internet # ------------------------------------------------------- # Selecting certificate # ------------------------------------------------------- try: driver.implicitly_wait(3) report.step_start("Selecting CA Cert") - print("Selecting certificate") cert_element = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/ca_cert']") cert_element.click() @@ -3616,7 +5022,6 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: driver.implicitly_wait(3) report.step_start("Validting CA Cert") - print("validation") cert_element = driver.find_element_by_xpath( "//*[@text='Do not validate']") cert_element.click() @@ -3640,15 +5045,15 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # Set Password # ------------------------------------------------------- try: - check_if_no_internet_popup(driver) - report.step_start("Set Wifi Password") - print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath( + driver.implicitly_wait(6) + report.step_start("Set Password") + print("Set Password") + wifi_password_element = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/password']") - wifiPasswordElement.send_keys(ttls_passwd) + wifi_password_element.send_keys(ttls_passwd) + print("Entered Password") except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") - check_if_no_internet_popup(driver) # ------------------------------------------------------- @@ -3657,7 +5062,6 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: driver.implicitly_wait(3) report.step_start("Click Connect Button") - print("Click Connect Button") join_element = driver.find_element_by_xpath("//*[@text='Connect']") join_element.click() except NoSuchElementException: @@ -3681,15 +5085,16 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Not able to verify the connected WiFi. Scrolling up.") scroll_up(setup_perfectoMobile) scroll_up(setup_perfectoMobile) - check_if_no_internet_popup(driver) + # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: try: report.step_start("Verify if Wifi is Connected") + print("Verifying after scrolling") scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, @@ -3699,100 +5104,28 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM except NoSuchElementException: print("Wifi Connection Error: " + WifiName) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- + return ssid_with_internet - # Get into Additional Details - # To Get an IP Address - # To Forget connection - # To turn off auto. connect - # ------------------------------------------------------- - try: - print("Into additional details") - time.sleep(5) - report.step_start("Going for ip address") - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - additional_details_element.click() - print("Entered ssid") - try: - time.sleep(10) - print("clicking Advanced") - report.step_start("clicking Advanced") - advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']") - advanced_element.click() - print("clicked Advanced") - #print("Device IP address is :", ip_address_element_text) - except: - try: - time.sleep(5) - print("clicking Advanced2") - advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") - advanced_element.click() - #print("Device IP address is :", ip_address_element_text) - except: - try: - time.sleep(5) - print("clicking Advanced2") - advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") - advanced_element.click() - except: - print("No advanced options") - # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet - # Scroll Down - scrollDown(setup_perfectoMobile) - try: - time.sleep(2) - ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") - ip_address_element_text = ip_address_element.text - print("Device IP address is :", ip_address_element_text) - except: - print("IP address element not found") - #------------------------------- Forget SSID ---------------- - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - forget_ssid.click() - print("Forgetting ssid") - #------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet - except: - print("Couldn't forget ssid") - except: - print("Couldn't get into Additional settings") - # ------------------------------------------------------- - except: + except NoSuchElementException: print("No Switch element found") + # allure.attach(name= body=str("No Switch element found")) # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except: + except NoSuchElementException: print("Couldn't find wifi Button") + # allure.attach(name= body=str("Couldn't find wifi Button")) # ------------------Open WIFI page---------------------------------- - except: + except NoSuchElementException: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- + closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet -#only to connect to wifi -def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): + return ssid_with_internet +#--------------------CAPTIVE PORTAL Android----------------------------------------- +def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") @@ -3801,6 +5134,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report = setup_perfectoMobile[1] driver = setup_perfectoMobile[0] + ip_address_element_text = False ssid_with_internet = False report.step_start("Switching Driver Context") @@ -3813,10 +5147,10 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) + if deviceModelName != ("Pixel 4"): report.step_start("Set Wifi Network to " + WifiName) - # -----------------To Open Connections page----------------------- try: print("Verifying Connected Wifi Connection") @@ -3824,26 +5158,28 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connElement = driver.find_element_by_xpath("//*[@text='Connections']") connElement.click() - # ---------------------Open WIFI page------------------------------- try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") - wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']") + time.sleep(3) + wifiElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi-Fi']"))) wifiElement.click() - # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_text']") get_switch_text = get_switch_text_element.text - print("get_switch_text: ",get_switch_text) + print("get_switch_text: ", get_switch_text) print("Find wifi switch") - try: #To Turn on Wi-Fi Switch + try: # To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -3865,223 +5201,474 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, if get_switch_text == "Off": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet - #---------------------This is to Forget current connected SSID------------------------------- - try: #To deal with already connected SSID + # ---------------------This is to Forget current connected SSID------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, + search_this="osVersion") != "12": + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: # To forget exhisting ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + else: + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + try: # To forget exhisting ssid + print("To forget ssid in osversion 12") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() + try: + print("To forget ssid in osversion 12-1206") + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + # ----------------------This is to Forget current connected SSID-------------------------------- + + # time.sleep(2) + print("Selecting Wifi: " + WifiName) + # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ + try: + for k in range(9): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + print("could not found " + WifiName + " in device") + # allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + print(("Clicking WIFI")) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: #To forget exhisting ssid - print("To forget ssid") + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Set password if Needed + # ------------------------------------------------------- + try: + check_if_no_internet_popup(driver) + time.sleep(3) + report.step_start("Set Wifi Password") + print("Set Wifi password") + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Click on connect button + # ------------------------------------------------------- + try: + time.sleep(5) + report.step_start("Click Connect Button") + print("Click Connect") + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + #---------------------Clicking on ssid for captive portal login-------- + try: + time.sleep(2) + report.step_start("Selecting Wifi: " + WifiName) + wifi_selection_element = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifi_selection_element.click() + except NoSuchElementException: + print("Not connected to Captive portal Ssid.. ") + try: + time.sleep(2) + report.step_start("Click Accept Terms Button") + print("Click Accept Terms Button") + join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't press Accept terms button") + try: + time.sleep(2) + report.step_start("Click Continue Button") + print("Click Continue Button") + join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't press Continue button") + try: + time.sleep(2) + report.step_start("Click Last Terms if needed") + print("Click Last Terms if needed") + join_btn_element = driver.find_element_by_xpath("//*[@text='Done']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't find the last terms page") + + + # Verify if WiFi is connected + # ------------------------------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, + search_this="osVersion") != "12": + try: + report.step_start("Verify if Wifi is Connected") + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + # time.sleep(5) + check_if_no_internet_popup(driver) + except: + try: + check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected - 2") + WifiInternetErrMsg = WebDriverWait(driver, 60).until( + EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + else: + try: + report.step_start( + "Verifying wifi connection status connected/connected without internet") check_if_no_internet_popup(driver) + check_if_no_internet_popup(driver) + + wifi_connection_name = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + ))) + if wifi_connection_name.text == WifiName: + wifi_connection_status = WebDriverWait(driver, 50).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary']" + ))) + if wifi_connection_status.text == "Connected": + ssid_with_internet = True + print("Connected with internet") + + else: + ssid_with_internet = False + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + # Go into additional details here + else: + # Connected to some other wifi, makes sense to close app and fail this testcase + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + # Get into Additional Details + # To Get an IP Address + # To Forget connection + # To turn off auto. connect + # ------------------------------------------------------- + # ------------------------------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, + search_this="osVersion") != "12": + try: + print("Into additional details") + time.sleep(2) additional_details_element = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/layout_details']") additional_details_element.click() + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + # allure.attach(name= body=str("IP address element not found")) + # --------------------Added for ssid security check-------------------------- + try: + time.sleep(2) + security_name_element = driver.find_element_by_xpath( + "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + security_name_element_text = security_name_element.text + print("Ssid security is :", security_name_element_text) + allure.attach(name="Ssid Security:", body=str(security_name_element_text)) + except: + print("Security is not available") + # --------------------Added for ssid Name check-------------------------- + try: + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + assert False + try: + check_if_no_internet_popup(driver) + driver.implicitly_wait(3) + time.sleep(2) + auto_reconnect_off = driver.find( + "//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off_text = auto_reconnect_off.text + if auto_reconnect_off_text != "Off": + auto_reconnect_off.click() + print("Auto reconnect turning off") + else: + print("Auto reconnect is already off") + except: + print("Couldn't find auto reconnect element") + + # ------------------------------- Forget SSID ---------------- try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") forget_ssid.click() - print("Forget old ssid") + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet except: - print("Couldn't get into additional details") - except: - print("No Connected SSIDS") - #----------------------This is to Forget current connected SSID-------------------------------- - + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + else: + try: + print("Into additional details") + time.sleep(2) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() - print("Searching for Wifi: " + WifiName) - #allure.attach(name= body=str("Searching for Wifi: " + WifiName)) - time.sleep(2) - print("Selecting Wifi: " + WifiName) - ssid_found = False - available_ssids = False - # This is To get all available ssids - # ------------------------------------------------------ - try: - for check_for_all_ssids in range(2): - available_ssids = get_all_available_ssids(driver, deviceModelName) try: - if WifiName not in available_ssids: - scrollDown(setup_perfectoMobile) - time.sleep(2) - else: - ssid_found = True - print(WifiName + " : Found in Device") - #allure.attach(name= body=str(WifiName + " : Found in Device")) - break + print("click on view more") + additional_details_element = WebDriverWait(driver, 50).until( + EC.presence_of_element_located( + (MobileBy.XPATH, "//*[@text='View more']"))) + additional_details_element.click() except: - print("1538") pass - if not ssid_found: - print("could not found" + WifiName + " in device") - #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- - # Selecting WIFI - # ------------------------------------------------------- - try: - report.step_start("Selecting Wifi: " + WifiName) - print("Selecting Wifi") - wifiSelectionElement = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifiSelectionElement.click() - check_if_no_internet_popup(driver) - except Exception as e: - print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- + try: + time.sleep(2) + ssid_name_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/entity_header_title']") + ssid_name_element_text = ssid_name_element.text + print("Ssid Name is :", ssid_name_element_text) + allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) + except: + print("Ssid name not available") + pass - # Set username - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Set User name") - print("Set User name") - wifiUserElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext' and @password='false']") - wifiUserElement.send_keys(User) - except NoSuchElementException: - print("User name not Loaded") - # ------------------------------------------------------- + if (ssid_name_element_text == WifiName): + print("Wifi is connected to the expected ssid") + ip_address_element_text = "SSID Match, S20 Does Not support scrolling" + ssid_with_internet = "SSID Match, S20 Does Not support scrolling" + # return ip_address_element_text, ssid_with_internet + else: + print("Wifi is not connected to the expected ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) - # Set Password - # ------------------------------------------------------- - try: - driver.implicitly_wait(6) - report.step_start("Set Password") - print("Set Password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@text='Enter password']") - wifiPasswordElement.send_keys(ttls_passwd) - print("Entered Password") - except NoSuchElementException: - print("Password Page Not Loaded, password May be cached in the System") - # ------------------------------------------------------- - # Selecting certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Selecting CA Cert") - certElement = driver.find_element_by_xpath( - "//*[@text='Select certificate']") - certElement.click() - except NoSuchElementException: - print("Selecting certificate failed") - # ------------------------------------------------------- - # Validating certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Validting CA Cert") - certElement = driver.find_element_by_xpath( - "//*[@text=\"Don't validate\"]") - certElement.click() - except NoSuchElementException: - print("validation failed") - # ------------------------------------------------------- + report.step_start("Scrolling for ip address - 1") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) - # Click on connect button - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Click Connect Button") - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") - joinBTNElement.click() - except NoSuchElementException: - print("Connect Button Not Enabled...Verify if Password is set properly ") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- + report.step_start("Scrolling for ip address - 2") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + + report.step_start("Scrolling for ip address - 3") + # if deviceModelName == "Galaxy S20": + # print("Scrolling for S20") + driver.swipe(470, 1400, 470, 1000, 400) + # else: + # scrollDown(setup_perfectoMobile) + report.step_start("looking for ip address") - #Verify if WiFi is connected - # ------------------------------------------------------- - try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - #allure.attach(name= body=str("Wifi Successfully Connected")) - # time.sleep(5) - check_if_no_internet_popup(driver) - except: - try: - check_if_no_internet_popup(driver) - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" - + WifiName + "']"))) - print("Wifi Successfully Connected without internet") - #allure.attach(name= body=str("Wifi Successfully Connected without internet")) - check_if_no_internet_popup(driver) - except: try: - report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ip_address_element_text = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + ip_address_element_text = ip_address_element_text.text ssid_with_internet = True - print("Wifi Successfully Connected") - #allure.attach(name=body=str("Wifi Successfully Connected")) - except NoSuchElementException: - print("Wifi Connection Error: " + WifiName) - #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + except: + print("Unable to get IP address") + pass + report.step_start("Forget SSID") - except NoSuchElementException: + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@text='Forget']") + forget_ssid.click() + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + + # ------------------------------------------------------- + except: print("No Switch element found") - #allure.attach(name= body=str("No Switch element found")) # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except NoSuchElementException: + except: print("Couldn't find wifi Button") - #allure.attach(name= body=str("Couldn't find wifi Button")) # ------------------Open WIFI page---------------------------------- - except NoSuchElementException: + except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - #allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- - else: #--------------Pixel 4 code-------------------------- + # --------------------Pixel 4 code--------------------------- + else: report.step_start("Set Wifi Network to " + WifiName) # -----------------To Open Connections page----------------------- try: print("Verifying Connected Wifi Connection") report.step_start("Click Network & internet in pixel4") - conn_element = driver.find_element_by_xpath("//*[@text='Network & internet']") - conn_element.click() + connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") + connElement.click() # ---------------------Open WIFI page------------------------------- try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") time.sleep(3) - wifi_element = WebDriverWait(driver, 10).until( + wifiElement = WebDriverWait(driver, 10).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) - wifi_element.click() + wifiElement.click() # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: @@ -4128,14 +5715,14 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, if switch_text == "OFF": print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- try: # To deal with already connected SSID @@ -4158,7 +5745,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, except: print("Couldn't forget ssid") closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") # ----------------------This is to Forget current connected SSID-------------------------------- @@ -4207,88 +5794,85 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet except: closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet + return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # Selecting WIFI # ------------------------------------------------------- try: report.step_start("Selecting Wifi: " + WifiName) - wifi_selection_element = WebDriverWait(driver, 35).until( + wifiSelectionElement = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifi_selection_element.click() + wifiSelectionElement.click() check_if_no_internet_popup(driver) except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - # ------------------------------------------------------- - # Selecting certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Selecting CA Cert") - cert_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/ca_cert']") - cert_element.click() - except NoSuchElementException: - print("Selecting certificate failed") - # ------------------------------------------------------- - # Validating certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Validting CA Cert") - cert_element = driver.find_element_by_xpath( - "//*[@text='Do not validate']") - cert_element.click() - except NoSuchElementException: - print("validation failed") - # Set username - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Set User name") - print("Set User name") - wifi_user_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/identity']") - wifi_user_element.send_keys(User) - except NoSuchElementException: - print("User name not Loaded") + return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- - # Scroll Down - scroll_down_pixel(setup_perfectoMobile) - time.sleep(2) - # Set Password + + # Set password if Needed # ------------------------------------------------------- try: - driver.implicitly_wait(6) - report.step_start("Set Password") - print("Set Password") - wifi_password_element = driver.find_element_by_xpath( + time.sleep(3) + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + print("Entering password") + wifiPasswordElement = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/password']") - wifi_password_element.send_keys(ttls_passwd) - print("Entered Password") + wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") - + check_if_no_internet_popup(driver) # ------------------------------------------------------- # Click on connect button # ------------------------------------------------------- try: - driver.implicitly_wait(3) report.step_start("Click Connect Button") - join_element = driver.find_element_by_xpath("//*[@text='Connect']") - join_element.click() + time.sleep(5) + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + try: + time.sleep(2) + report.step_start("Click Accept Terms Button") + print("Click Accept Terms Button") + join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't press Accept terms button") + try: + time.sleep(2) + report.step_start("Click Continue Button") + print("Click Continue Button") + join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't press Continue button") + try: + time.sleep(2) + report.step_start("Click Last Terms if needed") + print("Click Last Terms if needed") + join_btn_element = driver.find_element_by_xpath("//*[@text='Done']") + join_btn_element.click() + except NoSuchElementException: + print(" Couldn't find the last terms page") # Verify if WiFi is connected # ------------------------------------------------------- @@ -4303,55 +5887,217 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, check_if_no_internet_popup(driver) except: try: - print("Not able to verify the connected WiFi. Scrolling up.") - scroll_up(setup_perfectoMobile) - scroll_up(setup_perfectoMobile) - # check_if_no_internet_popup(driver) - WifiInternetErrMsg = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - print("Wifi Successfully Connected without internet") + print("Not able to verify the connected WiFi. Scrolling up.") + scroll_up(setup_perfectoMobile) + scroll_up(setup_perfectoMobile) + # check_if_no_internet_popup(driver) + WifiInternetErrMsg = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + print("Wifi Successfully Connected without internet") + check_if_no_internet_popup(driver) + except: + try: + report.step_start("Verify if Wifi is Connected") + print("Verifying after scrolling") + scroll_up(setup_perfectoMobile) + WifiInternetErrMsg = WebDriverWait(driver, 60).until( + EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + ssid_with_internet = True + print("Wifi Successfully Connected") + except NoSuchElementException: + print("Wifi Connection Error: " + WifiName) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Get into Additional Details + # To Get an IP Address + # To Forget connection + # To turn off auto. connect + # ------------------------------------------------------- + try: + print("Into additional details") + time.sleep(5) + report.step_start("Going for ip address") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + print("Entered ssid") + try: + time.sleep(10) + print("clicking Advanced") + report.step_start("clicking Advanced") + advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']") + advanced_element.click() + print("clicked Advanced") + # print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + advanced_element.click() + # print("Device IP address is :", ip_address_element_text) + except: + try: + time.sleep(5) + print("clicking Advanced2") + advanced_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + advanced_element.click() + except: + print("No advanced options") + # allure.attach(name= body=str("IP address element not found")) + + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + # Scroll Down + scrollDown(setup_perfectoMobile) + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + # ------------------------------- Forget SSID ---------------- + try: check_if_no_internet_popup(driver) - except: - try: - report.step_start("Verify if Wifi is Connected") - print("Verifying after scrolling") - scroll_up(setup_perfectoMobile) - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - ssid_with_internet = True - print("Wifi Successfully Connected") - except NoSuchElementException: - print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet - + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + forget_ssid.click() + print("Forgetting ssid") - except NoSuchElementException: + # ------------------------------- Wifi Switch ---------------- + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() + except: + print("couldn't click on wifi switch") + # allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + except: print("No Switch element found") - # allure.attach(name= body=str("No Switch element found")) # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - except NoSuchElementException: + except: print("Couldn't find wifi Button") - # allure.attach(name= body=str("Couldn't find wifi Button")) # ------------------Open WIFI page---------------------------------- - except NoSuchElementException: + except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ssid_with_internet -#--------------------CAPTIVE PORTAL Android----------------------------------------- -def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connData): + return ip_address_element_text, ssid_with_internet + + +def close_driver(driver): + driver.close() + driver.quit() + + +def expressWifi(request, WifiName, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("Express Wifi Verification") + print("-------------------------------------") + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + try: + click_on_ssid = WebDriverWait(driver, 10).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Sign in to the network.']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + click_on_ssid.click() + print("click on expresswifi SSID to open login page") + except: + print("Could not found expresswifi SSID") + + try: + print("Express Wifi Home Page Verification") + report.step_start("Express Wifi Home Page Verification") + driver.implicitly_wait(2) + ExpressWifiBytesLeft = driver.find_element_by_xpath("//*[@label='0KB left']") + except NoSuchElementException: + # driver.implicitly_wait(25) + #Add function to Toggle Wifi if Express Wifi Home Page not Triggerd + print("Express Wifi Page Not Logged In - ") + + try: + print("ExpressWifi Click on Menu Circle") + report.step_start("ExpressWifi Click on Menu Circle") + ExpressWifiMenu = driver.find_element_by_xpath("//*[@resource-id='dogfood-menu']") + ExpressWifiMenu.click() + except NoSuchElementException: + print("---- Exception ExpressWifi Click on Menu Circle") + + try: + print("ExpressWifi Click Run Tests!") + report.step_start("ExpressWifi Click Run Tests!") + ExpressWifiRunTests = driver.find_element_by_xpath("//*[@resource-id='run_tests']") + ExpressWifiRunTests.click() + time.sleep(20) + except NoSuchElementException: + print("Exception ExceptionExpressWifi Click Run Tests!") + + try: + print("Verify Results: ") + report.step_start("Verify Results") + + expressWifiOutputMsg = "//*[@resource-id='test_result']" + LogOut = driver.find_element_by_xpath(expressWifiOutputMsg) + print("----" + LogOut.text + "\n") + if 'test completed successfully' in LogOut.text: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return True + else: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return False + except NoSuchElementException: + print("Exception Verify Results") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + +def scroll_down_pixel(setup_perfectoMobile): + print("Scroll Down") + setup_perfectoMobile[1].step_start("Scroll Down") + params2 = {} + params2["start"] = "50%,50%" + params2["end"] = "50%,20%" + params2["duration"] = "4" + time.sleep(2) + setup_perfectoMobile[0].execute_script('mobile:touch:swipe', params2) + time.sleep(1) +def scroll_up(setup_perfectoMobile): + print("Scroll up") + setup_perfectoMobile[1].step_start("Scroll up") + params2 = {} + params2["start"] = "50%,20%" + params2["end"] = "50%,80%" + params2["duration"] = "2" + time.sleep(1) + setup_perfectoMobile[0].execute_script('mobile:touch:swipe', params2) + time.sleep(1) + + +def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") print("Verifying Wifi Connection Details....") - #allure.attach(name= body=str("\n-------------------------------------")) report = setup_perfectoMobile[1] driver = setup_perfectoMobile[0] @@ -4367,11 +6113,11 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa openApp(connData["appPackage-android"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) - #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) if deviceModelName != ("Pixel 4"): report.step_start("Set Wifi Network to " + WifiName) + # -----------------To Open Connections page----------------------- try: print("Verifying Connected Wifi Connection") @@ -4379,28 +6125,28 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa connElement = driver.find_element_by_xpath("//*[@text='Connections']") connElement.click() + # ---------------------Open WIFI page------------------------------- try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") time.sleep(3) wifiElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi-Fi']"))) + EC.presence_of_element_located((MobileBy.XPATH,"//*[@text='Wi-Fi']"))) wifiElement.click() + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") get_switch_text = get_switch_text_element.text - print("get_switch_text: ", get_switch_text) + print("get_switch_text: ",get_switch_text) print("Find wifi switch") - try: # To Turn on Wi-Fi Switch + try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -4431,68 +6177,40 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet - # ---------------------This is to Forget current connected SSID------------------------------- - if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, - search_this="osVersion") != "12": - try: # To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: # To forget exhisting ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - except: - print("Couldn't get into additional details") - except: - print("No Connected SSIDS") - else: - try: # To deal with already connected SSID + #---------------------This is to Forget current connected SSID------------------------------- + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") - try: # To forget exhisting ssid - print("To forget ssid in osversion 12") + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") - additional_details_element.click() - try: - print("To forget ssid in osversion 12-1206") - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") except: - print("Couldn't get into additional details") + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet except: - print("No Connected SSIDS") - # ----------------------This is to Forget current connected SSID-------------------------------- + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- # time.sleep(2) print("Selecting Wifi: " + WifiName) - # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) ssid_found = False available_ssids = False - # This is To get all available ssids - # ------------------------------------------------------ + #This is To get all available ssids + #------------------------------------------------------ try: for k in range(9): available_ssids = get_all_available_ssids(driver, deviceModelName) @@ -4504,22 +6222,24 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(2) else: ssid_found = True - print(WifiName + " : Found in Device") - # allure.attach(name= body=str(WifiName+" : Found in Device")) + print(WifiName+" : Found in Device") + #allure.attach(name= body=str(WifiName+" : Found in Device")) break except: print("couldn't find wifi in available ssid") if not ssid_found: print("could not found " + WifiName + " in device") - # allure.attach(name= body=str("could not found" + WifiName + " in device")) + #allure.attach(name= body=str("could not found" + WifiName + " in device")) closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- + #------------------------------------------------------- - # Selecting WIFI + + + #Selecting WIFI # ------------------------------------------------------- try: report.step_start("Selecting Wifi: " + WifiName) @@ -4535,22 +6255,22 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- - # Set password if Needed + + #Set password if Needed # ------------------------------------------------------- try: check_if_no_internet_popup(driver) time.sleep(3) report.step_start("Set Wifi Password") print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") check_if_no_internet_popup(driver) # ------------------------------------------------------- - # Click on connect button + #Click on connect button # ------------------------------------------------------- try: time.sleep(5) @@ -4561,40 +6281,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) - #---------------------Clicking on ssid for captive portal login-------- - try: - time.sleep(2) - report.step_start("Selecting Wifi: " + WifiName) - wifi_selection_element = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifi_selection_element.click() - except NoSuchElementException: - print("Not connected to Captive portal Ssid.. ") - try: - time.sleep(2) - report.step_start("Click Accept Terms Button") - print("Click Accept Terms Button") - join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't press Accept terms button") - try: - time.sleep(2) - report.step_start("Click Continue Button") - print("Click Continue Button") - join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't press Continue button") - try: - time.sleep(2) - report.step_start("Click Last Terms if needed") - print("Click Last Terms if needed") - join_btn_element = driver.find_element_by_xpath("//*[@text='Done']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't find the last terms page") - + # ------------------------------------------------------- # Verify if WiFi is connected # ------------------------------------------------------- @@ -4633,8 +6320,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa return ip_address_element_text, ssid_with_internet else: try: - report.step_start( - "Verifying wifi connection status connected/connected without internet") + report.step_start("Verifying wifi connection status connected/connected without internet") check_if_no_internet_popup(driver) check_if_no_internet_popup(driver) @@ -4664,12 +6350,12 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- + # Get into Additional Details # To Get an IP Address # To Forget connection # To turn off auto. connect # ------------------------------------------------------- - # ------------------------------------------------------- if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": try: @@ -4728,8 +6414,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find( - "//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -4775,8 +6460,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: print("click on view more") additional_details_element = WebDriverWait(driver, 50).until( - EC.presence_of_element_located( - (MobileBy.XPATH, "//*[@text='View more']"))) + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='View more']"))) additional_details_element.click() except: pass @@ -4832,29 +6516,29 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Unable to get IP address") pass - report.step_start("Forget SSID") - - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@text='Forget']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + # report.step_start("Forget SSID") + # + # try: + # check_if_no_internet_popup(driver) + # forget_ssid = driver.find_element_by_xpath( + # "//*[@text='Forget']") + # forget_ssid.click() + # print("Forgetting ssid") + # + # # ------------------------------- Wifi Switch ---------------- + # # try: + # # print("clicking on wifi switch") + # # get_switch_element = driver.find_element_by_xpath( + # # "//*[@resource-id='com.android.settings:id/switch_widget']") + # # driver.implicitly_wait(2) + # # get_switch_element.click() + # # except: + # # print("couldn't click on wifi switch") + # # #allure.attach(name= body=str("couldn't click on wifi switch")) + # except: + # print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- @@ -4862,16 +6546,15 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # ------------------------------------------------------- except: print("No Switch element found") - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- except: print("Couldn't find wifi Button") - # ------------------Open WIFI page---------------------------------- + # ------------------Open WIFI page---------------------------------- except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - # -----------------To Open Connections page--------------------------- - # --------------------Pixel 4 code--------------------------- + #--------------------Pixel 4 code--------------------------- else: report.step_start("Set Wifi Network to " + WifiName) @@ -5043,8 +6726,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -5062,38 +6744,6 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) # ------------------------------------------------------- - try: - report.step_start("Selecting Wifi: " + WifiName) - wifiSelectionElement = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifiSelectionElement.click() - check_if_no_internet_popup(driver) - except Exception as e: - print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - try: - time.sleep(2) - report.step_start("Click Accept Terms Button") - print("Click Accept Terms Button") - join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't press Accept terms button") - try: - time.sleep(2) - report.step_start("Click Continue Button") - print("Click Continue Button") - join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't press Continue button") - try: - time.sleep(2) - report.step_start("Click Last Terms if needed") - print("Click Last Terms if needed") - join_btn_element = driver.find_element_by_xpath("//*[@text='Done']") - join_btn_element.click() - except NoSuchElementException: - print(" Couldn't find the last terms page") # Verify if WiFi is connected # ------------------------------------------------------- @@ -5122,10 +6772,9 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected") print("Verifying after scrolling") scroll_up(setup_perfectoMobile) - WifiInternetErrMsg = WebDriverWait(driver, 60).until( - EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: @@ -5154,7 +6803,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']") advanced_element.click() print("clicked Advanced") - # print("Device IP address is :", ip_address_element_text) + #print("Device IP address is :", ip_address_element_text) except: try: time.sleep(5) @@ -5162,7 +6811,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa advanced_element = driver.find_element_by_xpath( "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") advanced_element.click() - # print("Device IP address is :", ip_address_element_text) + #print("Device IP address is :", ip_address_element_text) except: try: time.sleep(5) @@ -5186,135 +6835,25 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - # ------------------------------- Forget SSID ---------------- - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() - except: - print("couldn't click on wifi switch") - # allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- - except: - print("No Switch element found") - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - - except: - print("Couldn't find wifi Button") - # ------------------Open WIFI page---------------------------------- - - except: - print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - # -----------------To Open Connections page--------------------------- - - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - - -def close_driver(driver): - driver.close() - driver.quit() - - -def expressWifi(request, WifiName, setup_perfectoMobile, connData): - print("\n-------------------------------------") - print("Express Wifi Verification") - print("-------------------------------------") - report = setup_perfectoMobile[1] - driver = setup_perfectoMobile[0] - - try: - click_on_ssid = WebDriverWait(driver, 10).until(EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Sign in to the network.']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) - click_on_ssid.click() - print("click on expresswifi SSID to open login page") - except: - print("Could not found expresswifi SSID") - - try: - print("Express Wifi Home Page Verification") - report.step_start("Express Wifi Home Page Verification") - driver.implicitly_wait(2) - ExpressWifiBytesLeft = driver.find_element_by_xpath("//*[@label='0KB left']") - except NoSuchElementException: - # driver.implicitly_wait(25) - #Add function to Toggle Wifi if Express Wifi Home Page not Triggerd - print("Express Wifi Page Not Logged In - ") - - try: - print("ExpressWifi Click on Menu Circle") - report.step_start("ExpressWifi Click on Menu Circle") - ExpressWifiMenu = driver.find_element_by_xpath("//*[@resource-id='dogfood-menu']") - ExpressWifiMenu.click() - except NoSuchElementException: - print("---- Exception ExpressWifi Click on Menu Circle") - - try: - print("ExpressWifi Click Run Tests!") - report.step_start("ExpressWifi Click Run Tests!") - ExpressWifiRunTests = driver.find_element_by_xpath("//*[@resource-id='run_tests']") - ExpressWifiRunTests.click() - time.sleep(20) - except NoSuchElementException: - print("Exception ExceptionExpressWifi Click Run Tests!") - - try: - print("Verify Results: ") - report.step_start("Verify Results") - - expressWifiOutputMsg = "//*[@resource-id='test_result']" - LogOut = driver.find_element_by_xpath(expressWifiOutputMsg) - print("----" + LogOut.text + "\n") - if 'test completed successfully' in LogOut.text: - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return True - else: - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return False - except NoSuchElementException: - print("Exception Verify Results") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + except: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- -def scroll_down_pixel(setup_perfectoMobile): - print("Scroll Down") - setup_perfectoMobile[1].step_start("Scroll Down") - params2 = {} - params2["start"] = "50%,50%" - params2["end"] = "50%,20%" - params2["duration"] = "4" - time.sleep(2) - setup_perfectoMobile[0].execute_script('mobile:touch:swipe', params2) - time.sleep(1) -def scroll_up(setup_perfectoMobile): - print("Scroll up") - setup_perfectoMobile[1].step_start("Scroll up") - params2 = {} - params2["start"] = "50%,20%" - params2["end"] = "50%,80%" - params2["duration"] = "2" - time.sleep(1) - setup_perfectoMobile[0].execute_script('mobile:touch:swipe', params2) - time.sleep(1) + except: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + except: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- -def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perfectoMobile, connData): + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet +#----------------------------------Gets ip address of the enterprise ssid and does not forget it------------------ +def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") @@ -5425,7 +6964,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf print("No Connected SSIDS") #----------------------This is to Forget current connected SSID-------------------------------- - # time.sleep(2) + time.sleep(2) print("Selecting Wifi: " + WifiName) #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) ssid_found = False @@ -5433,7 +6972,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf #This is To get all available ssids #------------------------------------------------------ try: - for k in range(9): + for k in range(10): available_ssids = get_all_available_ssids(driver, deviceModelName) print("active_ssid_list: ", available_ssids) allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) @@ -5458,13 +6997,11 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf return ip_address_element_text, ssid_with_internet #------------------------------------------------------- - - - #Selecting WIFI + # Selecting WIFI # ------------------------------------------------------- try: report.step_start("Selecting Wifi: " + WifiName) - print(("Clicking WIFI")) + print("Selecting Wifi") wifiSelectionElement = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) wifiSelectionElement.click() @@ -5476,28 +7013,67 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- + # Set username + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Set User name") + print("Set User name") + wifiUserElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) + wifiUserElement.send_keys(User) + except NoSuchElementException: + print("User name not Loaded") + # ------------------------------------------------------- - #Set password if Needed + # Set Password # ------------------------------------------------------- try: - check_if_no_internet_popup(driver) - time.sleep(3) - report.step_start("Set Wifi Password") - print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") - wifiPasswordElement.send_keys(WifiPass) + # driver.implicitly_wait(6) + report.step_start("Set Password") + print("Set Password") + wifiPasswordElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Enter password']"))) + wifiPasswordElement.send_keys(ttls_passwd) + print("Entered Password") except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") - check_if_no_internet_popup(driver) # ------------------------------------------------------- - - #Click on connect button + # Selecting certificate # ------------------------------------------------------- try: - time.sleep(5) + # driver.implicitly_wait(3) + report.step_start("Selecting CA Cert") + print("Selecting CA Cert") + certElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Select certificate']"))) + certElement.click() + except NoSuchElementException: + print("Selecting certificate failed") + # ------------------------------------------------------- + # Validating certificate + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) + report.step_start("Validting CA Cert") + print("Validting CA Cert") + certElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text=\"Don't validate\"]"))) + certElement.click() + except NoSuchElementException: + print("validation failed") + # ------------------------------------------------------- + if (deviceModelName == "Galaxy S9"): + driver.hide_keyboard() + print("Hide keyboard") + # Click on connect button + # ------------------------------------------------------- + try: + # driver.implicitly_wait(3) report.step_start("Click Connect Button") - print("Click Connect") - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + print("Click Connect Button") + joinBTNElement = WebDriverWait(driver, 10).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']"))) joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") @@ -5775,25 +7351,24 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - #--------------------Pixel 4 code--------------------------- - else: + else: #--------------------Pixel code----------------------------------- report.step_start("Set Wifi Network to " + WifiName) # -----------------To Open Connections page----------------------- try: - print("Verifying Connected Wifi Connection") + print("Verifying Connected Wifi Connection in Pixel") report.step_start("Click Network & internet in pixel4") - connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") - connElement.click() + conn_element = driver.find_element_by_xpath("//*[@text='Network & internet']") + conn_element.click() # ---------------------Open WIFI page------------------------------- try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") time.sleep(3) - wifiElement = WebDriverWait(driver, 10).until( + wifi_element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) - wifiElement.click() + wifi_element.click() # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: @@ -5923,15 +7498,16 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf except: closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- # ------------------------------------------------------- # Selecting WIFI # ------------------------------------------------------- try: report.step_start("Selecting Wifi: " + WifiName) - wifiSelectionElement = WebDriverWait(driver, 35).until( + wifi_selection_element = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifiSelectionElement.click() + wifi_selection_element.click() check_if_no_internet_popup(driver) except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") @@ -5939,28 +7515,67 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- - - # Set password if Needed + # ------------------------------------------------------- + # Selecting certificate + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Selecting CA Cert") + print("Selecting certificate") + cert_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/ca_cert']") + cert_element.click() + except NoSuchElementException: + print("Selecting certificate failed") + # ------------------------------------------------------- + # Validating certificate + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Validting CA Cert") + print("validation") + cert_element = driver.find_element_by_xpath( + "//*[@text='Do not validate']") + cert_element.click() + except NoSuchElementException: + print("validation failed") + # Set username + # ------------------------------------------------------- + try: + driver.implicitly_wait(3) + report.step_start("Set User name") + print("Set User name") + wifi_user_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/identity']") + wifi_user_element.send_keys(User) + except NoSuchElementException: + print("User name not Loaded") + # ------------------------------------------------------- + # Scroll Down + scroll_down_pixel(setup_perfectoMobile) + time.sleep(2) + # Set Password # ------------------------------------------------------- try: - time.sleep(3) check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") - wifiPasswordElement.send_keys(WifiPass) + wifiPasswordElement = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement.send_keys(ttls_passwd) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") check_if_no_internet_popup(driver) + # ------------------------------------------------------- # Click on connect button # ------------------------------------------------------- try: + driver.implicitly_wait(3) report.step_start("Click Connect Button") - time.sleep(5) - joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") - joinBTNElement.click() + join_element = driver.find_element_by_xpath("//*[@text='Connect']") + join_element.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) @@ -6070,11 +7685,12 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet -#----------------------------------Gets ip address of the enterprise ssid and does not forget it------------------ -def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): + + +#-----------------------------ip address check------------------------------------------------ +def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") @@ -6146,161 +7762,18 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("Sleeping for: ", i) time.sleep(i) pass - if get_switch_text == "Off": - print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - else: - print("Switch is already On") - check_if_no_internet_popup(driver) - except: - print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - - #---------------------This is to Forget current connected SSID------------------------------- - try: #To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") - try: #To forget exhisting ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") - additional_details_element.click() - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - except: - print("Couldn't get into additional details") - except: - print("No Connected SSIDS") - #----------------------This is to Forget current connected SSID-------------------------------- - - time.sleep(2) - print("Selecting Wifi: " + WifiName) - #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) - ssid_found = False - available_ssids = False - #This is To get all available ssids - #------------------------------------------------------ - try: - for k in range(10): - available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) - try: - if WifiName not in available_ssids: - scrollDown(setup_perfectoMobile) - time.sleep(2) - else: - ssid_found = True - print(WifiName+" : Found in Device") - #allure.attach(name= body=str(WifiName+" : Found in Device")) - break - except: - print("couldn't find wifi in available ssid") - if not ssid_found: - print("could not found " + WifiName + " in device") - #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + if get_switch_text == "Off": + print("Switch is Still OFF") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) except: + print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet - #------------------------------------------------------- - - # Selecting WIFI - # ------------------------------------------------------- - try: - report.step_start("Selecting Wifi: " + WifiName) - print("Selecting Wifi") - wifiSelectionElement = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifiSelectionElement.click() - check_if_no_internet_popup(driver) - except Exception as e: - print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- - - # Set username - # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Set User name") - print("Set User name") - wifiUserElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) - wifiUserElement.send_keys(User) - except NoSuchElementException: - print("User name not Loaded") - # ------------------------------------------------------- - - # Set Password - # ------------------------------------------------------- - try: - # driver.implicitly_wait(6) - report.step_start("Set Password") - print("Set Password") - wifiPasswordElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Enter password']"))) - wifiPasswordElement.send_keys(ttls_passwd) - print("Entered Password") - except NoSuchElementException: - print("Password Page Not Loaded, password May be cached in the System") - # ------------------------------------------------------- - # Selecting certificate - # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Selecting CA Cert") - print("Selecting CA Cert") - certElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Select certificate']"))) - certElement.click() - except NoSuchElementException: - print("Selecting certificate failed") - # ------------------------------------------------------- - # Validating certificate - # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Validting CA Cert") - print("Validting CA Cert") - certElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text=\"Don't validate\"]"))) - certElement.click() - except NoSuchElementException: - print("validation failed") - # ------------------------------------------------------- - if (deviceModelName == "Galaxy S9"): - driver.hide_keyboard() - print("Hide keyboard") - # Click on connect button # ------------------------------------------------------- - try: - # driver.implicitly_wait(3) - report.step_start("Click Connect Button") - print("Click Connect Button") - joinBTNElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Connect']"))) - joinBTNElement.click() - except NoSuchElementException: - print("Connect Button Not Enabled...Verify if Password is set properly ") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- - # Verify if WiFi is connected # ------------------------------------------------------- if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, @@ -6338,7 +7811,8 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw return ip_address_element_text, ssid_with_internet else: try: - report.step_start("Verifying wifi connection status connected/connected without internet") + report.step_start( + "Verifying wifi connection status connected/connected without internet") check_if_no_internet_popup(driver) check_if_no_internet_popup(driver) @@ -6534,62 +8008,60 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("Unable to get IP address") pass - # report.step_start("Forget SSID") - # - # try: - # check_if_no_internet_popup(driver) - # forget_ssid = driver.find_element_by_xpath( - # "//*[@text='Forget']") - # forget_ssid.click() - # print("Forgetting ssid") - # - # # ------------------------------- Wifi Switch ---------------- - # # try: - # # print("clicking on wifi switch") - # # get_switch_element = driver.find_element_by_xpath( - # # "//*[@resource-id='com.android.settings:id/switch_widget']") - # # driver.implicitly_wait(2) - # # get_switch_element.click() - # # except: - # # print("couldn't click on wifi switch") - # # #allure.attach(name= body=str("couldn't click on wifi switch")) - # except: - # print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet + report.step_start("Forget SSID") + + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@text='Forget']") + forget_ssid.click() + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + # try: + # print("clicking on wifi switch") + # get_switch_element = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/switch_widget']") + # driver.implicitly_wait(2) + # get_switch_element.click() + # except: + # print("couldn't click on wifi switch") + # #allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- - # ------------------------------------------------------- except: - print("No Switch element found") - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- - + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- except: - print("Couldn't find wifi Button") - # ------------------Open WIFI page---------------------------------- - + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - else: #--------------------Pixel code----------------------------------- + #--------------------Pixel 4 code--------------------------- + else: report.step_start("Set Wifi Network to " + WifiName) # -----------------To Open Connections page----------------------- try: - print("Verifying Connected Wifi Connection in Pixel") + print("Verifying Connected Wifi Connection") report.step_start("Click Network & internet in pixel4") - conn_element = driver.find_element_by_xpath("//*[@text='Network & internet']") - conn_element.click() + connElement = driver.find_element_by_xpath("//*[@text='Network & internet']") + connElement.click() # ---------------------Open WIFI page------------------------------- try: report.step_start("Clicking Wi-Fi") print("Clicking WIFI") time.sleep(3) - wifi_element = WebDriverWait(driver, 10).until( + wifiElement = WebDriverWait(driver, 10).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='Wi‑Fi']"))) - wifi_element.click() + wifiElement.click() # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: @@ -6600,208 +8072,50 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # if get_switch_text is not None: # switch_text = "OFF" # else: - # switch_text = "ON" - switch_text = get_switch_text - print("get_switch_text: ", switch_text) - print("Find wifi switch") - try: # To Turn on Wi-Fi Switch - if switch_text == "OFF": - # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(1) - get_switch_element.click() - driver.implicitly_wait(1) - i = 0 - for i in range(5): - if switch_text == "ON": - print("WIFI Switch is ON") - break - else: - try: - get_switch_text_element = driver.find_element_by_xpath( - "//*[@text='Add network']") - get_switch_text = get_switch_text_element.text - if get_switch_text == "Add network": - switch_text = "ON" - else: - switch_text = "OFF" - except NoSuchElementException: - print("Exception: Verify Xpath") - # Scroll Down - scrollDown(setup_perfectoMobile) - print("Sleeping for: ", i) - time.sleep(i) - pass - if switch_text == "OFF": - print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - else: - print("Switch is already On") - check_if_no_internet_popup(driver) - except: - print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - - # ---------------------This is to Forget current connected SSID------------------------------- - try: # To deal with already connected SSID - check_if_no_internet_popup(driver) - network_category = driver.find_element_by_xpath("//*[@text='Connected']") - try: # To forget existing ssid - print("To forget ssid") - check_if_no_internet_popup(driver) - additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - additional_details_element.click() - except: - print("Couldn't get into additional details") - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") - forget_ssid.click() - print("Forget old ssid") - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - except: - print("No Connected SSIDS") - # ----------------------This is to Forget current connected SSID-------------------------------- - - time.sleep(2) - print("Selecting Wifi: " + WifiName) - # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) - ssid_found = False - available_ssids = False - # This is To get all available ssids - # ------------------------------------------------------ - try: - for k in range(5): - available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) - try: - if WifiName not in available_ssids: - scrollDown(setup_perfectoMobile) - time.sleep(2) - else: - ssid_found = True - print(WifiName + " : Found in Device") - # allure.attach(name= body=str(WifiName+" : Found in Device")) + # switch_text = "ON" + switch_text = get_switch_text + print("get_switch_text: ", switch_text) + print("Find wifi switch") + try: # To Turn on Wi-Fi Switch + if switch_text == "OFF": + # driver.implicitly_wait(3) + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(1) + get_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + if switch_text == "ON": + print("WIFI Switch is ON") break - except: - print("couldn't find wifi in available ssid") - if not ssid_found: - ssid_not_found = False - for k in range(5): - available_ssids = get_all_available_ssids(driver, deviceModelName) - print("active_ssid_list: ", available_ssids) - allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) - try: - if WifiName not in available_ssids: - scroll_up(setup_perfectoMobile) - time.sleep(2) - else: - ssid_not_found = True - print(WifiName + " : Found in Device") - # allure.attach(name= body=str(WifiName+" : Found in Device")) - break - except: - print("couldn't find wifi in available ssid") - if not ssid_not_found: - print("could not found " + WifiName + " in device") - # allure.attach(name= body=str("could not found" + WifiName + " in device")) + else: + try: + get_switch_text_element = driver.find_element_by_xpath( + "//*[@text='Add network']") + get_switch_text = get_switch_text_element.text + if get_switch_text == "Add network": + switch_text = "ON" + else: + switch_text = "OFF" + except NoSuchElementException: + print("Exception: Verify Xpath") + # Scroll Down + scrollDown(setup_perfectoMobile) + print("Sleeping for: ", i) + time.sleep(i) + pass + if switch_text == "OFF": + print("Switch is Still OFF") closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet + else: + print("Switch is already On") + check_if_no_internet_popup(driver) except: + print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- - # ------------------------------------------------------- - - # Selecting WIFI - # ------------------------------------------------------- - try: - report.step_start("Selecting Wifi: " + WifiName) - wifi_selection_element = WebDriverWait(driver, 35).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) - wifi_selection_element.click() - check_if_no_internet_popup(driver) - except Exception as e: - print("Exception on Selecting Wifi Network. Please check wifi Name or signal") - request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet - # ------------------------------------------------------- - # ------------------------------------------------------- - # Selecting certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Selecting CA Cert") - print("Selecting certificate") - cert_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/ca_cert']") - cert_element.click() - except NoSuchElementException: - print("Selecting certificate failed") - # ------------------------------------------------------- - # Validating certificate - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Validting CA Cert") - print("validation") - cert_element = driver.find_element_by_xpath( - "//*[@text='Do not validate']") - cert_element.click() - except NoSuchElementException: - print("validation failed") - # Set username - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Set User name") - print("Set User name") - wifi_user_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/identity']") - wifi_user_element.send_keys(User) - except NoSuchElementException: - print("User name not Loaded") - # ------------------------------------------------------- - # Scroll Down - scroll_down_pixel(setup_perfectoMobile) - time.sleep(2) - # Set Password - # ------------------------------------------------------- - try: - check_if_no_internet_popup(driver) - report.step_start("Set Wifi Password") - print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") - wifiPasswordElement.send_keys(ttls_passwd) - except NoSuchElementException: - print("Password Page Not Loaded, password May be cached in the System") - check_if_no_internet_popup(driver) - - # ------------------------------------------------------- - - # Click on connect button - # ------------------------------------------------------- - try: - driver.implicitly_wait(3) - report.step_start("Click Connect Button") - join_element = driver.find_element_by_xpath("//*[@text='Connect']") - join_element.click() - except NoSuchElementException: - print("Connect Button Not Enabled...Verify if Password is set properly ") - check_if_no_internet_popup(driver) - # ------------------------------------------------------- - # Verify if WiFi is connected # ------------------------------------------------------- try: @@ -6815,23 +8129,18 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw check_if_no_internet_popup(driver) except: try: - print("Not able to verify the connected WiFi. Scrolling up.") - scroll_up(setup_perfectoMobile) - scroll_up(setup_perfectoMobile) - # check_if_no_internet_popup(driver) + check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: try: report.step_start("Verify if Wifi is Connected") - print("Verifying after scrolling") - scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: @@ -6880,45 +8189,149 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet - # Scroll Down - scrollDown(setup_perfectoMobile) - try: - time.sleep(2) - ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") - ip_address_element_text = ip_address_element.text - print("Device IP address is :", ip_address_element_text) - except: - print("IP address element not found") - except: - print("Couldn't get into Additional settings") - # ------------------------------------------------------- - except: - print("No Switch element found") - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + # Scroll Down + scrollDown(setup_perfectoMobile) + try: + time.sleep(2) + ip_address_element = driver.find_element_by_xpath( + "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + ip_address_element_text = ip_address_element.text + print("Device IP address is :", ip_address_element_text) + except: + print("IP address element not found") + #------------------------------- Forget SSID ---------------- + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + forget_ssid.click() + print("Forgetting ssid") + + # ------------------------------- Wifi Switch ---------------- + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() + except: + print("couldn't click on wifi switch") + # allure.attach(name= body=str("couldn't click on wifi switch")) + except: + print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into Additional settings") + # ------------------------------------------------------- + except: + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + + except: + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + + except: + print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- + + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + +def get_phone_information(setup_perfectoMobile, search_this): + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + report.step_start("Get DeviceID") + params = {'property': search_this} + device_information = driver.execute_script('mobile:handset:info', params) + print("device information for "+search_this+" is: ", device_information) + return device_information + +#------------Return upload download rate------------------------------ +def return_upload_download_speed_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data): + print("\n-------------------------------------") + print("Verify Upload & Download Speed") + print("-------------------------------------") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_APToMobileDevice_data + + driver.switch_to.context('WEBVIEW_1') + + try: + print("Launching Chrome") + report.step_start("Google Home Page") + driver.get(connData["webURL"]) + print("Enter Search Text") + elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) + elementFindTxt.send_keys("Internet Speed Test") + except Exception as e: + print("Launching Chrome Failed") + print (e) + # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) + # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) + + try: + print("Click Search Button") + report.step_start("Click Search Button") + time.sleep(2) + driver.implicitly_wait(2) + elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") + elelSearch.click() + except: + try: + time.sleep(2) + driver.implicitly_wait(2) + elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") + elelSearch.click() + except: + print("Search Drop Down not active...") + return False + + try: + print("Click Run Speed Test Button...") + report.step_start("Click Run Speed Test Button") + driver.find_element_by_xpath(connData["BtnRunSpeedTest"]).click() + except NoSuchElementException: + print("Error in speed test element ", NoSuchElementException) + # allure.attach(name="Speed Test logs: ", body=str("Search Run Speed Test not active..." + NoSuchElementException)) + return False + + #Get upload/Download Speed + try: + print("Get Download Speed") + report.step_start("Get upload/Download Speed") + time.sleep(60) + downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) + downloadSpeed = downloadMbps.text + print("Download: " + downloadSpeed + " Mbps") - except: - print("Couldn't find wifi Button") - # ------------------Open WIFI page---------------------------------- + print("Get Upload Speed") + report.step_start("Get Upload Speed") + UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) + uploadSpeed = UploadMbps.text + print("Upload: " + uploadSpeed + " Mbps") + allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) + print("Access Point Verification Completed Successfully") + except NoSuchElementException: + print("Access Point Verification NOT Completed, checking Connection....") - except: - print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + return downloadSpeed, uploadSpeed -#-----------------------------ip address check------------------------------------------------ -def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup_perfectoMobile, connData): +def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") print("Select Wifi/AccessPoint Connection") print("-------------------------------------") print("Verifying Wifi Connection Details....") report = setup_perfectoMobile[1] driver = setup_perfectoMobile[0] - + driver.switch_to.context('WEBVIEW_1') ip_address_element_text = False ssid_with_internet = False @@ -6994,16 +8407,148 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet + + #---------------------This is to Forget current connected SSID------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_network_category']") + try: #To forget exhisting ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/layout_details']") + additional_details_element.click() + try: + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + else: + try: #To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + try: #To forget exhisting ssid + print("To forget ssid in osversion 12") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/wifi_details']") + additional_details_element.click() + try: + print("To forget ssid in osversion 12-1206") + check_if_no_internet_popup(driver) + forget_ssid = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + forget_ssid.click() + print("Forget old ssid") + except: + print("Couldn't forget ssid") + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + print("Couldn't get into additional details") + except: + print("No Connected SSIDS") + #----------------------This is to Forget current connected SSID-------------------------------- + + # time.sleep(2) + print("Selecting Wifi: " + WifiName) + #allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + #This is To get all available ssids + #------------------------------------------------------ + try: + for k in range(9): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName+" : Found in Device") + #allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + print("could not found " + WifiName + " in device") + #allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + #------------------------------------------------------- + + + + #Selecting WIFI # ------------------------------------------------------- - # Verify if WiFi is connected + try: + report.step_start("Selecting Wifi: " + WifiName) + print(("Clicking WIFI")) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- - if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, - search_this="osVersion") != "12": + + + #Set password if Needed + # ------------------------------------------------------- + try: + check_if_no_internet_popup(driver) + time.sleep(3) + report.step_start("Set Wifi Password") + print("Set Wifi password") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + #Click on connect button + # ------------------------------------------------------- + try: + time.sleep(5) + report.step_start("Click Connect Button") + print("Click Connect") + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + #Verify if WiFi is connected + # ------------------------------------------------------- + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": try: report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -7013,17 +8558,16 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: try: report.step_start("Verify if Wifi is Connected - 2") - WifiInternetErrMsg = WebDriverWait(driver, 60).until( - EC.presence_of_element_located(( - MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( + MobileBy.XPATH, + "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: @@ -7032,8 +8576,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup return ip_address_element_text, ssid_with_internet else: try: - report.step_start( - "Verifying wifi connection status connected/connected without internet") + report.step_start("Verifying wifi connection status connected/connected without internet") check_if_no_internet_popup(driver) check_if_no_internet_popup(driver) @@ -7064,13 +8607,12 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- - # Get into Additional Details - # To Get an IP Address - # To Forget connection - # To turn off auto. connect + #Get into Additional Details + #To Get an IP Address + #To Forget connection + #To turn off auto. connect # ------------------------------------------------------- - if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, - search_this="osVersion") != "12": + if get_phone_information(setup_perfectoMobile=setup_perfectoMobile, search_this="osVersion") != "12": try: print("Into additional details") time.sleep(2) @@ -7138,27 +8680,27 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Couldn't find auto reconnect element") # ------------------------------- Forget SSID ---------------- - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet + # try: + # check_if_no_internet_popup(driver) + # forget_ssid = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + # forget_ssid.click() + # print("Forgetting ssid") + # + # # ------------------------------- Wifi Switch ---------------- + # # try: + # # print("clicking on wifi switch") + # # get_switch_element = driver.find_element_by_xpath( + # # "//*[@resource-id='com.android.settings:id/switch_widget']") + # # driver.implicitly_wait(2) + # # get_switch_element.click() + # # except: + # # print("couldn't click on wifi switch") + # # #allure.attach(name= body=str("couldn't click on wifi switch")) + # except: + # print("Couldn't forget ssid") + # # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- @@ -7229,41 +8771,46 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Unable to get IP address") pass - report.step_start("Forget SSID") - - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@text='Forget']") - forget_ssid.click() - print("Forgetting ssid") - - # ------------------------------- Wifi Switch ---------------- - # try: - # print("clicking on wifi switch") - # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") - # driver.implicitly_wait(2) - # get_switch_element.click() - # except: - # print("couldn't click on wifi switch") - # #allure.attach(name= body=str("couldn't click on wifi switch")) - except: - print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) - return ip_address_element_text, ssid_with_internet + # report.step_start("Forget SSID") + # + # try: + # check_if_no_internet_popup(driver) + # forget_ssid = driver.find_element_by_xpath( + # "//*[@text='Forget']") + # forget_ssid.click() + # print("Forgetting ssid") + # + # # ------------------------------- Wifi Switch ---------------- + # # try: + # # print("clicking on wifi switch") + # # get_switch_element = driver.find_element_by_xpath( + # # "//*[@resource-id='com.android.settings:id/switch_widget']") + # # driver.implicitly_wait(2) + # # get_switch_element.click() + # # except: + # # print("couldn't click on wifi switch") + # # #allure.attach(name= body=str("couldn't click on wifi switch")) + # except: + # print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- + + # ------------------------------------------------------- except: - print("Couldn't find wifi Button") - # ------------------Open WIFI page---------------------------------- + print("No Switch element found") + # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + except: - print("No Switch element found") - # ---------------------To Turn on WIFi Switch if already OFF------------------------------- + print("Couldn't find wifi Button") + # ------------------Open WIFI page---------------------------------- + except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") + # -----------------To Open Connections page--------------------------- #--------------------Pixel 4 code--------------------------- else: report.step_start("Set Wifi Network to " + WifiName) @@ -7337,6 +8884,124 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Couldn't turn on WIFI switch") closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet + + # ---------------------This is to Forget current connected SSID------------------------------- + try: # To deal with already connected SSID + check_if_no_internet_popup(driver) + network_category = driver.find_element_by_xpath("//*[@text='Connected']") + try: # To forget existing ssid + print("To forget ssid") + check_if_no_internet_popup(driver) + additional_details_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + additional_details_element.click() + except: + print("Couldn't get into additional details") + # try: + # check_if_no_internet_popup(driver) + # forget_ssid = driver.find_element_by_xpath( + # "//*[@resource-id='com.android.settings:id/button1']") + # forget_ssid.click() + # print("Forget old ssid") + # except: + # print("Couldn't forget ssid") + # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # return ip_address_element_text, ssid_with_internet + except: + print("No Connected SSIDS") + # ----------------------This is to Forget current connected SSID-------------------------------- + + time.sleep(2) + print("Selecting Wifi: " + WifiName) + # allure.attach(name= body=str("Selecting Wifi: " + WifiName)) + ssid_found = False + available_ssids = False + # This is To get all available ssids + # ------------------------------------------------------ + try: + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + ssid_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_found: + ssid_not_found = False + for k in range(5): + available_ssids = get_all_available_ssids(driver, deviceModelName) + print("active_ssid_list: ", available_ssids) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if WifiName not in available_ssids: + scroll_up(setup_perfectoMobile) + time.sleep(2) + else: + ssid_not_found = True + print(WifiName + " : Found in Device") + # allure.attach(name= body=str(WifiName+" : Found in Device")) + break + except: + print("couldn't find wifi in available ssid") + if not ssid_not_found: + print("could not found " + WifiName + " in device") + # allure.attach(name= body=str("could not found" + WifiName + " in device")) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + except: + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Selecting WIFI + # ------------------------------------------------------- + try: + report.step_start("Selecting Wifi: " + WifiName) + wifiSelectionElement = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']"))) + wifiSelectionElement.click() + check_if_no_internet_popup(driver) + except Exception as e: + print("Exception on Selecting Wifi Network. Please check wifi Name or signal") + request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["appPackage-android"], setup_perfectoMobile) + return ip_address_element_text, ssid_with_internet + # ------------------------------------------------------- + + # Set password if Needed + # ------------------------------------------------------- + try: + time.sleep(3) + check_if_no_internet_popup(driver) + report.step_start("Set Wifi Password") + print("Entering password") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement.send_keys(WifiPass) + except NoSuchElementException: + print("Password Page Not Loaded, password May be cached in the System") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + + # Click on connect button + # ------------------------------------------------------- + try: + report.step_start("Click Connect Button") + time.sleep(5) + joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']") + joinBTNElement.click() + except NoSuchElementException: + print("Connect Button Not Enabled...Verify if Password is set properly ") + check_if_no_internet_popup(driver) + # ------------------------------------------------------- + # Verify if WiFi is connected # ------------------------------------------------------- try: @@ -7350,7 +9015,10 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup check_if_no_internet_popup(driver) except: try: - check_if_no_internet_popup(driver) + print("Not able to verify the connected WiFi. Scrolling up.") + scroll_up(setup_perfectoMobile) + scroll_up(setup_perfectoMobile) + # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) @@ -7359,11 +9027,14 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup except: try: report.step_start("Verify if Wifi is Connected") + print("Verifying after scrolling") + scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") + except NoSuchElementException: print("Wifi Connection Error: " + WifiName) closeApp(connData["appPackage-android"], setup_perfectoMobile) @@ -7422,6 +9093,19 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") + # try: + # print("Launching Chrome") + # report.step_start("Google Home Page") + # driver.get(connData["webURL"]) + # print("Enter Search Text") + # elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) + # elementFindTxt.send_keys("192.168.1.1") + # except Exception as e: + # print("Launching Chrome Failed") + # print(e) + # # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) + # # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) + #------------------------------- Forget SSID ---------------- try: check_if_no_internet_popup(driver) @@ -7462,26 +9146,18 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup closeApp(connData["appPackage-android"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet -def get_phone_information(setup_perfectoMobile, search_this): - report = setup_perfectoMobile[1] - driver = setup_perfectoMobile[0] - - report.step_start("Get DeviceID") - params = {'property': search_this} - device_information = driver.execute_script('mobile:handset:info', params) - print("device information for "+search_this+" is: ", device_information) - return device_information -#------------Return upload download rate------------------------------ -def return_upload_download_speed_android(request, setup_perfectoMobile, get_APToMobileDevice_data): +def return_open_maverickpage_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data): print("\n-------------------------------------") print("Verify Upload & Download Speed") print("-------------------------------------") - report = setup_perfectoMobile[1] - driver = setup_perfectoMobile[0] + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] connData = get_APToMobileDevice_data + currentResult=False + driver.switch_to.context('WEBVIEW_1') try: @@ -7490,56 +9166,111 @@ def return_upload_download_speed_android(request, setup_perfectoMobile, get_APTo driver.get(connData["webURL"]) print("Enter Search Text") elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) - elementFindTxt.send_keys("Internet Speed Test") + elementFindTxt.send_keys("192.168.1.1") except Exception as e: print("Launching Chrome Failed") print (e) # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) - try: - print("Click Search Button") - report.step_start("Click Search Button") - time.sleep(2) - driver.implicitly_wait(2) - elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") - elelSearch.click() - except: - try: - time.sleep(2) - driver.implicitly_wait(2) - elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") - elelSearch.click() - except: - print("Search Drop Down not active...") - return False + # try: + # print("Click Search Button") + # report.step_start("Click Search Button") + # time.sleep(2) + # driver.implicitly_wait(2) + # elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") + # elelSearch.click() + # except: + # try: + # time.sleep(2) + # driver.implicitly_wait(2) + # elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") + # elelSearch.click() + # except: + # print("Search Drop Down not active...") + # return False + # + # try: + # print("Click Run Speed Test Button...") + # report.step_start("Click Run Speed Test Button") + # driver.find_element_by_xpath(connData["BtnRunSpeedTest"]).click() + # except NoSuchElementException: + # print("Error in speed test element ", NoSuchElementException) + # # allure.attach(name="Speed Test logs: ", body=str("Search Run Speed Test not active..." + NoSuchElementException)) + # return False + # + # #Get upload/Download Speed + # try: + # print("Get Download Speed") + # report.step_start("Get upload/Download Speed") + # time.sleep(60) + # downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) + # downloadSpeed = downloadMbps.text + # print("Download: " + downloadSpeed + " Mbps") + # + # print("Get Upload Speed") + # report.step_start("Get Upload Speed") + # UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) + # uploadSpeed = UploadMbps.text + # print("Upload: " + uploadSpeed + " Mbps") + # allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) + # print("Access Point Verification Completed Successfully") + # currentResult = True + # except NoSuchElementException: + # print("Access Point Verification NOT Completed, checking Connection....") + # + return currentResult + + +def verify_open_mav_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data): + print("\n-------------------------------------") + print("Verify Upload & Download Speed") + print("-------------------------------------") + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_APToMobileDevice_data + + currentResult=False + + driver.switch_to.context('WEBVIEW_1') try: - print("Click Run Speed Test Button...") - report.step_start("Click Run Speed Test Button") - driver.find_element_by_xpath(connData["BtnRunSpeedTest"]).click() - except NoSuchElementException: - print("Error in speed test element ", NoSuchElementException) - # allure.attach(name="Speed Test logs: ", body=str("Search Run Speed Test not active..." + NoSuchElementException)) + print("Launching Chrome") + + report.step_start("Google Home Page") + driver.get(connData["webURL"]) + print("Enter Search Text") + elementFindTxt = driver.find_element_by_xpath(connData["// *[ @ resource - id = 'com.google.android.googlequicksearchbox:id/googleapp_search_box']"]) + elementFindTxt.send_text("192.168.1.1") + print("type something") + except Exception as e: + print("Launching Chrome Failed") + print (e) + # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) + # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) return False #Get upload/Download Speed - try: - print("Get Download Speed") - report.step_start("Get upload/Download Speed") - time.sleep(60) - downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) - downloadSpeed = downloadMbps.text - print("Download: " + downloadSpeed + " Mbps") + # try: + # print("Get Download Speed") + # report.step_start("Get upload/Download Speed") + # time.sleep(60) + # downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) + # downloadSpeed = downloadMbps.text + # print("Download: " + downloadSpeed + " Mbps") + # + # print("Get Upload Speed") + # report.step_start("Get Upload Speed") + # UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) + # uploadSpeed = UploadMbps.text + # print("Upload: " + uploadSpeed + " Mbps") + # allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) + # print("Access Point Verification Completed Successfully") + # currentResult = True + # except NoSuchElementException: + # print("Access Point Verification NOT Completed, checking Connection....") + # + return currentResult - print("Get Upload Speed") - report.step_start("Get Upload Speed") - UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) - uploadSpeed = UploadMbps.text - print("Upload: " + uploadSpeed + " Mbps") - allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) - print("Access Point Verification Completed Successfully") - except NoSuchElementException: - print("Access Point Verification NOT Completed, checking Connection....") - return downloadSpeed, uploadSpeed \ No newline at end of file diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index f40e8f4332d..80baf20dcf3 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -3323,4 +3323,355 @@ def return_upload_download_speed_iOS(request, setup_perfectoMobile, get_APToMobi print("Access Point Verification NOT Completed, checking Connection....") - return downloadSpeed, uploadSpeed \ No newline at end of file + return downloadSpeed, uploadSpeed + +def get_ip_address_maverick_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("Select Wifi/Get IP Address IOS Connection") + print("-------------------------------------") + + reportFlag = True + is_internet = False + ip_address_element_text = False + + print("Verifying Wifi/AP Connection Details....") + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + report.step_start("Switching Driver Context") + print("Switching Context to Native") + driver.switch_to.context('NATIVE_APP') + # driver.switch_to.context(contexts[0]) + + report.step_start("Set Wifi Network to " + WifiName) + # Open Settings Application + openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + + try: + time.sleep(2) + driver.implicitly_wait(2) + try: + print("Verifying Connected Wifi Connection") + report.step_start("Loading Wifi Page") + element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']") + element.click() + except NoSuchElementException: + print("Exception: Verify Xpath - unable to click on Wifi") + + time.sleep(2) + driver.implicitly_wait(4) + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + get_wifi_switch_element_text = get_wifi_switch_element.text + try: + if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + driver.implicitly_wait(1) + get_wifi_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + try: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + get_wifi_switch_element_text = get_wifi_switch_element.text + except: + print("Switch is OFF") + + if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + print("WIFI Switch is ON") + break + else: + try: + get_wifi_switch_element = driver.find_element_by_xpath( + "//*[@label='Wi-Fi' and @value='0']") + get_wifi_switch_element_text = get_wifi_switch_element.text + except: + print("WIFi switch is ON") + if (get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0): + print("switch is still OFF") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + else: + print("Switch is Still OFF") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + except: + print("No switch element found") + except: + print("get_wifi_switch_element is ON") + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + + except: + print("Cannot find WIFI element") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + + # ---------------------This is to Forget current connected SSID------------------------------- + + try: + time.sleep(4) + print("getting in to Additional details") + report.step_start("Clicking More Info") + additional_details_element = driver.find_element_by_xpath("//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']") + additional_details_element.click() + try: + time.sleep(2) + print("Forget Connected Network") + forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']"))) + forget_ssid.click() + print("Forget old ssid") + try: + time.sleep(2) + report.step_start("Forget SSID popup1") + forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']"))) + forget_ssid_popup.click() + + print("**alert** Forget SSID popup killed **alert**") + except: + print("Forget SSID popup not found") + except: + print("couldn't find forget ssid element") + except: + print("No connected SSID") + + # ---------------------This is to Forget current connected SSID------------------------------- + + # ---------------------To get all available SSID------------------------------- + print("Searching for Wifi: " + WifiName) + # allure.attach(name= body=str("Searching for Wifi: " + WifiName)) + time.sleep(2) + report.step_start("Searching SSID") + print("Selecting Wifi: " + WifiName) + ssid_found = False + available_ssids = False + + try: + for check_for_all_ssids in range(9): + available_ssids = get_all_available_ssids(driver) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + try: + driver.implicitly_wait(8) + report.step_start("Selecting SSID To Connect") + ssid_found = True + print(WifiName + " : Found in Device") + wifiSelElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) + print(wifiSelElement) + wifiSelElement.click() + print("Selecting SSID") + break + except: + print("SSID unable to select") + report.step_start("Selecting Unable SSID To Connect") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + + except: + print("couldn't connect to " + WifiName) + #request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + pass + + if not ssid_found: + print("could not found " + WifiName + " in device") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + except: + pass + # ---------------------To get all available SSID------------------------------- + + # ---------------------This is to Select SSID------------------------------- + + # ---------------------This is to Select SSID------------------------------- + # ---------------------Set Password------------------------------- + try: + driver.implicitly_wait(5) + print("Entering Password") + report.step_start("Entering Password") + wifiPassword = driver.find_element_by_xpath("//*[@label='Password']") + wifiPassword.send_keys(WifiPass) + except NoSuchElementException: + print("Enter Password Page Not Loaded") + # ---------------------Set Password------------------------------- + + # ---------------------Click on join------------------------------- + try: + driver.implicitly_wait(4) + print("Selecting join") + report.step_start("Clicking JOIN") + joinBTN = driver.find_element_by_xpath("//*[@label='Join']") + joinBTN.click() + except Exception as e: + print("Join Button Not Enabled...Password may not be needed") + # ---------------------Click on join------------------------------- + + # ---------------------check if internet------------------------------- + try: + driver.implicitly_wait(5) + WifiInternetErrMsg2 = driver.find_element_by_xpath("//*[@label='No Internet Connection']") + # = driver.find_element_by_xpath("//*[@label='No Internet Connection']").text + except Exception as e: + is_internet = True + print("No Wifi-AP Error Internet Error: " + WifiName) + # Need to add Wait for Selected Wifi Xpath + # time.sleep(3) + # ---------------------check if internet------------------------------- + + # ---------------------Additional INFO------------------------------- + try: + driver.implicitly_wait(5) + print("Selecting SSID: ", WifiName) + report.step_start("Additional details of SSID") + additional_details_element = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@label='" + WifiName + "']"))) + # //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info'] + additional_details_element.click() + + try: + driver.implicitly_wait(2) + report.step_start("Checking SSID Name as Expected") + print("Checking SSID Name") + ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text + print(ssidname_text) + if(ssidname_text == WifiName): + print("SSID Matched") + allure.attach(name="SSID Matched ", body=str(WifiName)) + else: + print("SSID Not Matched") + allure.attach(name="SSID Not Matched ", body=str(WifiName)) + reportFlag = False + assert reportFlag + except: + print("SSID is not Checked in more Info") + + try: + report.step_start("Checking WiFi Address") + print("Checking WIFI address") + # (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2] + wifi_address_element_text = driver.find_element_by_xpath( + "(//*[@label='Wi-Fi Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("wifi_address_element_text: ", wifi_address_element_text) + allure.attach(name="Connected SSID WiFi-Address: ", body=str(wifi_address_element_text)) + except Exception as e: + print("WiFi-Address not Found") + try: + time.sleep(4) + report.step_start("Checking IP Address") + print("Checking IP address") + # (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2] + ip_address_element_text = driver.find_element_by_xpath( + "(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("ip_address_element_text: ", ip_address_element_text) + except Exception as e: + try: + time.sleep(4) + print("Scrolling for checking ip address") + scrollDown(setup_perfectoMobile) + ip_address_element_text = driver.find_element_by_xpath( + "(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("ip_address_element_text: ", ip_address_element_text) + except: + print("IP Address not Found") + request.config.cache.set(key="select IP failed", value=str(e)) + + try: + report.step_start("Forget Network") + forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']"))) + forget_ssid.click() + print("Forget old ssid") + # time.sleep(2) + # driver.implicitly_wait(3) + try: + report.step_start("Forget Network popup") + forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']"))) + forget_ssid_popup.click() + except: + print("in popup exception") + + except: + print("error on ssid element") + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # print("switch state is : ", get_wifi_switch_element_text) + # try: + # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # driver.implicitly_wait(1) + # get_wifi_switch_element.click() + # driver.implicitly_wait(1) + # i = 0 + # for i in range(5): + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("switch is ON") + # + # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + # print("WIFI Switch is OFF") + # break + # else: + # try: + # get_wifi_switch_element = driver.find_element_by_xpath( + # "//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element.click() + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("WIFi switch is OFF") + # + # else: + # print("Switch is Still OFF") + # except: + # pass + # except: + # print("get_wifi_switch_element is ON") + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + + except Exception as e: + request.config.cache.set(key="select additional info failed", value=str(e)) + # ---------------------Additional INFO------------------------------- + + # --------------------- close app------------------------------- + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + # ---------------------close app------------------------------- +def verifyUploadDownloadSpeediOS(request, setup_perfectoMobile, get_APToMobileDevice_data): + print("\n-------------------------------------") + print("Verify Upload & Download Speed") + print("-------------------------------------") + + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + connData = get_APToMobileDevice_data + currentResult = True + + contexts = driver.contexts + # print("Printing Context") + # print(contexts) + + driver.switch_to.context('WEBVIEW_1') + + try: + print("Launching Safari") + report.step_start("Google Home Page") + driver.get(connData["webURL"]) + print("Enter Search Text") + print("*%%%%%%%%%%%%%%%%%%%%%%%********") + elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) + elementFindTxt.send_keys("192.168.1.1") + except Exception as e: + print("Launching Safari Failed") + print(e) + + return currentResult + diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 110af04e880..ac0f383b374 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -1,15 +1,25 @@ -import time - -import allure import pytest +import sys +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') +pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.client_connectivity + ,pytest.mark.interop_uc_sanity, pytest.mark.nat] + +from android_lib import closeApp, set_APconnMobileDevice_android, verify_open_mav_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \ + get_ip_address_maverick_and, wifi_disconnect_and_forget + +class TestNatModeConnectivitySuiteOne(object): + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") + @pytest.mark.fiveg + @pytest.mark.wpa2_personal + @pytest.mark.destroy + def test_maverick_android(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): -@pytest.mark.uc_sanity -@allure.feature("SDK REST API") -@pytest.mark.gateway_ap_api -class TestAP(object): - @pytest.mark.Namooo - def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): for ap in get_configuration['access_point']: cmd = "uci show ucentral" print(get_configuration['access_point']) @@ -23,70 +33,40 @@ def test_ap_reboot(self, setup_controller, get_configuration, get_apnos): iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) - allure.attach(name="Status before reboot:", body=str(gw, connected, iwinfo)) - device_name = get_configuration['access_point'][0]['serial'] - payload = { - "serialNumber": device_name, - "when": 0 - } - resp = setup_controller.ap_reboot(device_name, payload) - time.sleep(120) - print(resp.json()) - allure.attach(name="Reboot", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw1 = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw1) - connected1, latest1, active1 = ap_ssh.get_ucentral_status() - print("Connected1:") - print(connected1) - iwinfo1 = ap_ssh.get_iwinfo() - print("iwinfo1:") - print(iwinfo1) - allure.attach(name="Status after reboot:", body=str(gw1, connected1, iwinfo1)) - assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + maverick = ap_ssh.set_maverick() + print("maverick:") + print(maverick) - def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos): - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw) - connected, latest, active = ap_ssh.get_ucentral_status() - print("Connected:") - print(connected) iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) - allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo)) - device_name = get_configuration['access_point'][0]['serial'] - payload = { - "serialNumber": device_name, - "when": 0, - "keepRedirector": True - } - resp = setup_controller.ap_factory_reset(device_name, payload) - time.sleep(150) - print(resp.json()) - allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON) - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw1 = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw1) - connected1, latest1, active1 = ap_ssh.get_ucentral_status() - print("Connected1:") - print(connected1) - iwinfo1 = ap_ssh.get_iwinfo() - print("iwinfo1:") - print(iwinfo1) - allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1)) - assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1) + for key, value in iwinfo.items(): + print(key, ' : ', value[0]) + ssidName = "Maverick-6AE4A3" + ssidPassword = "[BLANK]" + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_maverick_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + # + if is_internet: + if ip: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + + assert verify_open_mav_android(request, setup_perfectoMobile_android, connData) + wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + else: + allure.attach(name="Connection Status: ", body=str("No Internet access")) + assert True diff --git a/tests/e2e/interOp/Maverick/android/test_maverick2.py b/tests/e2e/interOp/Maverick/android/test_maverick2.py index 9ef0cffb768..aa2d1b58c83 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick2.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick2.py @@ -2,18 +2,21 @@ import pytest import sys import allure +import string +import random + if 'perfecto_libs' not in sys.path: sys.path.append(f'../libs/perfecto_libs') pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.ToggleWifiMode, - pytest.mark.client_reconnect, pytest.mark.enterprise] + pytest.mark.client_reconnect,pytest.mark.ToggleAirplaneMode] +from android_lib import closeApp, openApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, Toggle_WifiMode_android, ForgetWifiConnection, openApp, get_ip_address_maverick_and, gets_ip_add_for_checking_and_forgets_ssid @allure.feature("Maverick") -@pytest.mark.maverick class TestMaverick(object): @pytest.mark.nolme - def test_ap_maverick(self,request, lf_tools, setup_controller, get_vif_state, get_configuration, get_ap_logs, get_apnos): + def test_ap_maverick(self,request, lf_tools, setup_controller, get_vif_state, get_configuration, get_ToggleAirplaneMode_data, get_ToggleWifiMode_data, setup_perfectoMobile_android, get_APToMobileDevice_data, get_ap_logs, get_apnos): for ap in get_configuration['access_point']: cmd = "uci show ucentral" print(get_configuration['access_point']) @@ -31,9 +34,49 @@ def test_ap_maverick(self,request, lf_tools, setup_controller, get_vif_state, ge print("maverick:") print(maverick) # reboot = ap_ssh.reboot() - # print("rebooted") + # print("reboot:") # print(reboot) - return True + + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + # for i in iwinfo: + # print(i) + # print(iwinfo) + # # print(i[0]) + # print('The result is:',i) + # # print(i.wlan0[0]) + for key, value in iwinfo.items(): + print(key, ' : ', value[0]) + ssidName = "Maverick-6AE4A3" + ssidPassword = "[BLANK]" + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + + + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + ip, is_internet = get_ip_address_maverick_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + if ip: + if is_internet: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "without internet") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + assert True + else: + allure.attach(name="Connection Status: ", body=str("Device is Unable to connect")) + assert False + verifyUploadDownloadSpeed_mav_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data) + print("Succesfully displayed mav page!") + assert True + + + diff --git a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py new file mode 100644 index 00000000000..93842633d6d --- /dev/null +++ b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py @@ -0,0 +1,80 @@ +from logging import exception +import io +import unittest +import warnings +from perfecto.test import TestResultFactory +import pytest +import sys +import time +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.by import By +from appium import webdriver +from selenium.common.exceptions import NoSuchElementException + +import sys +import allure + +if 'perfecto_libs' not in sys.path: + sys.path.append(f'../libs/perfecto_libs') + +from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ + Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ + verifyUploadDownloadSpeediOS, get_ip_address_ios,get_ip_address_maverick_ios, wifi_connect, wifi_disconnect_and_forget + +pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, + pytest.mark.client_connectivity, pytest.mark.interop_uc_sanity, pytest.mark.nat] +class TestMaverickIOS(object): + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4526", name="WIFI-4526") + @pytest.mark.spoil + def test_maverick_ios(self, request, get_configuration, get_apnos, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, get_APToMobileDevice_data, + setup_perfectoMobile_iOS): + + for ap in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + maverick = ap_ssh.set_maverick() + print("maverick:") + print(maverick) + + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + for key, value in iwinfo.items(): + print(key, ' : ', value[0]) + ssidName = "Maverick-6AE4A3" + ssidPassword = "[BLANK]" + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) + + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_maverick_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + if is_internet: + if ip: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + + assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData) + wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + else: + allure.attach(name="Connection Status: ", body=str("No Internet access")) + assert False + diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index 1660d57bf93..70a5f779f87 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -106,6 +106,25 @@ def get_ToggleAirplaneMode_data(request, get_device_configuration): } yield passPoint_data +@pytest.fixture(scope="function") +def get_maverick_google_search_data(request, get_device_configuration): + passPoint_data = { + "webURL": "https://www.google.com", + "lblSearch": "//*[@class='gLFyf']", + "elelSearch": "(//*[@class='sbic sb43'])[1]", + "TipMaverickPage": "//*[text()='192.168.1.1']", + "bundleId-iOS-Settings": get_device_configuration["bundleId-iOS-Settings"], + "bundleId-iOS-Safari": get_device_configuration["bundleId-iOS-Safari"], + # "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", + # "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", + # Android + "platformName-android": get_device_configuration["platformName-android"], + "appPackage-android": get_device_configuration["appPackage-android"] + } + yield passPoint_data + + + @pytest.fixture(scope="function") def get_ToggleWifiMode_data(request,get_device_configuration): From d10aa99cacbe50f9acd27e4cbc1b58878767c7dd Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Wed, 8 Jun 2022 12:48:19 +0530 Subject: [PATCH 18/25] Maverick android Signed-off-by: Jyothsna-setti --- libs/perfecto_libs/android_lib.py | 236 +++++++----------- tests/conftest.py | 2 - .../e2e/interOp/Maverick/android/test_mav.py | 0 .../interOp/Maverick/android/test_maverick.py | 20 +- 4 files changed, 107 insertions(+), 151 deletions(-) create mode 100644 tests/e2e/interOp/Maverick/android/test_mav.py diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index bb30a98a7f8..9cbb9675762 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -21,6 +21,11 @@ from appium.webdriver.common.mobileby import MobileBy from selenium.webdriver.support import expected_conditions as EC from appium import webdriver +from selenium import webdriver +from selenium.common.exceptions import TimeoutException +from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 +import time + import allure @@ -586,8 +591,13 @@ def verifyUploadDownloadSpeed_android(request, setup_perfectoMobile, get_APToMob report.step_start("Google Home Page") driver.get(connData["webURL"]) print("Enter Search Text") - elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) + # elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) + # elementFindTxt.send_keys("Internet Speed Test") + elementFindTxt = driver.find_element_by_xpath("//*[@resource-id='com.google.android.googlequicksearchbox:id/search_edit_frame']") + elementFindTxt.click() elementFindTxt.send_keys("Internet Speed Test") + + except Exception as e: print("Launching Chrome Failed") print (e) @@ -8679,28 +8689,6 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil except: print("Couldn't find auto reconnect element") - # ------------------------------- Forget SSID ---------------- - # try: - # check_if_no_internet_popup(driver) - # forget_ssid = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") - # forget_ssid.click() - # print("Forgetting ssid") - # - # # ------------------------------- Wifi Switch ---------------- - # # try: - # # print("clicking on wifi switch") - # # get_switch_element = driver.find_element_by_xpath( - # # "//*[@resource-id='com.android.settings:id/switch_widget']") - # # driver.implicitly_wait(2) - # # get_switch_element.click() - # # except: - # # print("couldn't click on wifi switch") - # # #allure.attach(name= body=str("couldn't click on wifi switch")) - # except: - # print("Couldn't forget ssid") - # # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- @@ -8771,29 +8759,6 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("Unable to get IP address") pass - # report.step_start("Forget SSID") - # - # try: - # check_if_no_internet_popup(driver) - # forget_ssid = driver.find_element_by_xpath( - # "//*[@text='Forget']") - # forget_ssid.click() - # print("Forgetting ssid") - # - # # ------------------------------- Wifi Switch ---------------- - # # try: - # # print("clicking on wifi switch") - # # get_switch_element = driver.find_element_by_xpath( - # # "//*[@resource-id='com.android.settings:id/switch_widget']") - # # driver.implicitly_wait(2) - # # get_switch_element.click() - # # except: - # # print("couldn't click on wifi switch") - # # #allure.attach(name= body=str("couldn't click on wifi switch")) - # except: - # print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") # ------------------------------------------------------- @@ -9149,128 +9114,109 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil def return_open_maverickpage_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data): print("\n-------------------------------------") - print("Verify Upload & Download Speed") + print("OPEN TIP MAVERICK PAGE...........!!!!") print("-------------------------------------") - report = setup_perfectoMobile_android[1] driver = setup_perfectoMobile_android[0] connData = get_APToMobileDevice_data - currentResult=False - driver.switch_to.context('WEBVIEW_1') - try: - print("Launching Chrome") - report.step_start("Google Home Page") - driver.get(connData["webURL"]) - print("Enter Search Text") - elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) - elementFindTxt.send_keys("192.168.1.1") + contexts = driver.contexts + print("Printing Context") + print(contexts) + driver.get("http://192.168.1.1") + print(driver.get("http://192.168.1.1")) + print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@#$") + try: + # password_maverick = driver.find_element_by_xpath("//*[@class='cbi-value cbi-value-last']//*[@class='cbi-value-field']") + # password_maverick.click() + # driver.getKeyboard().sendKeys("openwifi") + # # print(password_maverick.send_keys(password)) + # print("keys entered successfully") + # # button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") + # # button_maverick.click() + # # print("Login button clicked successfully") + Pass = "openwifi" + Password = driver.find_element_by_xpath("//*[@name='luci_password']") + # Password.click() + Password.send_keys(Pass) + print("keys entered successfully!!!!!!!!!!!!!!!!") + button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") + button_maverick.click() + print("Login button clicked successfully") + + # popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/button_secondary']") + # popup_maverick.click() + # try: + # popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/infobar_close_button']") + # popup_maverick.click() + # except: + # print("uanble to close popup") + + reboot_btn = driver.find_element_by_xpath("//a[text()='System']") + reboot_btn.click() + print("reboot button clicked successfully") + + + except: + print("unable to click Password feild") + except Exception as e: print("Launching Chrome Failed") print (e) - # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) - # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) - # try: - # print("Click Search Button") - # report.step_start("Click Search Button") - # time.sleep(2) - # driver.implicitly_wait(2) - # elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") - # elelSearch.click() - # except: - # try: - # time.sleep(2) - # driver.implicitly_wait(2) - # elelSearch = driver.find_element_by_xpath("//*[@class='aajZCb']//*[@class='nz2CCf']/li[1]/div[2]") - # elelSearch.click() - # except: - # print("Search Drop Down not active...") - # return False - # - # try: - # print("Click Run Speed Test Button...") - # report.step_start("Click Run Speed Test Button") - # driver.find_element_by_xpath(connData["BtnRunSpeedTest"]).click() - # except NoSuchElementException: - # print("Error in speed test element ", NoSuchElementException) - # # allure.attach(name="Speed Test logs: ", body=str("Search Run Speed Test not active..." + NoSuchElementException)) - # return False - # - # #Get upload/Download Speed - # try: - # print("Get Download Speed") - # report.step_start("Get upload/Download Speed") - # time.sleep(60) - # downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) - # downloadSpeed = downloadMbps.text - # print("Download: " + downloadSpeed + " Mbps") - # - # print("Get Upload Speed") - # report.step_start("Get Upload Speed") - # UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) - # uploadSpeed = UploadMbps.text - # print("Upload: " + uploadSpeed + " Mbps") - # allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) - # print("Access Point Verification Completed Successfully") - # currentResult = True - # except NoSuchElementException: - # print("Access Point Verification NOT Completed, checking Connection....") - # - return currentResult - - -def verify_open_mav_android(request, setup_perfectoMobile_android, get_APToMobileDevice_data): +def return_open_maverickpage_android1(request, setup_perfectoMobile_android, get_APToMobileDevice_data): print("\n-------------------------------------") - print("Verify Upload & Download Speed") + print("OPEN TIP MAVERICK PAGE...........!!!!") print("-------------------------------------") - report = setup_perfectoMobile_android[1] driver = setup_perfectoMobile_android[0] connData = get_APToMobileDevice_data - currentResult=False - driver.switch_to.context('WEBVIEW_1') - try: - print("Launching Chrome") + contexts = driver.contexts + print("Printing Context") + print(contexts) + driver.get("http://192.168.1.1") + print(driver.get("http://192.168.1.1")) + print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@#$") + try: + report.step_start("Entering Password") + Pass = "openwifi" + Password = driver.find_element_by_xpath("//*[@name='luci_password']") + Password.send_keys(Pass) + print("keys entered successfully!!!!!!!!!!!!!!!!") + report.step_start("Clicking Login button") + + button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") + button_maverick.click() + print("Login button clicked successfully") + + report.step_start("PopUp") + popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/button_secondary']") + popup_maverick.click() + report.step_start("Clicking Reboot button") + + reboot_btn = driver.find_element_by_xpath("//a[text()='System']") + reboot_btn.click() + print("reboot button clicked successfully") + + except: + print("unable to enter credentials") - report.step_start("Google Home Page") - driver.get(connData["webURL"]) - print("Enter Search Text") - elementFindTxt = driver.find_element_by_xpath(connData["// *[ @ resource - id = 'com.google.android.googlequicksearchbox:id/googleapp_search_box']"]) - elementFindTxt.send_text("192.168.1.1") - print("type something") except Exception as e: print("Launching Chrome Failed") print (e) - # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) - # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) - return False - #Get upload/Download Speed - # try: - # print("Get Download Speed") - # report.step_start("Get upload/Download Speed") - # time.sleep(60) - # downloadMbps = driver.find_element_by_xpath(connData["downloadMbps"]) - # downloadSpeed = downloadMbps.text - # print("Download: " + downloadSpeed + " Mbps") - # - # print("Get Upload Speed") - # report.step_start("Get Upload Speed") - # UploadMbps = driver.find_element_by_xpath(connData["UploadMbps"]) - # uploadSpeed = UploadMbps.text - # print("Upload: " + uploadSpeed + " Mbps") - # allure.attach(name="Speed Test logs: ", body=str("Upload: " + uploadSpeed + " Mbps" + " Download: " + downloadSpeed + " Mbps")) - # print("Access Point Verification Completed Successfully") - # currentResult = True - # except NoSuchElementException: - # print("Access Point Verification NOT Completed, checking Connection....") - # - return currentResult + + + + + + + + diff --git a/tests/conftest.py b/tests/conftest.py index e5a6054057a..af36a905576 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -284,8 +284,6 @@ def get_device_configuration(device, request): def get_apnos(): """yields the LIBRARY for APNOS, Reduces the use of imports across files""" yield APNOS - - @pytest.fixture(scope="session") def get_equipment_ref(request, setup_controller, testbed, get_configuration): """""" diff --git a/tests/e2e/interOp/Maverick/android/test_mav.py b/tests/e2e/interOp/Maverick/android/test_mav.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index ac0f383b374..925b895af8c 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -9,8 +9,8 @@ pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.client_connectivity ,pytest.mark.interop_uc_sanity, pytest.mark.nat] -from android_lib import closeApp, set_APconnMobileDevice_android, verify_open_mav_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \ - get_ip_address_maverick_and, wifi_disconnect_and_forget +from android_lib import closeApp,return_open_maverickpage_android, set_APconnMobileDevice_android, verify_open_mav_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \ + get_ip_address_maverick_and,verify_open_mav_android, wifi_disconnect_and_forget class TestNatModeConnectivitySuiteOne(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") @@ -40,6 +40,9 @@ def test_maverick_android(self, request, get_vif_state, get_apnos, get_configura iwinfo = ap_ssh.get_iwinfo() print("iwinfo:") print(iwinfo) + # reboot = ap_ssh.reboot() + # print("reboot:") + # print(reboot) for key, value in iwinfo.items(): print(key, ' : ', value[0]) ssidName = "Maverick-6AE4A3" @@ -64,9 +67,18 @@ def test_maverick_android(self, request, get_vif_state, get_apnos, get_configura print(text_body) allure.attach(name="Connection Status: ", body=str(text_body)) - assert verify_open_mav_android(request, setup_perfectoMobile_android, connData) - wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) + return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) else: allure.attach(name="Connection Status: ", body=str("No Internet access")) assert True + @pytest.mark.Mavtra + def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, + get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) + assert True + From 1f7a49328846852679d749550e578d96bee6dee3 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 10 Jun 2022 13:06:18 +0530 Subject: [PATCH 19/25] maverick testcases Signed-off-by: Jyothsna-setti --- libs/apnos/apnos.py | 38 +- libs/perfecto_libs/android_lib.py | 143 ++----- libs/perfecto_libs/iOS_lib.py | 394 +++++++++++++++++- .../interOp/Maverick/android/test_maverick.py | 114 ++--- .../Maverick/android/test_maverick_ios.py | 84 ++-- tests/e2e/interOp/conftest.py | 58 ++- 6 files changed, 557 insertions(+), 274 deletions(-) diff --git a/libs/apnos/apnos.py b/libs/apnos/apnos.py index 8a79e15463e..c68f0ee15e5 100644 --- a/libs/apnos/apnos.py +++ b/libs/apnos/apnos.py @@ -469,6 +469,21 @@ def set_maverick(self): print(e) return maverick_bssid_data + # def imav(self, get_apnos, get_configuration): + # for access_point in get_configuration['access_point']: + # ap_ssh = get_apnos(access_point, pwd="../libs/apnos/", sdk="2.x") + # maverick = ap_ssh.set_maverick() + # print("maverick:") + # print(maverick) + # iwinfo = ap_ssh.get_iwinfo() + # print("iwinfo:") + # print(iwinfo) + # return iwinfo + # for key, value in iwinfo.items(): + # # print(key, ' : ',value) + # # print(value) + + def get_iwinfo(self): try: @@ -509,17 +524,18 @@ def iwinfo(self): client.close() return o - def set_maverick(self): - client = self.ssh_cli_connect() - cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh" - if self.mode: - cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ - f"cmd --value \"{cmd}\" " - stdin, stdout, stderr = client.exec_command(cmd) - output = stdout.read().replace(b":~# /etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh ", b"").decode('utf-8') - o = output - client.close() - return o + + # def set_maverick(self, get_configuration, get_apnos): + # client = self.ssh_cli_connect() + # cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh" + # if self.mode: + # cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ + # f"cmd --value \"{cmd}\" " + # stdin, stdout, stderr = client.exec_command(cmd) + # output = stdout.read().replace(b":~# /etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh ", b"").decode('utf-8') + # o = output + # client.close() + # return o def gettxpower(self): diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index 9cbb9675762..ecdf925f898 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -9058,41 +9058,18 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - # try: - # print("Launching Chrome") - # report.step_start("Google Home Page") - # driver.get(connData["webURL"]) - # print("Enter Search Text") - # elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) - # elementFindTxt.send_keys("192.168.1.1") - # except Exception as e: - # print("Launching Chrome Failed") - # print(e) - # # allure.attach(name="Speed Test logs: ", body=str("Launching Safari Failed")) - # # allure.attach(name="Speed Test logs: ", body=str("Error log: " + e)) - #------------------------------- Forget SSID ---------------- - try: - check_if_no_internet_popup(driver) - forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") - forget_ssid.click() - print("Forgetting ssid") - # ------------------------------- Wifi Switch ---------------- - try: - print("clicking on wifi switch") - get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") - driver.implicitly_wait(2) - get_switch_element.click() - except: - print("couldn't click on wifi switch") - # allure.attach(name= body=str("couldn't click on wifi switch")) + # ------------------------------- Wifi Switch ---------------- + try: + print("clicking on wifi switch") + get_switch_element = driver.find_element_by_xpath( + "//*[@resource-id='com.android.settings:id/switch_widget']") + driver.implicitly_wait(2) + get_switch_element.click() except: - print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) - # return ip_address_element_text, ssid_with_internet + print("couldn't click on wifi switch") + # allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't get into Additional settings") # ------------------------------------------------------- @@ -9122,93 +9099,45 @@ def return_open_maverickpage_android(request, setup_perfectoMobile_android, get_ currentResult=False driver.switch_to.context('WEBVIEW_1') try: + driver.switch_to.context('WEBVIEW_1') contexts = driver.contexts print("Printing Context") print(contexts) driver.get("http://192.168.1.1") print(driver.get("http://192.168.1.1")) - print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@#$") - try: - # password_maverick = driver.find_element_by_xpath("//*[@class='cbi-value cbi-value-last']//*[@class='cbi-value-field']") - # password_maverick.click() - # driver.getKeyboard().sendKeys("openwifi") - # # print(password_maverick.send_keys(password)) - # print("keys entered successfully") - # # button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") - # # button_maverick.click() - # # print("Login button clicked successfully") - Pass = "openwifi" - Password = driver.find_element_by_xpath("//*[@name='luci_password']") - # Password.click() - Password.send_keys(Pass) - print("keys entered successfully!!!!!!!!!!!!!!!!") - button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") - button_maverick.click() - print("Login button clicked successfully") - - # popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/button_secondary']") - # popup_maverick.click() - # try: - # popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/infobar_close_button']") - # popup_maverick.click() - # except: - # print("uanble to close popup") - - reboot_btn = driver.find_element_by_xpath("//a[text()='System']") - reboot_btn.click() - print("reboot button clicked successfully") - - - except: - print("unable to click Password feild") - - except Exception as e: - print("Launching Chrome Failed") - print (e) - -def return_open_maverickpage_android1(request, setup_perfectoMobile_android, get_APToMobileDevice_data): - print("\n-------------------------------------") - print("OPEN TIP MAVERICK PAGE...........!!!!") - print("-------------------------------------") - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_APToMobileDevice_data - currentResult=False - driver.switch_to.context('WEBVIEW_1') - try: - contexts = driver.contexts - print("Printing Context") - print(contexts) - driver.get("http://192.168.1.1") - print(driver.get("http://192.168.1.1")) - print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@#$") + print("successfully connected to the gateway") try: report.step_start("Entering Password") Pass = "openwifi" Password = driver.find_element_by_xpath("//*[@name='luci_password']") Password.send_keys(Pass) - print("keys entered successfully!!!!!!!!!!!!!!!!") - report.step_start("Clicking Login button") - - button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") - button_maverick.click() - print("Login button clicked successfully") - - report.step_start("PopUp") - popup_maverick = driver.find_element_by_xpath("//*[@resource-id='com.android.chrome:id/button_secondary']") - popup_maverick.click() - report.step_start("Clicking Reboot button") - - reboot_btn = driver.find_element_by_xpath("//a[text()='System']") - reboot_btn.click() - print("reboot button clicked successfully") - + print("Password entered successfully") + try: + report.step_start("Clicking Login btn ") + button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") + button_maverick.click() + print("Login button clicked successfully") + try: + report.step_start("Clicking System btn ") + system = driver.find_element_by_xpath("//a[text()='System']") + system.click() + print("clicked System Button") + try: + report.step_start("Clicking Reboot btn ") + reboot = driver.find_element_by_xpath("//*[text()='Reboot']") + reboot.click() + print("Reboot Button clicked") + except: + print("unable to click Reboot Button") + except: + print("unable to click System Button") + except: + print("unable to click Login Button") except: - print("unable to enter credentials") - + print("unable to click Password feild") except Exception as e: - print("Launching Chrome Failed") - print (e) + print("Launching Safari Failed") + print(e) diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index 80baf20dcf3..371bbf7a7b0 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -3325,11 +3325,11 @@ def return_upload_download_speed_iOS(request, setup_perfectoMobile, get_APToMobi return downloadSpeed, uploadSpeed -def get_ip_address_maverick_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData): +def get_ip_address_maverick2_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("\n-------------------------------------") - print("Select Wifi/Get IP Address IOS Connection") + print("Select Wifi/AccessPoint Connection") print("-------------------------------------") - + print("Verifying Wifi Connection Details....") reportFlag = True is_internet = False ip_address_element_text = False @@ -3581,23 +3581,6 @@ def get_ip_address_maverick_ios(request, WifiName, WifiPass, setup_perfectoMobil print("IP Address not Found") request.config.cache.set(key="select IP failed", value=str(e)) - try: - report.step_start("Forget Network") - forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']"))) - forget_ssid.click() - print("Forget old ssid") - # time.sleep(2) - # driver.implicitly_wait(3) - try: - report.step_start("Forget Network popup") - forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']"))) - forget_ssid_popup.click() - except: - print("in popup exception") - - except: - print("error on ssid element") - # --------------------To Turn on WIFi Switch if already OFF-------------------------------- # try: # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") @@ -3675,3 +3658,374 @@ def verifyUploadDownloadSpeediOS(request, setup_perfectoMobile, get_APToMobileDe return currentResult +def get_ip_address_maverick_iOS(request, WifiName, WifiPass, setup_perfectoMobile, connData): + print("\n-------------------------------------") + print("Select Wifi/Get IP Address IOS Connection") + print("-------------------------------------") + + reportFlag = True + is_internet = False + ip_address_element_text = False + + print("Verifying Wifi/AP Connection Details....") + report = setup_perfectoMobile[1] + driver = setup_perfectoMobile[0] + + report.step_start("Switching Driver Context") + print("Switching Context to Native") + driver.switch_to.context('NATIVE_APP') + # driver.switch_to.context(contexts[0]) + + report.step_start("Set Wifi Network to " + WifiName) + # Open Settings Application + openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + + try: + time.sleep(2) + driver.implicitly_wait(2) + try: + print("Verifying Connected Wifi Connection") + report.step_start("Loading Wifi Page") + element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']") + element.click() + except NoSuchElementException: + print("Exception: Verify Xpath - unable to click on Wifi") + + time.sleep(2) + driver.implicitly_wait(4) + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + try: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + get_wifi_switch_element_text = get_wifi_switch_element.text + try: + if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + driver.implicitly_wait(1) + get_wifi_switch_element.click() + driver.implicitly_wait(1) + i = 0 + for i in range(5): + try: + get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + get_wifi_switch_element_text = get_wifi_switch_element.text + except: + print("Switch is OFF") + + if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + print("WIFI Switch is ON") + break + else: + try: + get_wifi_switch_element = driver.find_element_by_xpath( + "//*[@label='Wi-Fi' and @value='0']") + get_wifi_switch_element_text = get_wifi_switch_element.text + except: + print("WIFi switch is ON") + if (get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0): + print("switch is still OFF") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + else: + print("Switch is Still OFF") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + except: + print("No switch element found") + except: + print("get_wifi_switch_element is ON") + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + + except: + print("Cannot find WIFI element") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + + # ---------------------This is to Forget current connected SSID------------------------------- + + try: + time.sleep(4) + print("getting in to Additional details") + report.step_start("Clicking More Info") + additional_details_element = driver.find_element_by_xpath("//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']") + additional_details_element.click() + try: + time.sleep(2) + print("Forget Connected Network") + forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']"))) + forget_ssid.click() + print("Forget old ssid") + try: + time.sleep(2) + report.step_start("Forget SSID popup1") + forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']"))) + forget_ssid_popup.click() + + print("**alert** Forget SSID popup killed **alert**") + except: + print("Forget SSID popup not found") + except: + print("couldn't find forget ssid element") + except: + print("No connected SSID") + + # ---------------------This is to Forget current connected SSID------------------------------- + + # ---------------------To get all available SSID------------------------------- + print("Searching for Wifi: " + WifiName) + # allure.attach(name= body=str("Searching for Wifi: " + WifiName)) + time.sleep(2) + report.step_start("Searching SSID") + print("Selecting Wifi: " + WifiName) + ssid_found = False + available_ssids = False + + try: + for check_for_all_ssids in range(9): + available_ssids = get_all_available_ssids(driver) + allure.attach(name="Available SSIDs in device: ", body=str(available_ssids)) + try: + if (not ssid_Visible(driver, WifiName)) or (WifiName not in available_ssids): + scrollDown(setup_perfectoMobile) + time.sleep(2) + else: + try: + driver.implicitly_wait(8) + report.step_start("Selecting SSID To Connect") + ssid_found = True + print(WifiName + " : Found in Device") + wifiSelElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']"))) + print(wifiSelElement) + wifiSelElement.click() + print("Selecting SSID") + break + except: + print("SSID unable to select") + report.step_start("Selecting Unable SSID To Connect") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + + except: + print("couldn't connect to " + WifiName) + #request.config.cache.set(key="SelectingWifiFailed", value=str(e)) + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + pass + + if not ssid_found: + print("could not found " + WifiName + " in device") + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + except: + pass + # ---------------------To get all available SSID------------------------------- + + # ---------------------This is to Select SSID------------------------------- + + # ---------------------This is to Select SSID------------------------------- + # ---------------------Set Password------------------------------- + try: + driver.implicitly_wait(5) + print("Entering Password") + report.step_start("Entering Password") + wifiPassword = driver.find_element_by_xpath("//*[@label='Password']") + wifiPassword.send_keys(WifiPass) + except NoSuchElementException: + print("Enter Password Page Not Loaded") + # ---------------------Set Password------------------------------- + + # ---------------------Click on join------------------------------- + try: + driver.implicitly_wait(4) + print("Selecting join") + report.step_start("Clicking JOIN") + joinBTN = driver.find_element_by_xpath("//*[@label='Join']") + joinBTN.click() + except Exception as e: + print("Join Button Not Enabled...Password may not be needed") + # ---------------------Click on join------------------------------- + + # ---------------------check if internet------------------------------- + try: + driver.implicitly_wait(5) + WifiInternetErrMsg2 = driver.find_element_by_xpath("//*[@label='No Internet Connection']") + # = driver.find_element_by_xpath("//*[@label='No Internet Connection']").text + except Exception as e: + is_internet = True + print("No Wifi-AP Error Internet Error: " + WifiName) + # Need to add Wait for Selected Wifi Xpath + # time.sleep(3) + # ---------------------check if internet------------------------------- + + # ---------------------Additional INFO------------------------------- + try: + driver.implicitly_wait(5) + print("Selecting SSID: ", WifiName) + report.step_start("Additional details of SSID") + additional_details_element = WebDriverWait(driver, 35).until( + EC.presence_of_element_located((MobileBy.XPATH, + "//*[@label='" + WifiName + "']"))) + # //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info'] + additional_details_element.click() + + try: + driver.implicitly_wait(2) + report.step_start("Checking SSID Name as Expected") + print("Checking SSID Name") + ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text + print(ssidname_text) + if(ssidname_text == WifiName): + print("SSID Matched") + allure.attach(name="SSID Matched ", body=str(WifiName)) + else: + print("SSID Not Matched") + allure.attach(name="SSID Not Matched ", body=str(WifiName)) + reportFlag = False + assert reportFlag + except: + print("SSID is not Checked in more Info") + + try: + report.step_start("Checking WiFi Address") + print("Checking WIFI address") + # (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2] + wifi_address_element_text = driver.find_element_by_xpath( + "(//*[@label='Wi-Fi Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("wifi_address_element_text: ", wifi_address_element_text) + allure.attach(name="Connected SSID WiFi-Address: ", body=str(wifi_address_element_text)) + except Exception as e: + print("WiFi-Address not Found") + try: + time.sleep(4) + report.step_start("Checking IP Address") + print("Checking IP address") + # (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2] + ip_address_element_text = driver.find_element_by_xpath( + "(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("ip_address_element_text: ", ip_address_element_text) + except Exception as e: + try: + time.sleep(4) + print("Scrolling for checking ip address") + scrollDown(setup_perfectoMobile) + ip_address_element_text = driver.find_element_by_xpath( + "(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text + print("ip_address_element_text: ", ip_address_element_text) + except: + print("IP Address not Found") + request.config.cache.set(key="select IP failed", value=str(e)) + + # try: + # report.step_start("Forget Network") + # forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']"))) + # forget_ssid.click() + # print("Forget old ssid") + # # time.sleep(2) + # # driver.implicitly_wait(3) + # try: + # report.step_start("Forget Network popup") + # forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']"))) + # forget_ssid_popup.click() + # except: + # print("in popup exception") + # + # except: + # print("error on ssid element") + + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # print("switch state is : ", get_wifi_switch_element_text) + # try: + # if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']") + # driver.implicitly_wait(1) + # get_wifi_switch_element.click() + # driver.implicitly_wait(1) + # i = 0 + # for i in range(5): + # try: + # get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']") + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("switch is ON") + # + # if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0: + # print("WIFI Switch is OFF") + # break + # else: + # try: + # get_wifi_switch_element = driver.find_element_by_xpath( + # "//*[@label='Wi-Fi' and @value='1']") + # get_wifi_switch_element.click() + # get_wifi_switch_element_text = get_wifi_switch_element.text + # except: + # print("WIFi switch is OFF") + # + # else: + # print("Switch is Still OFF") + # except: + # pass + # except: + # print("get_wifi_switch_element is ON") + # --------------------To Turn on WIFi Switch if already OFF-------------------------------- + + except Exception as e: + request.config.cache.set(key="select additional info failed", value=str(e)) + # ---------------------Additional INFO------------------------------- + + # --------------------- close app------------------------------- + closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) + return ip_address_element_text, is_internet + # ---------------------close app------------------------------- + +def return_open_maverickpage_iOS(request, setup_perfectoMobile_iOS, get_APToMobileDevice_data): + print("\n-------------------------------------") + print("OPEN TIP MAVERICK PAGE...........!!!!") + print("-------------------------------------") + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_APToMobileDevice_data + currentResult = True + driver.switch_to.context('WEBVIEW_1') + try: + driver.switch_to.context('WEBVIEW_1') + contexts = driver.contexts + print("Printing Context") + print(contexts) + driver.get("http://192.168.1.1") + print(driver.get("http://192.168.1.1")) + print("successfully connected to the gateway") + try: + report.step_start("Entering Password") + Pass = "openwifi" + Password = driver.find_element_by_xpath("//*[@name='luci_password']") + Password.send_keys(Pass) + print("Password entered successfully") + try: + report.step_start("Clicking Login btn ") + button_maverick = driver.find_element_by_xpath("//*[@class='btn cbi-button cbi-button-apply']") + button_maverick.click() + print("Login button clicked successfully") + try: + report.step_start("Clicking System btn ") + system = driver.find_element_by_xpath("//a[text()='System']") + system.click() + print("clicked System Button") + try: + report.step_start("Clicking Reboot btn ") + reboot = driver.find_element_by_xpath("//*[text()='Reboot']") + reboot.click() + print("Reboot Button clicked") + except: + print("unable to click Reboot Button") + except: + print("unable to click System Button") + except: + print("unable to click Login Button") + except: + print("unable to click Password feild") + except Exception as e: + print("Launching Safari Failed") + print(e) + diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 925b895af8c..88adbaf53ec 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -1,84 +1,60 @@ import pytest -import sys -import sys import allure +import sys + + if 'perfecto_libs' not in sys.path: sys.path.append(f'../libs/perfecto_libs') -pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.client_connectivity - ,pytest.mark.interop_uc_sanity, pytest.mark.nat] +pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, + pytest.mark.client_connectivity + , pytest.mark.interop_uc_sanity, pytest.mark.nat] -from android_lib import closeApp,return_open_maverickpage_android, set_APconnMobileDevice_android, verify_open_mav_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \ - get_ip_address_maverick_and,verify_open_mav_android, wifi_disconnect_and_forget +from android_lib import closeApp, return_open_maverickpage_android, set_APconnMobileDevice_android, \ + Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \ + get_ip_address_maverick_and, wifi_disconnect_and_forget -class TestNatModeConnectivitySuiteOne(object): + +class TestMaverickAndroid(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") - @pytest.mark.fiveg - @pytest.mark.wpa2_personal + @pytest.mark.maverickAnd @pytest.mark.destroy - def test_maverick_android(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw) - connected, latest, active = ap_ssh.get_ucentral_status() - print("Connected:") - print(connected) - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) - maverick = ap_ssh.set_maverick() - print("maverick:") - print(maverick) - - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) - # reboot = ap_ssh.reboot() - # print("reboot:") - # print(reboot) - for key, value in iwinfo.items(): - print(key, ' : ', value[0]) - ssidName = "Maverick-6AE4A3" - ssidPassword = "[BLANK]" - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) - + def test_maverick_android(self, request, get_vif_state, get_ap_logs, currentmav, + get_ToggleAirplaneMode_data,get_configuration, setup_perfectoMobile_android): + ssidName = currentmav + ssidPassword = "[BLANK]" + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) - report = setup_perfectoMobile_android[1] - driver = setup_perfectoMobile_android[0] - connData = get_ToggleAirplaneMode_data - - # Set Wifi/AP Mode - ip, is_internet = get_ip_address_maverick_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData) - # - if is_internet: - if ip: - text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") - else: - text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") - print(text_body) - allure.attach(name="Connection Status: ", body=str(text_body)) - - return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) - - else: - allure.attach(name="Connection Status: ", body=str("No Internet access")) - assert True - @pytest.mark.Mavtra - def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, - get_ToggleAirplaneMode_data, setup_perfectoMobile_android): report = setup_perfectoMobile_android[1] driver = setup_perfectoMobile_android[0] connData = get_ToggleAirplaneMode_data - return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) - assert True - + # Set Wifi/AP Mode + ip, is_internet = get_ip_address_maverick_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, + connData) + # + if is_internet: + if ip: + text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") + else: + text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address") + print(text_body) + allure.attach(name="Connection Status: ", body=str(text_body)) + + return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) + else: + allure.attach(name="Connection Status: ", body=str("No Internet access")) + assert True + + # @pytest.mark.Mavtra + # def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, + # get_ToggleAirplaneMode_data, setup_perfectoMobile_android): + # report = setup_perfectoMobile_android[1] + # driver = setup_perfectoMobile_android[0] + # connData = get_ToggleAirplaneMode_data + # + # return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) + # assert True diff --git a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py index 93842633d6d..2fadf8868ba 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py @@ -1,69 +1,36 @@ -from logging import exception -import io -import unittest -import warnings -from perfecto.test import TestResultFactory import pytest import sys -import time -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.common.by import By -from appium import webdriver -from selenium.common.exceptions import NoSuchElementException - import sys import allure if 'perfecto_libs' not in sys.path: sys.path.append(f'../libs/perfecto_libs') -from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \ - Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\ - verifyUploadDownloadSpeediOS, get_ip_address_ios,get_ip_address_maverick_ios, wifi_connect, wifi_disconnect_and_forget - -pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, - pytest.mark.client_connectivity, pytest.mark.interop_uc_sanity, pytest.mark.nat] -class TestMaverickIOS(object): - - @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4526", name="WIFI-4526") - @pytest.mark.spoil - def test_maverick_ios(self, request, get_configuration, get_apnos, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, get_APToMobileDevice_data, - setup_perfectoMobile_iOS): +pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.iOS, pytest.mark.interop_iOS, pytest.mark.client_connectivity + ,pytest.mark.interop_uc_sanity, pytest.mark.nat] - for ap in get_configuration['access_point']: - cmd = "uci show ucentral" - print(get_configuration['access_point']) - ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x") - gw = ap_ssh.run_generic_command(cmd) - print("Status:") - print(gw) - connected, latest, active = ap_ssh.get_ucentral_status() - print("Connected:") - print(connected) - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) - maverick = ap_ssh.set_maverick() - print("maverick:") - print(maverick) - - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) - for key, value in iwinfo.items(): - print(key, ' : ', value[0]) - ssidName = "Maverick-6AE4A3" - ssidPassword = "[BLANK]" - print("SSID_NAME: " + ssidName) - print("SSID_PASS: " + ssidPassword) - get_vif_state.append(ssidName) +from iOS_lib import closeApp, set_APconnMobileDevice_iOS, Toggle_AirplaneMode_iOS, ForgetWifiConnection, openApp, \ + get_ip_address_maverick_iOS,return_open_maverickpage_iOS, wifi_disconnect_and_forget +class TestMaverickIOS(object): + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") + @pytest.mark.maverickIOS + @pytest.mark.destroyios + def test_maverick_ios(self, request, get_vif_state, get_ap_logs,currentmav, + get_ToggleAirplaneMode_data, get_configuration, setup_perfectoMobile_iOS): + + ssidName = currentmav + ssidPassword = "[BLANK]" + print("SSID_NAME: " + ssidName) + print("SSID_PASS: " + ssidPassword) + get_vif_state.append(ssidName) report = setup_perfectoMobile_iOS[1] driver = setup_perfectoMobile_iOS[0] connData = get_ToggleAirplaneMode_data # Set Wifi/AP Mode - ip, is_internet = get_ip_address_maverick_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + ip, is_internet = get_ip_address_maverick_iOS(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + # if is_internet: if ip: text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet") @@ -72,9 +39,18 @@ def test_maverick_ios(self, request, get_configuration, get_apnos, get_vif_state print(text_body) allure.attach(name="Connection Status: ", body=str(text_body)) - assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData) - wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData) + return_open_maverickpage_iOS(request, setup_perfectoMobile_iOS, connData) + else: allure.attach(name="Connection Status: ", body=str("No Internet access")) - assert False + assert True +# @pytest.mark.Mavtraios +# def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, +# get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): +# report = setup_perfectoMobile_iOS[1] +# driver = setup_perfectoMobile_iOS[0] +# connData = get_ToggleAirplaneMode_data +# +# return_open_maverick_iOS(request, setup_perfectoMobile_iOS, connData) +# assert True diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index 70a5f779f87..e11474458ba 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -106,6 +106,7 @@ def get_ToggleAirplaneMode_data(request, get_device_configuration): } yield passPoint_data + @pytest.fixture(scope="function") def get_maverick_google_search_data(request, get_device_configuration): passPoint_data = { @@ -124,10 +125,8 @@ def get_maverick_google_search_data(request, get_device_configuration): yield passPoint_data - - @pytest.fixture(scope="function") -def get_ToggleWifiMode_data(request,get_device_configuration): +def get_ToggleWifiMode_data(request, get_device_configuration): passPoint_data = { # iOS "bundleId-iOS-Settings": get_device_configuration["bundleId-iOS-Settings"], @@ -166,7 +165,6 @@ def instantiate_profile(request): yield UProfileUtility - @pytest.fixture(scope="session") def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware): firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware, @@ -222,11 +220,10 @@ def setup_vlan(): def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, skip_lf, get_openflow, run_lf, instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info): - param = dict(request.param) if not skip_lf: lf_tools.reset_scenario() - # VLAN Setup + # VLAN Setup if request.param["mode"] == "VLAN": vlan_list = list() @@ -252,7 +249,8 @@ def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtur instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, get_security_flags, get_configuration, radius_info, get_apnos, - radius_accounting_info, skip_lf=skip_lf, open_flow=get_openflow, run_lf=run_lf) + radius_accounting_info, skip_lf=skip_lf, open_flow=get_openflow, + run_lf=run_lf) print("sleeping for 120 sec.") time.sleep(180) print("Done sleeping") @@ -284,9 +282,9 @@ def failure_tracking_fixture(request): yield tests_failed_during_module - empty_get_vif_state_list = [] + @pytest.fixture(scope="class") def get_vif_state(get_apnos, get_configuration, request, lf_tools, skip_lf): if not skip_lf: @@ -299,6 +297,8 @@ def get_vif_state(get_apnos, get_configuration, request, lf_tools, skip_lf): yield lf_tools.ssid_list else: yield empty_get_vif_state_list + + @pytest.fixture(scope="class") def set_maverick(get_apnos, get_configuration, request, lf_tools, skip_lf, self): client = self.ssh_cli_connect() @@ -392,7 +392,6 @@ def pytest_runtest_makereport(item, call): def pytest_sessionfinish(session, exitstatus): - try: if reporting_client is not None: print() @@ -690,6 +689,8 @@ def teardown(): yield -1 else: yield driver, reporting_client + + # Does a HTTP GET request to Perfecto cloud and gets response and information related to a headset def response_device(request, model): securityToken = PERFECTO_DETAILS["securityToken"] @@ -698,6 +699,7 @@ def response_device(request, model): resp = requests.get(url=url) return ET.fromstring(resp.content) + # Get an attribute value from the handset response def get_attribute_device(responseXml, attribute): try: @@ -706,6 +708,7 @@ def get_attribute_device(responseXml, attribute): print(f"Unable to get value of {attribute} from response") return "" + # Checks to see if a particular handset is available def is_device_available(request, model): try: @@ -722,6 +725,7 @@ def is_device_available(request, model): print("The device is currently allocated to:" + allocated_to) return False + # Checks whether the device is available or not.If the device is not available rechecks depending upon the # Checks whether the device is available or not.If the device is not available rechecks depending upon the @@ -731,24 +735,25 @@ def is_device_Available_timeout(request, model): timerValue = 5 timerThreshold = 80 if not device_available: - while(timerValue <= timerThreshold): + while (timerValue <= timerThreshold): print("Last checked at:" + strftime("%Y-%m-%d %H:%M:%S", gmtime())) print(f"Waiting for: {timerValue} min(s)") - time.sleep(timerValue*60) + time.sleep(timerValue * 60) print("Checking now at:" + strftime("%Y-%m-%d %H:%M:%S", gmtime())) device_available = is_device_available(request, model) - if(device_available): + if (device_available): return True else: timerValue = timerValue + 5 - if(timerValue > timerThreshold): + if (timerValue > timerThreshold): return False else: return True else: return True + def get_device_attribuites(request, model, attribute): try: responseXml = response_device(request, model) @@ -760,3 +765,30 @@ def get_device_attribuites(request, model, attribute): except: attribute_value = False return attribute_value + + +@pytest.fixture(scope="class") +def currentmav(request, get_apnos, get_configuration): + for access_point in get_configuration['access_point']: + cmd = "uci show ucentral" + print(get_configuration['access_point']) + ap_ssh = get_apnos(access_point, pwd="../libs/apnos/", sdk="2.x") + gw = ap_ssh.run_generic_command(cmd) + print("Status:") + print(gw) + connected, latest, active = ap_ssh.get_ucentral_status() + print("Connected:") + print(connected) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + maverick = ap_ssh.set_maverick() + print("maverick:") + print(maverick) + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + for key, value in iwinfo.items(): + print(key, ' : ', value[0]) + aayu = value[0] + return aayu From 6a2e591b2b12dd3710e156b472d68c557f5965e2 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Fri, 10 Jun 2022 13:20:41 +0530 Subject: [PATCH 20/25] fixed markers Signed-off-by: Jyothsna-setti --- tests/e2e/interOp/Maverick/android/test_maverick.py | 1 - tests/e2e/interOp/Maverick/android/test_maverick_ios.py | 1 - tests/e2e/interOp/conftest.py | 7 ++----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 88adbaf53ec..9b27b1926b5 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -19,7 +19,6 @@ class TestMaverickAndroid(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") @pytest.mark.maverickAnd - @pytest.mark.destroy def test_maverick_android(self, request, get_vif_state, get_ap_logs, currentmav, get_ToggleAirplaneMode_data,get_configuration, setup_perfectoMobile_android): ssidName = currentmav diff --git a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py index 2fadf8868ba..e1e03c3ec4e 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick_ios.py @@ -15,7 +15,6 @@ class TestMaverickIOS(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-4536", name="WIFI-4536") @pytest.mark.maverickIOS - @pytest.mark.destroyios def test_maverick_ios(self, request, get_vif_state, get_ap_logs,currentmav, get_ToggleAirplaneMode_data, get_configuration, setup_perfectoMobile_iOS): diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index e11474458ba..2010fa46efb 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -779,9 +779,6 @@ def currentmav(request, get_apnos, get_configuration): connected, latest, active = ap_ssh.get_ucentral_status() print("Connected:") print(connected) - iwinfo = ap_ssh.get_iwinfo() - print("iwinfo:") - print(iwinfo) maverick = ap_ssh.set_maverick() print("maverick:") print(maverick) @@ -790,5 +787,5 @@ def currentmav(request, get_apnos, get_configuration): print(iwinfo) for key, value in iwinfo.items(): print(key, ' : ', value[0]) - aayu = value[0] - return aayu + final = value[0] + return final From 10de934e6317f05a3c6047cb012fa1307cfd1205 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Tue, 14 Jun 2022 12:02:20 +0530 Subject: [PATCH 21/25] maverick Signed-off-by: Jyothsna-setti --- libs/perfecto_libs/android_lib.py | 1 + .../interOp/Maverick/android/test_maverick.py | 26 +++++++++++-------- tests/e2e/interOp/conftest.py | 10 ++++++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index ecdf925f898..b9a6cb2514d 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -9127,6 +9127,7 @@ def return_open_maverickpage_android(request, setup_perfectoMobile_android, get_ reboot = driver.find_element_by_xpath("//*[text()='Reboot']") reboot.click() print("Reboot Button clicked") + time.sleep(120) except: print("unable to click Reboot Button") except: diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android/test_maverick.py index 9b27b1926b5..c040489c5ee 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick.py +++ b/tests/e2e/interOp/Maverick/android/test_maverick.py @@ -7,7 +7,7 @@ if 'perfecto_libs' not in sys.path: sys.path.append(f'../libs/perfecto_libs') -pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, +pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.MaverickAndroid, pytest.mark.android, pytest.mark.interop_and, pytest.mark.client_connectivity , pytest.mark.interop_uc_sanity, pytest.mark.nat] @@ -43,17 +43,21 @@ def test_maverick_android(self, request, get_vif_state, get_ap_logs, currentmav, print(text_body) allure.attach(name="Connection Status: ", body=str(text_body)) - return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) else: allure.attach(name="Connection Status: ", body=str("No Internet access")) assert True - # @pytest.mark.Mavtra - # def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, - # get_ToggleAirplaneMode_data, setup_perfectoMobile_android): - # report = setup_perfectoMobile_android[1] - # driver = setup_perfectoMobile_android[0] - # connData = get_ToggleAirplaneMode_data - # - # return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) - # assert True + + @pytest.mark.Mavtra + def test_maverick_trail(self, request, setup_perfectoMobile_android, get_ToggleAirplaneMode_data, get_configuration, get_apnos): + report = setup_perfectoMobile_android[1] + driver = setup_perfectoMobile_android[0] + connData = get_ToggleAirplaneMode_data + + return_open_maverickpage_android(request, setup_perfectoMobile_android, connData) + for access_point in get_configuration['access_point']: + ap_ssh = get_apnos(access_point, pwd="../libs/apnos/", sdk="2.x") + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + assert True diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index 2010fa46efb..b31a1ba64a9 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -639,7 +639,7 @@ def setup_perfectoMobile_iOS(request, get_device_configuration): except Exception as e: TestCaseName = nCurrentTestMethodNameSplit print("\nUpgrade Python to 3.9 to avoid test_ string in your test case name, see below URL") - # print("https://www.andreagrandi.it/2020/10/11/python39-introduces-removeprefix-removesuffix/") + # print("https://www.anhttps://docs.google.com/spreadsheets/d/1hBCZ8MrTPt1CsZkhGVorWTayfAQgR8LpZ6l7aUc7EHM/edit?usp=sharingdreagrandi.it/2020/10/11/python39-introduces-removeprefix-removesuffix/") projectname = PERFECTO_DETAILS["projectName"] projectversion = PERFECTO_DETAILS["projectVersion"] @@ -789,3 +789,11 @@ def currentmav(request, get_apnos, get_configuration): print(key, ' : ', value[0]) final = value[0] return final + + + + + + + + From 9eb03425394f98543758bc0ba450714994fbad5c Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Wed, 15 Jun 2022 15:08:38 +0530 Subject: [PATCH 22/25] maverick Android and IOS Signed-off-by: Jyothsna-setti --- libs/perfecto_libs/android_lib.py | 1343 +++++++++-------- libs/perfecto_libs/iOS_lib.py | 2 + .../{android/test_mav.py => __init__.py} | 0 .../Maverick/android & iOS/__init__.py | 0 .../test_maverick.py | 0 .../test_maverick2.py | 0 .../test_maverick_ios.py | 27 +- tests/e2e/interOp/conftest.py | 22 +- 8 files changed, 700 insertions(+), 694 deletions(-) rename tests/e2e/interOp/Maverick/{android/test_mav.py => __init__.py} (100%) create mode 100644 tests/e2e/interOp/Maverick/android & iOS/__init__.py rename tests/e2e/interOp/Maverick/{android => android & iOS}/test_maverick.py (100%) rename tests/e2e/interOp/Maverick/{android => android & iOS}/test_maverick2.py (100%) rename tests/e2e/interOp/Maverick/{android => android & iOS}/test_maverick_ios.py (71%) diff --git a/libs/perfecto_libs/android_lib.py b/libs/perfecto_libs/android_lib.py index b9a6cb2514d..6425c9fcc7b 100644 --- a/libs/perfecto_libs/android_lib.py +++ b/libs/perfecto_libs/android_lib.py @@ -104,7 +104,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo driver.switch_to.context(contexts[0]) #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print ("Selected Device Model: " + deviceModelName) @@ -124,14 +124,14 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo report.step_start("Get Connected Wifi Name if any") try: driver.implicitly_wait(20) - WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']") + WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/summary']") Wifi_AP_Name = WifiNameElement.text print("Current Wifi Status Name: " + Wifi_AP_Name) except NoSuchElementException: report.step_start("Checking Wifi Radio Button Status") try: driver.implicitly_wait(5) - WifiRadioBtnConnections = driver.find_element_by_xpath("//*[@resource-id='android:id/switch_widget' and @content-desc='Wi-Fi' and @text='Off']") + WifiRadioBtnConnections = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/switch_widget' and @content-desc='Wi-Fi' and @text='Off']") report.step_start("Wifi Radio Button Disabled, Enabling Radio Button..") print("Wifi Radio Button Disabled, Enabling Radio Button..") WifiRadioBtnConnections.click() @@ -155,7 +155,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo try: report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']") + WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']") print("Wifi Successfully Connected") except NoSuchElementException: @@ -166,7 +166,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo #print("Set Wifi Radio Button to enabled") #try: # report.step_start("Set Wifi Radio Button to enabled") - # wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget' and @text='Wi-Fi, Off']") + # wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget' and @text='Wi-Fi, Off']") # wifiRadioBtn.click() # except NoSuchElementException: # report.step_start("Set Wifi Radio Button Already enabled") @@ -185,7 +185,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo #Set password if Needed try: report.step_start("Set Wifi Password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -199,7 +199,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo try: report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected") except NoSuchElementException: @@ -219,7 +219,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo try: print("Get Connected Wifi Name if any") report.step_start("Get Connected Wifi Name if any") - WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/title' and @text='Wi‑Fi']/parent::*/android.widget.TextView[@resource-id='android:id/summary']"))) + WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android & iOS:id/title' and @text='Wi‑Fi']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']"))) Wifi_AP_Name = WifiNameElement.text print("Current Wifi Status Name: " + Wifi_AP_Name) WifiNameElement.click() @@ -232,7 +232,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo try: report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']") + WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']") print("Wifi Successfully Connected") except NoSuchElementException: @@ -243,7 +243,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo print("Set Wifi Radio Button to enabled") try: report.step_start("Set Wifi Radio Button to enabled") - wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget' and @text='OFF']") + wifiRadioBtn = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget' and @text='OFF']") wifiRadioBtn.click() except NoSuchElementException: report.step_start("Set Wifi Radio Button Already enabled") @@ -260,27 +260,27 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo #Set password if Needed try: report.step_start("Set Wifi Password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") try: report.step_start("Click Connect Button") - joinBTNElement = driver.find_element_by_xpath("//*[@resource-id='android:id/button1' and @text='Connect']") + joinBTNElement = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/button1' and @text='Connect']") joinBTNElement.click() except NoSuchElementException: print("Connect Button Not Enabled...Verify if Password is set properly ") try: report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + WifiInternetErrMsg = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): print("\n-----------------------------") @@ -296,7 +296,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): #print(contexts) #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print ("Selected Device Model: " + deviceModelName) @@ -315,7 +315,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): try: print("Connected Wifi Name if any") report.step_start("Get Connected Wifi Name if any") - WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']") + WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/summary']") Wifi_AP_Name = WifiNameElement.text print("Connected to Wifi: " + Wifi_AP_Name) except NoSuchElementException: @@ -333,7 +333,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): print("Load Wifi Details Page") try: report.step_start("Load Wifi Details Page") - WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/wifi_details']") + WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/wifi_details']") WifiInternetDetails.click() except NoSuchElementException: print("Wifi Connection Error: " + WifiName) @@ -341,7 +341,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): print("Forget Wifi Network") try: report.step_start("Forget Wifi Network") - WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/smallLabel' and @text='Forget']") + WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/smallLabel' and @text='Forget']") WifiForget.click() except NoSuchElementException: print("Wifi Connection Error: " + WifiName) @@ -349,7 +349,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): print("Verify if wifi is disconnected from: " + WifiName) try: report.step_start("Verify if wifi is disconnected from: " + WifiName) - WifiDisconnect = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']") + WifiDisconnect = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']") print("Wifi Not disconnected, check xpath for: " + WifiName) assert False except Exception as e: @@ -362,14 +362,14 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): report.step_start("Probably wifi auto connected to another network") try: report.step_start("Wifi Details Page") - WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/wifi_details']") + WifiInternetDetails = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/wifi_details']") WifiInternetDetails.click() except NoSuchElementException: print("Wifi Connection Error: " + WifiName) try: report.step_start("Forget Wifi Network") - WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/smallLabel' and @text='Forget']") + WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/smallLabel' and @text='Forget']") WifiForget.click() except NoSuchElementException: print("Wifi Connection Error: " + WifiName) @@ -377,9 +377,9 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): print("Verify if wifi is disconnected from: " + WifiName) try: report.step_start("Verify if wifi is disconnected from: " + WifiName) - #WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']") + #WifiForget= driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']") print("Wifi Not disconnected, check xpath for: " + WifiName) - WifiForget = WebDriverWait(driver, 20).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + WifiForget = WebDriverWait(driver, 20).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) except Exception as e: assert True print("Wifi Disconnected Successfully: " + WifiName) @@ -398,7 +398,7 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): try: print("Get Connected Wifi Name if any") report.step_start("Get Connected Wifi Name if any") - WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/title' and @text='Wi‑Fi']/parent::*/android.widget.TextView[@resource-id='android:id/summary']"))) + WifiNameElement = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android & iOS:id/title' and @text='Wi‑Fi']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']"))) Wifi_AP_Name = WifiNameElement.text print("Current Wifi Status Name: " + Wifi_AP_Name) WifiNameElement.click() @@ -410,14 +410,14 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): #print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name) try: report.step_start("Wifi More information") - WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/settings_button_no_background']") + WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") WifiInternetMoreSettings.click() except NoSuchElementException: print("Wifi Not Connected to any Wifi Error: " + WifiName) try: report.step_start("Forget Wifi Network") - WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/button1' and @text='Forget']") + WifiInternetMoreSettings = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/button1' and @text='Forget']") WifiInternetMoreSettings.click() except NoSuchElementException: print("Wifi Connection Error: " + WifiName) @@ -425,12 +425,12 @@ def ForgetWifiConnection(request, setup_perfectoMobile, WifiName, connData): try: report.step_start("Verify if Wifi is Connected") - WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']") + WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']") print("Forgot Wifi Error, check xpath") except Exception as e: print("Wifi Disconnected Successfully: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) def Toggle_AirplaneMode_android(request, setup_perfectoMobile, connData): print("\n-----------------------") @@ -446,7 +446,7 @@ def Toggle_AirplaneMode_android(request, setup_perfectoMobile, connData): #print(contexts) #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print ("Selected Device Model: " + deviceModelName) @@ -502,7 +502,7 @@ def Toggle_WifiMode_android(request, setup_perfectoMobile, WifiName, connData): #print(contexts) #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print ("Selected Device Model: " + deviceModelName) @@ -520,7 +520,7 @@ def Toggle_WifiMode_android(request, setup_perfectoMobile, WifiName, connData): try: print("Get Connected Wifi Name if any") report.step_start("Get Connected Wifi Name if any") - WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']") + WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/summary']") Wifi_AP_Name = WifiNameElement.text print("Current Wifi Status Name: " + Wifi_AP_Name) except NoSuchElementException: @@ -541,7 +541,7 @@ def Toggle_WifiMode_android(request, setup_perfectoMobile, WifiName, connData): try: print("Get Connected Wifi Name if any after Wifi Radio is disabled") report.step_start("Get Connected Wifi Name if any after Wifi Radio is disabled") - WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android:id/summary']") + WifiNameElement = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/summary']") Wifi_AP_Name2 = WifiNameElement.text print("Device Connected to Wifi: " + Wifi_AP_Name2) except NoSuchElementException: @@ -559,7 +559,7 @@ def Toggle_WifiMode_android(request, setup_perfectoMobile, WifiName, connData): try: print("Get Connected Wifi Name if any after Wifi Radio is Enabled") report.step_start("Get Connected Wifi Name if any after Wifi Radio is disabled") - WifiNameElement3 = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android:id/summary']"))) + WifiNameElement3 = WebDriverWait(driver, 35).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='android & iOS:id/summary']"))) Wifi_AP_Name3 = WifiNameElement3.text print("Current Wifi Status Name: " + Wifi_AP_Name3) except NoSuchElementException and TimeoutException: @@ -593,7 +593,7 @@ def verifyUploadDownloadSpeed_android(request, setup_perfectoMobile, get_APToMob print("Enter Search Text") # elementFindTxt = driver.find_element_by_xpath(connData["lblSearch"]) # elementFindTxt.send_keys("Internet Speed Test") - elementFindTxt = driver.find_element_by_xpath("//*[@resource-id='com.google.android.googlequicksearchbox:id/search_edit_frame']") + elementFindTxt = driver.find_element_by_xpath("//*[@resource-id='com.google.android & iOS.googlequicksearchbox:id/search_edit_frame']") elementFindTxt.click() elementFindTxt.send_keys("Internet Speed Test") @@ -678,7 +678,7 @@ def downloadInstallOpenRoamingProfile(request, profileDownloadURL, setup_perfect print("Alert Accepted") except TimeoutException: print("no alert") - #//*[@resource-id="android:id/button1"] + #//*[@resource-id="android & iOS:id/button1"] #Open Settings Application #openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile) @@ -696,7 +696,7 @@ def deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile contexts = driver.contexts #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) @@ -706,7 +706,7 @@ def deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile report.step_start("Forget Profile: " + profileName) # three dotss - #//*[@resource-id='com.android.settings:id/round_corner'] + #//*[@resource-id='com.android & iOS.settings:id/round_corner'] try: print("Click Connections") report.step_start("Click Connections") @@ -767,21 +767,21 @@ def deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile print("Exception: Profile Don't Exist") #Click Forget - #//*[@resource-id="com.android.settings:id/icon"] + #//*[@resource-id="com.android & iOS.settings:id/icon"] try: print ("Click Forget") report.step_start("Click Forget") - ForgetBTN = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/icon']") + ForgetBTN = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/icon']") ForgetBTN.click() except NoSuchElementException: print("Exception: Click Forget") #Click Forget Confirm - #//*[@resource-id="android:id/button1"] + #//*[@resource-id="android & iOS:id/button1"] try: print ("Click Forget Confirm") report.step_start("Click Forget Confirm") - ForgetConfirm = driver.find_element_by_xpath("//*[@resource-id='android:id/button1']") + ForgetConfirm = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/button1']") ForgetConfirm.click() except NoSuchElementException: print("Exception: Click Forget Confirm") @@ -792,7 +792,7 @@ def deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile report.step_start("Pixel Device Not supported: ") assert False - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) def verify_APconnMobileDevice_Android(request, profileNameSSID, setup_perfectoMobile, connData): print("\n-----------------------------") @@ -808,7 +808,7 @@ def verify_APconnMobileDevice_Android(request, profileNameSSID, setup_perfectoMo contexts = driver.contexts #Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) @@ -833,8 +833,8 @@ def verify_APconnMobileDevice_Android(request, profileNameSSID, setup_perfectoMo try: print("Verify if Wifi is Connected to: " + profileNameSSID) report.step_start("Verify if Wifi is Connected: " + profileNameSSID) - #WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + profileNameSSID + "']") - WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='Ameriband']") + #WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + profileNameSSID + "']") + WifiInternetErrMsg = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='Ameriband']") print("Wifi Successfully Connected") except NoSuchElementException: @@ -848,7 +848,7 @@ def verify_APconnMobileDevice_Android(request, profileNameSSID, setup_perfectoMo report.step_start("Pixel Device Not supported: ") assert False - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # Cache_clear Function @@ -864,7 +864,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -882,7 +882,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.implicitly_wait(30) print("Entering Chrome in Search") report.step_start("Entering text Chrome") - search_ele = driver.find_element_by_xpath("//*[@resource-id='com.android.settings.intelligence:id/search_src_text']") + search_ele = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings.intelligence:id/search_src_text']") search_ele.send_keys("chrome") except Exception as e: print("Exception: Entering chrome failed") @@ -913,7 +913,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.implicitly_wait(30) print("Clicking Clear Cache") report.step_start("Click Clear Cache") - clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/button2']") + clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/button2']") clear_ele.click() print("Cleared Cache") except NoSuchElementException: @@ -936,7 +936,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): try: print("Clicking Search button") report.step_start("Click Search") - conn_ele = driver.find_element_by_xpath("//*[@class='android.widget.ImageButton']") + conn_ele = driver.find_element_by_xpath("//*[@class='android & iOS.widget.ImageButton']") conn_ele.click() except NoSuchElementException: print("Exception: Verify Xpath - Update/check Xpath for Click Search") @@ -945,7 +945,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.implicitly_wait(30) print("Entering Chrome in Search") report.step_start("Entering text Chrome") - search_ele = driver.find_element_by_xpath("//*[@resource-id='android:id/search_src_text']") + search_ele = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/search_src_text']") search_ele.send_keys("chrome") except Exception as e: print("Exception: Entering chrome failed") @@ -973,7 +973,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.implicitly_wait(30) print("Clicking Clear Cache") report.step_start("Click Clear Cache") - clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/button2']") + clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/button2']") clear_ele.click() print("Cleared cache") except NoSuchElementException: @@ -1005,7 +1005,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): print("Entering Chrome in Search") report.step_start("Entering text Chrome") search_ele = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings.intelligence:id/search_src_text']") + "//*[@resource-id='com.android & iOS.settings.intelligence:id/search_src_text']") search_ele.send_keys("chrome") except Exception as e: print("Exception: Entering chrome failed") @@ -1036,7 +1036,7 @@ def cache_clear_android(request, setup_perfectoMobile, connData): driver.implicitly_wait(30) print("Clicking Clear Cache") report.step_start("Click Clear Cache") - clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/button2']") + clear_ele = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/button2']") clear_ele.click() print("Cleared Cache") except NoSuchElementException: @@ -1055,14 +1055,14 @@ def cache_clear_android(request, setup_perfectoMobile, connData): print("Exception: Verify Xpath - Update/check Xpath for Checking cache clear") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) def check_if_no_internet_popup(driver):#To check and kill if any popups related to no internet time.sleep(1) driver.implicitly_wait(1) try: - popup = driver.find_element_by_xpath("//*[@resource-id='android:id/alertTitle']") + popup = driver.find_element_by_xpath("//*[@resource-id='android & iOS:id/alertTitle']") popup_text = popup.text try: @@ -1072,7 +1072,7 @@ def check_if_no_internet_popup(driver):#To check and kill if any popups related try: driver.implicitly_wait(2) time.sleep(2) - kill_popup = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/keep_btn']") + kill_popup = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/keep_btn']") kill_popup.click() print("popup killed") except: @@ -1107,7 +1107,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -1136,14 +1136,14 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -1155,7 +1155,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -1164,14 +1164,14 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- @@ -1179,22 +1179,22 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -1204,23 +1204,23 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]") try: #To forget exhisting ssid print("To forget ssid in osversion 12") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: print("To forget ssid in osversion 12-1206") check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/navigation_bar_item_icon_view']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -1254,10 +1254,10 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -1275,7 +1275,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -1287,7 +1287,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(3) report.step_start("Set Wifi Password") print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -1314,7 +1314,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -1324,7 +1324,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -1333,12 +1333,12 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected - 2") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -1348,12 +1348,12 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -1366,10 +1366,10 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -1383,31 +1383,31 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -1417,25 +1417,25 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -1449,7 +1449,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -1457,7 +1457,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -1465,7 +1465,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -1475,7 +1475,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -1489,7 +1489,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -1504,7 +1504,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -1530,7 +1530,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -1550,7 +1550,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -1558,7 +1558,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -1601,7 +1601,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -1614,7 +1614,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -1641,14 +1641,14 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -1659,19 +1659,19 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -1720,10 +1720,10 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -1738,7 +1738,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -1749,7 +1749,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -1774,7 +1774,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -1787,7 +1787,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -1797,12 +1797,12 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -1816,7 +1816,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -1832,7 +1832,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -1840,20 +1840,20 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -1862,7 +1862,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") forget_ssid.click() print("Forgetting ssid") @@ -1870,7 +1870,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -1878,7 +1878,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -1895,7 +1895,7 @@ def get_ip_address_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #mavericknew @@ -1916,7 +1916,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -1945,14 +1945,14 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -1964,7 +1964,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -1973,14 +1973,14 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- @@ -1988,22 +1988,22 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -2013,23 +2013,23 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]") try: #To forget exhisting ssid print("To forget ssid in osversion 12") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: print("To forget ssid in osversion 12-1206") check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/navigation_bar_item_icon_view']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -2063,10 +2063,10 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -2084,7 +2084,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2096,7 +2096,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM time.sleep(3) report.step_start("Set Wifi Password") print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -2123,7 +2123,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -2133,7 +2133,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -2142,12 +2142,12 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM report.step_start("Verify if Wifi is Connected - 2") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -2157,12 +2157,12 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -2175,10 +2175,10 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2192,31 +2192,31 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -2226,25 +2226,25 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -2258,7 +2258,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -2266,7 +2266,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -2274,7 +2274,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -2284,7 +2284,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -2298,7 +2298,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -2313,7 +2313,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -2339,7 +2339,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -2387,7 +2387,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -2400,7 +2400,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -2427,14 +2427,14 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -2445,19 +2445,19 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -2506,10 +2506,10 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2524,7 +2524,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2535,7 +2535,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -2560,7 +2560,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -2573,7 +2573,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -2583,12 +2583,12 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -2602,7 +2602,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -2618,7 +2618,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -2626,20 +2626,20 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -2651,7 +2651,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -2672,7 +2672,7 @@ def get_ip_address_maverick_new_and(request, WifiName, WifiPass, setup_perfectoM print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet @@ -2695,7 +2695,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) @@ -2722,14 +2722,14 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -2741,7 +2741,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -2750,36 +2750,36 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: print("Couldn't get into additional details") @@ -2814,10 +2814,10 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): if not ssid_found: print("could not found" + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -2836,7 +2836,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("Exception on Selecting Wifi Network. Please check wifi Name or signal") #allure.attach(name= body=str("Exception on Selecting Wifi Network. Please check wifi Name or signal")) request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -2847,7 +2847,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext']") + "//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -2864,14 +2864,14 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("Connect Button Not Enabled...Verify if Password is set properly ") check_if_no_internet_popup(driver) # ------------------------------------------------------- - # //*[@resource-id='com.android.settings:id/summary' and @text="Sign in to the network."]/parent::*/android.widget.TextView[@text='XWF-OWF_DSx'] + # //*[@resource-id='com.android & iOS.settings:id/summary' and @text="Sign in to the network."]/parent::*/android & iOS.widget.TextView[@text='XWF-OWF_DSx'] #Verify if WiFi is connected # ------------------------------------------------------- try: report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") #allure.attach(name= body=str("Wifi Successfully Connected")) @@ -2882,7 +2882,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") #allure.attach(name= body=str("Wifi Successfully Connected without internet")) @@ -2892,7 +2892,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") #allure.attach(name=body=str("Wifi Successfully Connected")) @@ -2904,7 +2904,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): except NoSuchElementException: print("Wifi Connection Error: " + WifiName) #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet @@ -2945,7 +2945,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='android:id/icon']") + "//*[@resource-id='android & iOS:id/icon']") get_switch_text = get_switch_text_element.click() if get_switch_text is not None: switch_text = "Off" @@ -2957,7 +2957,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): if switch_text == "Off": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -2984,14 +2984,14 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): pass if switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- try: # To deal with already connected SSID @@ -3001,19 +3001,19 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: print("No Connected SSIDS") @@ -3062,10 +3062,10 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -3080,7 +3080,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -3090,7 +3090,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + "//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -3114,7 +3114,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -3127,7 +3127,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -3137,12 +3137,12 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet @@ -3161,7 +3161,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData): # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet #To disconnect and forget network @@ -3180,7 +3180,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -3207,14 +3207,14 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -3226,7 +3226,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -3235,36 +3235,36 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) #---------------------This is to Forget current connected SSID------------------------------- try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") #allure.attach(name=body=str("Forget old ssid")) except: print("Couldn't forget ssid") #allure.attach(name=body=str("Couldn't forget ssid")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) except: #allure.attach(name=body=str("Couldn't get into additional details")) print("Couldn't get into additional details") @@ -3276,7 +3276,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -3317,7 +3317,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='android:id/icon']") + "//*[@resource-id='android & iOS:id/icon']") get_switch_text = get_switch_text_element.click() if get_switch_text is not None: switch_text = "Off" @@ -3330,7 +3330,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile if switch_text == "Off": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -3357,13 +3357,13 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile pass if switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # ---------------------This is to Forget current connected SSID------------------------------- try: # To deal with already connected SSID check_if_no_internet_popup(driver) @@ -3372,17 +3372,17 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) except: #allure.attach(name=body=str("Couldn't get into additional details")) print("Couldn't get into additional details") @@ -3394,7 +3394,7 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -3412,12 +3412,12 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile except NoSuchElementException: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # try: -# elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") +# elements = driver.find_elements_by_xpath("//*[@resource-id='com.android & iOS.settings:id/title']") # print("elements: ", elements) # print(len(elements)) # for i in range(len(elements)): @@ -3432,7 +3432,7 @@ def get_all_available_ssids(driver, deviceModelName): try: time.sleep(8) driver.implicitly_wait(10) - elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']") + elements = driver.find_elements_by_xpath("//*[@resource-id='com.android & iOS.settings:id/title']") # print("elements: ", elements) print(len(elements)) for i in range(len(elements)): @@ -3445,7 +3445,7 @@ def get_all_available_ssids(driver, deviceModelName): try: time.sleep(8) driver.implicitly_wait(10) - elements = driver.find_elements_by_xpath("//*[@resource-id='android:id/title']") + elements = driver.find_elements_by_xpath("//*[@resource-id='android & iOS:id/title']") # print("elements: ", elements) print(len(elements)) for i in range(len(elements)): @@ -3481,7 +3481,7 @@ def reportClient(value): # 'securityToken': 'eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3NzkzZGM0Ni1jZmU4LTQ4ODMtYjhiOS02ZWFlZGU2OTc2MDkifQ.eyJpYXQiOjE2MjE4NjgyOTksImp0aSI6IjIzNGFiOTM1LWIxYjQtNGZiOC1hZmJiLTM0OTQwNzU5MjIwMyIsImlzcyI6Imh0dHBzOi8vYXV0aDIucGVyZmVjdG9tb2JpbGUuY29tL2F1dGgvcmVhbG1zL3RpcC1wZXJmZWN0b21vYmlsZS1jb20iLCJhdWQiOiJodHRwczovL2F1dGgyLnBlcmZlY3RvbW9iaWxlLmNvbS9hdXRoL3JlYWxtcy90aXAtcGVyZmVjdG9tb2JpbGUtY29tIiwic3ViIjoiN2I1MzBhZTAtODgxOC00N2I5LTgzZjMtN2ZhMGZiMGRkYjRlIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6Im9mZmxpbmUtdG9rZW4tZ2VuZXJhdG9yIiwibm9uY2UiOiI1MzI2NDQxNS0xYTQwLTQ1ZTctOGVkMi1hOTNiYWZmZWNjYjIiLCJzZXNzaW9uX3N0YXRlIjoiY2YzY2JlOGMtY2Y5OC00NzRlLWJmODctYTIxNzU0NzVhM2EzIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBvZmZsaW5lX2FjY2VzcyBlbWFpbCJ9.4a4v6AKxmY95Zb-l84K_Od49WPikwOHP7ryctfmnn-w', # 'useAppiumForWeb': 'false', # 'useAppiumForHybrid': 'false', -# # 'bundleId' : request.config.getini("appPackage-android"), +# # 'bundleId' : request.config.getini("appPackage-android & iOS"), # } # # app_data = { @@ -3494,8 +3494,8 @@ def reportClient(value): # "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", # "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", # # Android -# "platformName-android": 'Android', -# "appPackage-android": 'com.android.settings' +# "platformName-android & iOS": 'Android', +# "appPackage-android & iOS": 'com.android & iOS.settings' # } # # driver = webdriver.Remote( @@ -3510,7 +3510,7 @@ def reportClient(value): # # projectname = "TIP-PyTest-Execution" # projectversion = 1.0 -# jobname = "tip-sushant-android" +# jobname = "tip-sushant-android & iOS" # jobnumber = 2 # tags = "TestTag" # testCaseName = "getting_ssids" @@ -3548,7 +3548,7 @@ def reportClient(value): # print("1508") # # # Open Settings Application -# openApp(app_data["appPackage-android"], setup_perfectoMobile) +# openApp(app_data["appPackage-android & iOS"], setup_perfectoMobile) # # deviceModelName = driver.execute_script('mobile:handset:info', {'property': 'model'}) # @@ -3574,7 +3574,7 @@ def reportClient(value): # try: # driver.implicitly_wait(1) # get_switch_text_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_text']") +# "//*[@resource-id='com.android & iOS.settings:id/switch_text']") # get_switch_text = get_switch_text_element.text # print("get_switch_text: ", get_switch_text) # # print("Find wifi switch") @@ -3582,7 +3582,7 @@ def reportClient(value): # if get_switch_text == "Off": # # driver.implicitly_wait(3) # get_switch_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_widget']") +# "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # # driver.implicitly_wait(1) # get_switch_element.click() # driver.implicitly_wait(1) @@ -3594,7 +3594,7 @@ def reportClient(value): # else: # try: # get_switch_text_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/switch_text']") +# "//*[@resource-id='com.android & iOS.settings:id/switch_text']") # get_switch_text = get_switch_text_element.text # except: # pass @@ -3603,7 +3603,7 @@ def reportClient(value): # pass # if get_switch_text == "Off": # print("Switch is Still OFF") -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) +# closeApp(app_data["appPackage-android & iOS"], setup_perfectoMobile) # close_driver(driver) # return ip_address_element_text # else: @@ -3611,7 +3611,7 @@ def reportClient(value): # check_if_no_internet_popup(driver) # except: # print("Couldn't turn on WIFI sewitch") -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) +# closeApp(app_data["appPackage-android & iOS"], setup_perfectoMobile) # close_driver(driver) # return ip_address_element_text # @@ -3619,22 +3619,22 @@ def reportClient(value): # try: # To deal with already connected SSID # check_if_no_internet_popup(driver) # network_category = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/connected_network_category']") +# "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") # try: # To forget exhisting ssid # print("To forget exhisting ssid") # check_if_no_internet_popup(driver) # additional_details_element = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/layout_details']") +# "//*[@resource-id='com.android & iOS.settings:id/layout_details']") # additional_details_element.click() # try: # check_if_no_internet_popup(driver) # forget_ssid = driver.find_element_by_xpath( -# "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") +# "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") # forget_ssid.click() # print("Forget old ssid") # except: # print("Couldn't forget ssid") -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) +# closeApp(app_data["appPackage-android & iOS"], setup_perfectoMobile) # close_driver(driver) # return ip_address_element_text # except: @@ -3658,7 +3658,7 @@ def reportClient(value): # try: # try: # elements = driver.find_elements_by_xpath( -# "//*[@resource-id='com.android.settings:id/title']") +# "//*[@resource-id='com.android & iOS.settings:id/title']") # print("elements: ", elements) # print(len(elements)) # curent_ssid_list = [] @@ -3708,7 +3708,7 @@ def reportClient(value): # # except: # try: -# closeApp(app_data["appPackage-android"], setup_perfectoMobile) +# closeApp(app_data["appPackage-android & iOS"], setup_perfectoMobile) # except: # pass # try: @@ -3749,7 +3749,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -3778,14 +3778,14 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -3797,7 +3797,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -3806,14 +3806,14 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- @@ -3821,22 +3821,22 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -3846,23 +3846,23 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]") try: #To forget exhisting ssid print("To forget ssid in osversion 12") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: print("To forget ssid in os version 12") check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/navigation_bar_item_icon_view']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -3896,10 +3896,10 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -3915,7 +3915,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -3926,7 +3926,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Set User name") print("Set User name") wifiUserElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) + EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android & iOS.settings:id/edittext' and @password='false']"))) wifiUserElement.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -3992,7 +3992,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -4002,7 +4002,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -4011,12 +4011,12 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -4031,31 +4031,31 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -4065,25 +4065,25 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -4097,7 +4097,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -4105,7 +4105,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -4113,7 +4113,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -4123,7 +4123,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -4137,7 +4137,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -4152,7 +4152,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -4178,7 +4178,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -4197,7 +4197,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -4205,7 +4205,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -4246,7 +4246,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -4259,7 +4259,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -4286,14 +4286,14 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -4304,19 +4304,19 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -4365,10 +4365,10 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # ------------------------------------------------------- @@ -4384,7 +4384,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # ------------------------------------------------------- @@ -4395,7 +4395,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Selecting CA Cert") print("Selecting certificate") cert_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/ca_cert']") + "//*[@resource-id='com.android & iOS.settings:id/ca_cert']") cert_element.click() except NoSuchElementException: print("Selecting certificate failed") @@ -4418,7 +4418,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Set User name") print("Set User name") wifi_user_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/identity']") + "//*[@resource-id='com.android & iOS.settings:id/identity']") wifi_user_element.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -4433,7 +4433,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Set Wifi Password") print("Entering password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + "//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(ttls_passwd) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -4460,7 +4460,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -4473,7 +4473,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -4482,12 +4482,12 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -4501,7 +4501,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -4517,7 +4517,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -4525,20 +4525,20 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -4547,20 +4547,20 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") forget_ssid.click() print("Forgetting ssid") #------------------------------- Wifi Switch ---------------- # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: # print("couldn't click on wifi switch") # #allure.attach(name= body=str("couldn't click on wifi switch")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't forget ssid") @@ -4578,7 +4578,7 @@ def get_ip_address_eap_and(request, WifiName, User, ttls_passwd, setup_perfectoM except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #only to connect to wifi def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): @@ -4598,7 +4598,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) @@ -4625,14 +4625,14 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -4644,7 +4644,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -4653,36 +4653,36 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: print("Couldn't get into additional details") @@ -4717,10 +4717,10 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, if not ssid_found: print("could not found" + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -4736,7 +4736,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -4747,7 +4747,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Set User name") print("Set User name") wifiUserElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext' and @password='false']") + "//*[@resource-id='com.android & iOS.settings:id/edittext' and @password='false']") wifiUserElement.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -4807,7 +4807,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") #allure.attach(name= body=str("Wifi Successfully Connected")) @@ -4818,7 +4818,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") #allure.attach(name= body=str("Wifi Successfully Connected without internet")) @@ -4828,14 +4828,14 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") #allure.attach(name=body=str("Wifi Successfully Connected")) except NoSuchElementException: print("Wifi Connection Error: " + WifiName) #allure.attach(name=body=str("Wifi Connection Error: " + WifiName)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet @@ -4876,7 +4876,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -4889,7 +4889,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -4916,14 +4916,14 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -4934,19 +4934,19 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: print("No Connected SSIDS") @@ -4995,10 +4995,10 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- @@ -5013,7 +5013,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet # ------------------------------------------------------- # Selecting certificate @@ -5022,7 +5022,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, driver.implicitly_wait(3) report.step_start("Selecting CA Cert") cert_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/ca_cert']") + "//*[@resource-id='com.android & iOS.settings:id/ca_cert']") cert_element.click() except NoSuchElementException: print("Selecting certificate failed") @@ -5044,7 +5044,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Set User name") print("Set User name") wifi_user_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/identity']") + "//*[@resource-id='com.android & iOS.settings:id/identity']") wifi_user_element.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -5059,7 +5059,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Set Password") print("Set Password") wifi_password_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + "//*[@resource-id='com.android & iOS.settings:id/password']") wifi_password_element.send_keys(ttls_passwd) print("Entered Password") except NoSuchElementException: @@ -5085,7 +5085,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -5098,7 +5098,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -5108,12 +5108,12 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet @@ -5132,7 +5132,7 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile, # allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections")) # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ssid_with_internet #--------------------CAPTIVE PORTAL Android----------------------------------------- def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connData): @@ -5153,7 +5153,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) #allure.attach(name= body=str("\Selected Device Model: " + deviceModelName)) @@ -5181,7 +5181,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ", get_switch_text) print("Find wifi switch") @@ -5189,7 +5189,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if get_switch_text == "Off": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -5201,7 +5201,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -5210,14 +5210,14 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -5226,22 +5226,22 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: # To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: # To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -5251,23 +5251,23 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: # To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]") try: # To forget exhisting ssid print("To forget ssid in osversion 12") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: print("To forget ssid in osversion 12-1206") check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/navigation_bar_item_icon_view']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -5301,10 +5301,10 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if not ssid_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -5320,7 +5320,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -5332,7 +5332,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Set Wifi Password") print("Set Wifi password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/edittext']") + "//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -5393,7 +5393,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -5403,7 +5403,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -5413,12 +5413,12 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa WifiInternetErrMsg = WebDriverWait(driver, 60).until( EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -5429,12 +5429,12 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -5447,10 +5447,10 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # Get into Additional Details @@ -5465,31 +5465,31 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -5499,26 +5499,26 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) auto_reconnect_off = driver.find( - "//*[@resource-id='android:id/switch_widget']") + "//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -5532,7 +5532,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -5540,7 +5540,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -5548,7 +5548,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -5558,7 +5558,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -5573,7 +5573,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -5588,7 +5588,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -5614,7 +5614,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -5634,7 +5634,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -5642,7 +5642,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -5684,7 +5684,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -5697,7 +5697,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -5724,14 +5724,14 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -5742,19 +5742,19 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -5803,10 +5803,10 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -5821,7 +5821,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -5833,7 +5833,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Set Wifi Password") print("Entering password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + "//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -5890,7 +5890,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -5903,7 +5903,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -5914,12 +5914,12 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa WifiInternetErrMsg = WebDriverWait(driver, 60).until( EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -5933,7 +5933,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -5949,7 +5949,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() # print("Device IP address is :", ip_address_element_text) except: @@ -5957,20 +5957,20 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -5979,7 +5979,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") forget_ssid.click() print("Forgetting ssid") @@ -5987,7 +5987,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -5995,7 +5995,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa # allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -6012,7 +6012,7 @@ def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connDa print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet @@ -6031,7 +6031,7 @@ def expressWifi(request, WifiName, setup_perfectoMobile, connData): try: click_on_ssid = WebDriverWait(driver, 10).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Sign in to the network.']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Sign in to the network.']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) click_on_ssid.click() print("click on expresswifi SSID to open login page") except: @@ -6072,14 +6072,14 @@ def expressWifi(request, WifiName, setup_perfectoMobile, connData): LogOut = driver.find_element_by_xpath(expressWifiOutputMsg) print("----" + LogOut.text + "\n") if 'test completed successfully' in LogOut.text: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return True else: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return False except NoSuchElementException: print("Exception Verify Results") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) def scroll_down_pixel(setup_perfectoMobile): print("Scroll Down") @@ -6120,7 +6120,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -6149,14 +6149,14 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -6168,7 +6168,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -6177,36 +6177,36 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -6240,10 +6240,10 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -6261,7 +6261,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -6273,7 +6273,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf time.sleep(3) report.step_start("Set Wifi Password") print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -6301,7 +6301,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -6311,7 +6311,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -6321,12 +6321,12 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf WifiInternetErrMsg = WebDriverWait(driver, 60).until( EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -6336,12 +6336,12 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -6354,10 +6354,10 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -6372,31 +6372,31 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -6406,25 +6406,25 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -6438,7 +6438,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -6446,7 +6446,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -6454,7 +6454,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -6464,7 +6464,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -6478,7 +6478,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -6493,7 +6493,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -6519,7 +6519,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -6539,7 +6539,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # # try: # # print("clicking on wifi switch") # # get_switch_element = driver.find_element_by_xpath( - # # "//*[@resource-id='com.android.settings:id/switch_widget']") + # # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # # driver.implicitly_wait(2) # # get_switch_element.click() # # except: @@ -6547,7 +6547,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # # #allure.attach(name= body=str("couldn't click on wifi switch")) # except: # print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -6588,7 +6588,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -6601,7 +6601,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -6628,14 +6628,14 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -6646,19 +6646,19 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -6707,10 +6707,10 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -6725,7 +6725,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -6736,7 +6736,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -6761,7 +6761,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -6774,7 +6774,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -6784,12 +6784,12 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -6803,7 +6803,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -6819,7 +6819,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -6827,20 +6827,20 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -6860,7 +6860,7 @@ def gets_ip_add_and_does_not_forget_ssid(request, WifiName, WifiPass, setup_perf print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #----------------------------------Gets ip address of the enterprise ssid and does not forget it------------------ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData): @@ -6880,7 +6880,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -6909,14 +6909,14 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -6928,7 +6928,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -6937,36 +6937,36 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -7000,10 +7000,10 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -7019,7 +7019,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -7030,7 +7030,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Set User name") print("Set User name") wifiUserElement = WebDriverWait(driver, 10).until( - EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android.settings:id/edittext' and @password='false']"))) + EC.presence_of_element_located((MobileBy.XPATH, "//*[@resource-id='com.android & iOS.settings:id/edittext' and @password='false']"))) wifiUserElement.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -7098,7 +7098,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -7108,7 +7108,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -7118,12 +7118,12 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw WifiInternetErrMsg = WebDriverWait(driver, 60).until( EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -7133,12 +7133,12 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -7151,10 +7151,10 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -7169,31 +7169,31 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -7203,25 +7203,25 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -7235,7 +7235,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -7243,7 +7243,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -7251,7 +7251,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -7261,7 +7261,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -7275,7 +7275,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -7290,7 +7290,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -7316,7 +7316,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -7336,7 +7336,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # # try: # # print("clicking on wifi switch") # # get_switch_element = driver.find_element_by_xpath( - # # "//*[@resource-id='com.android.settings:id/switch_widget']") + # # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # # driver.implicitly_wait(2) # # get_switch_element.click() # # except: @@ -7344,7 +7344,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # # #allure.attach(name= body=str("couldn't click on wifi switch")) # except: # print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -7384,7 +7384,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -7397,7 +7397,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -7424,14 +7424,14 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -7442,19 +7442,19 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/button1']") + "//*[@resource-id='com.android & iOS.settings:id/button1']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -7503,10 +7503,10 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # ------------------------------------------------------- @@ -7522,7 +7522,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # ------------------------------------------------------- @@ -7533,7 +7533,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Selecting CA Cert") print("Selecting certificate") cert_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/ca_cert']") + "//*[@resource-id='com.android & iOS.settings:id/ca_cert']") cert_element.click() except NoSuchElementException: print("Selecting certificate failed") @@ -7556,7 +7556,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Set User name") print("Set User name") wifi_user_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/identity']") + "//*[@resource-id='com.android & iOS.settings:id/identity']") wifi_user_element.send_keys(User) except NoSuchElementException: print("User name not Loaded") @@ -7571,7 +7571,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Set Wifi Password") print("Entering password") wifiPasswordElement = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/password']") + "//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(ttls_passwd) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -7597,7 +7597,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -7610,7 +7610,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -7620,12 +7620,12 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -7639,7 +7639,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -7655,7 +7655,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -7663,20 +7663,20 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -7695,7 +7695,7 @@ def gets_ip_add_eap_and_does_not_forget_ssid(request, WifiName, User, ttls_passw except: print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet @@ -7717,7 +7717,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -7746,14 +7746,14 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -7765,7 +7765,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -7774,14 +7774,14 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- # Verify if WiFi is connected @@ -7792,7 +7792,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -7802,7 +7802,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -7812,12 +7812,12 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup WifiInternetErrMsg = WebDriverWait(driver, 60).until( EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -7828,12 +7828,12 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -7846,10 +7846,10 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -7864,31 +7864,31 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -7898,25 +7898,25 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -7930,7 +7930,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forgetting ssid") @@ -7938,7 +7938,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -7946,7 +7946,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -7956,7 +7956,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -7970,7 +7970,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -7985,7 +7985,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -8011,7 +8011,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -8031,7 +8031,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # try: # print("clicking on wifi switch") # get_switch_element = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/switch_widget']") + # "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") # driver.implicitly_wait(2) # get_switch_element.click() # except: @@ -8039,7 +8039,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # #allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -8077,7 +8077,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -8090,7 +8090,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -8117,14 +8117,14 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # Verify if WiFi is connected # ------------------------------------------------------- @@ -8132,7 +8132,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -8142,7 +8142,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -8150,12 +8150,12 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -8169,7 +8169,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -8185,7 +8185,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -8193,20 +8193,20 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -8215,7 +8215,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") forget_ssid.click() print("Forgetting ssid") @@ -8223,7 +8223,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -8231,7 +8231,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup # allure.attach(name= body=str("couldn't click on wifi switch")) except: print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("Couldn't get into Additional settings") @@ -8248,7 +8248,7 @@ def gets_ip_add_for_checking_and_forgets_ssid(request, WifiName, WifiPass, setup print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet def get_phone_information(setup_perfectoMobile, search_this): @@ -8351,7 +8351,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil driver.switch_to.context(contexts[0]) # Open Settings Application - openApp(connData["appPackage-android"], setup_perfectoMobile) + openApp(connData["appPackage-android & iOS"], setup_perfectoMobile) deviceModelName = getDeviceModelName(setup_perfectoMobile) print("Selected Device Model: " + deviceModelName) @@ -8380,14 +8380,14 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil # --------------------To Turn on WIFi Switch if already OFF-------------------------------- try: driver.implicitly_wait(1) - get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']") + get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text print("get_switch_text: ",get_switch_text) print("Find wifi switch") try: #To Turn on Wi-Fi Switch if get_switch_text == "Off": # driver.implicitly_wait(3) - get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']") + get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -8399,7 +8399,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil else: try: get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_text']") + "//*[@resource-id='com.android & iOS.settings:id/switch_text']") get_switch_text = get_switch_text_element.text except: pass @@ -8408,14 +8408,14 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil pass if get_switch_text == "Off": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #---------------------This is to Forget current connected SSID------------------------------- @@ -8423,22 +8423,22 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_network_category']") + "//*[@resource-id='com.android & iOS.settings:id/connected_network_category']") try: #To forget exhisting ssid print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/icon']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -8448,23 +8448,23 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: #To deal with already connected SSID check_if_no_internet_popup(driver) network_category = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]") + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]") try: #To forget exhisting ssid print("To forget ssid in osversion 12") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: print("To forget ssid in osversion 12-1206") check_if_no_internet_popup(driver) forget_ssid = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/navigation_bar_item_icon_view']") + "//*[@resource-id='com.android & iOS.settings:id/forget_button']//*[@resource-id='com.android & iOS.settings:id/navigation_bar_item_icon_view']") forget_ssid.click() print("Forget old ssid") except: print("Couldn't forget ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: print("Couldn't get into additional details") @@ -8498,10 +8498,10 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil if not ssid_found: print("could not found " + WifiName + " in device") #allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet #------------------------------------------------------- @@ -8519,7 +8519,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -8531,7 +8531,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil time.sleep(3) report.step_start("Set Wifi Password") print("Set Wifi password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/edittext']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/edittext']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -8558,7 +8558,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -8568,7 +8568,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) @@ -8577,12 +8577,12 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil report.step_start("Verify if Wifi is Connected - 2") WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: try: @@ -8592,12 +8592,12 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil wifi_connection_name = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/connected_list']/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.TextView[1]" + "//*[@resource-id='com.android & iOS.settings:id/connected_list']/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[2]/android & iOS.widget.TextView[1]" ))) if wifi_connection_name.text == WifiName: wifi_connection_status = WebDriverWait(driver, 50).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary']" + "//*[@resource-id='com.android & iOS.settings:id/summary']" ))) if wifi_connection_status.text == "Connected": ssid_with_internet = True @@ -8610,10 +8610,10 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil # Go into additional details here else: # Connected to some other wifi, makes sense to close app and fail this testcase - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -8627,31 +8627,31 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/layout_details']") + "//*[@resource-id='com.android & iOS.settings:id/layout_details']") additional_details_element.click() try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: print("IP address element not found") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False # allure.attach(name= body=str("IP address element not found")) # --------------------Added for ssid security check-------------------------- try: time.sleep(2) security_name_element = driver.find_element_by_xpath( - "//*[@text='Security']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']") + "//*[@text='Security']/parent::*/android & iOS.widget.TextView[@resource-id='com.android & iOS.settings:id/summary']") security_name_element_text = security_name_element.text print("Ssid security is :", security_name_element_text) allure.attach(name="Ssid Security:", body=str(security_name_element_text)) @@ -8661,25 +8661,25 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) except: print("Ssid name not available") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False if (ssid_name_element_text == WifiName): print("Wifi is connected to the expected ssid") else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) assert False try: check_if_no_internet_popup(driver) driver.implicitly_wait(3) time.sleep(2) - auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']") + auto_reconnect_off = driver.find("//*[@resource-id='android & iOS:id/switch_widget']") auto_reconnect_off_text = auto_reconnect_off.text if auto_reconnect_off_text != "Off": auto_reconnect_off.click() @@ -8697,7 +8697,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("Into additional details") time.sleep(2) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/wifi_details']") + "//*[@resource-id='com.android & iOS.settings:id/wifi_details']") additional_details_element.click() try: @@ -8711,7 +8711,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: time.sleep(2) ssid_name_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/entity_header_title']") + "//*[@resource-id='com.android & iOS.settings:id/entity_header_title']") ssid_name_element_text = ssid_name_element.text print("Ssid Name is :", ssid_name_element_text) allure.attach(name="Ssid connected:", body=str(ssid_name_element_text)) @@ -8726,7 +8726,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil # return ip_address_element_text, ssid_with_internet else: print("Wifi is not connected to the expected ssid") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) report.step_start("Scrolling for ip address - 1") # if deviceModelName == "Galaxy S20": @@ -8752,7 +8752,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: ip_address_element_text = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.TextView[2]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[4]/android & iOS.widget.RelativeLayout[1]/android & iOS.widget.TextView[2]") ip_address_element_text = ip_address_element_text.text ssid_with_internet = True except: @@ -8800,7 +8800,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: driver.implicitly_wait(1) get_switch_text_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") get_switch_text = get_switch_text_element.text # if get_switch_text is not None: # switch_text = "OFF" @@ -8813,7 +8813,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil if switch_text == "OFF": # driver.implicitly_wait(3) get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(1) get_switch_element.click() driver.implicitly_wait(1) @@ -8840,14 +8840,14 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil pass if switch_text == "OFF": print("Switch is Still OFF") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet else: print("Switch is already On") check_if_no_internet_popup(driver) except: print("Couldn't turn on WIFI switch") - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ---------------------This is to Forget current connected SSID------------------------------- @@ -8858,19 +8858,19 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("To forget ssid") check_if_no_internet_popup(driver) additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() except: print("Couldn't get into additional details") # try: # check_if_no_internet_popup(driver) # forget_ssid = driver.find_element_by_xpath( - # "//*[@resource-id='com.android.settings:id/button1']") + # "//*[@resource-id='com.android & iOS.settings:id/button1']") # forget_ssid.click() # print("Forget old ssid") # except: # print("Couldn't forget ssid") - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet except: print("No Connected SSIDS") @@ -8919,10 +8919,10 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil if not ssid_not_found: print("could not found " + WifiName + " in device") # allure.attach(name= body=str("could not found" + WifiName + " in device")) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet except: - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -8937,7 +8937,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil except Exception as e: print("Exception on Selecting Wifi Network. Please check wifi Name or signal") request.config.cache.set(key="SelectingWifiFailed", value=str(e)) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -8948,7 +8948,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil check_if_no_internet_popup(driver) report.step_start("Set Wifi Password") print("Entering password") - wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/password']") + wifiPasswordElement = driver.find_element_by_xpath("//*[@resource-id='com.android & iOS.settings:id/password']") wifiPasswordElement.send_keys(WifiPass) except NoSuchElementException: print("Password Page Not Loaded, password May be cached in the System") @@ -8973,7 +8973,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil report.step_start("Verify if Wifi is Connected") WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") # time.sleep(5) @@ -8986,7 +8986,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil # check_if_no_internet_popup(driver) WifiInternetErrMsg = WebDriverWait(driver, 35).until( EC.presence_of_element_located((MobileBy.XPATH, - "//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"+ WifiName + "']"))) + "//*[@resource-id='com.android & iOS.settings:id/summary' and @text='Connected without internet']/parent::*/android & iOS.widget.TextView[@text='"+ WifiName + "']"))) print("Wifi Successfully Connected without internet") check_if_no_internet_popup(driver) except: @@ -8996,13 +8996,13 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil scroll_up(setup_perfectoMobile) WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located(( MobileBy.XPATH, - "//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']"))) + "//*[@resource-id='android & iOS:id/summary' and @text='Connected']/parent::*/android & iOS.widget.TextView[@text='" + WifiName + "']"))) ssid_with_internet = True print("Wifi Successfully Connected") except NoSuchElementException: print("Wifi Connection Error: " + WifiName) - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet # ------------------------------------------------------- @@ -9016,7 +9016,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil time.sleep(5) report.step_start("Going for ip address") additional_details_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/settings_button_no_background']") + "//*[@resource-id='com.android & iOS.settings:id/settings_button_no_background']") additional_details_element.click() print("Entered ssid") try: @@ -9032,7 +9032,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.FrameLayout[2]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.RelativeLayout[1]") advanced_element.click() #print("Device IP address is :", ip_address_element_text) except: @@ -9040,20 +9040,20 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil time.sleep(5) print("clicking Advanced2") advanced_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]") + "//*[@resource-id='com.android & iOS.settings:id/recycler_view']/android & iOS.widget.LinearLayout[5]/android & iOS.widget.LinearLayout[1]/android & iOS.widget.ImageView[1]") advanced_element.click() except: print("No advanced options") # allure.attach(name= body=str("IP address element not found")) - # closeApp(connData["appPackage-android"], setup_perfectoMobile) + # closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) # return ip_address_element_text, ssid_with_internet # Scroll Down scrollDown(setup_perfectoMobile) try: time.sleep(2) ip_address_element = driver.find_element_by_xpath( - "//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']") + "//*[@text='IP address']/parent::*/android & iOS.widget.TextView[@resource-id='android & iOS:id/summary']") ip_address_element_text = ip_address_element.text print("Device IP address is :", ip_address_element_text) except: @@ -9064,7 +9064,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil try: print("clicking on wifi switch") get_switch_element = driver.find_element_by_xpath( - "//*[@resource-id='com.android.settings:id/switch_widget']") + "//*[@resource-id='com.android & iOS.settings:id/switch_widget']") driver.implicitly_wait(2) get_switch_element.click() except: @@ -9085,7 +9085,7 @@ def get_ip_address_maverick_and(request, WifiName, WifiPass, setup_perfectoMobil print("Exception: Verify Xpath - Update/check Xpath for Click Connections") # -----------------To Open Connections page--------------------------- - closeApp(connData["appPackage-android"], setup_perfectoMobile) + closeApp(connData["appPackage-android & iOS"], setup_perfectoMobile) return ip_address_element_text, ssid_with_internet @@ -9128,6 +9128,7 @@ def return_open_maverickpage_android(request, setup_perfectoMobile_android, get_ reboot.click() print("Reboot Button clicked") time.sleep(120) + print("Waiting 120 sec for AP to Reboot") except: print("unable to click Reboot Button") except: diff --git a/libs/perfecto_libs/iOS_lib.py b/libs/perfecto_libs/iOS_lib.py index 371bbf7a7b0..88081778377 100644 --- a/libs/perfecto_libs/iOS_lib.py +++ b/libs/perfecto_libs/iOS_lib.py @@ -4017,6 +4017,8 @@ def return_open_maverickpage_iOS(request, setup_perfectoMobile_iOS, get_APToMobi reboot = driver.find_element_by_xpath("//*[text()='Reboot']") reboot.click() print("Reboot Button clicked") + print("Waiting 120 sec for AP to Reboot") + time.sleep(120) except: print("unable to click Reboot Button") except: diff --git a/tests/e2e/interOp/Maverick/android/test_mav.py b/tests/e2e/interOp/Maverick/__init__.py similarity index 100% rename from tests/e2e/interOp/Maverick/android/test_mav.py rename to tests/e2e/interOp/Maverick/__init__.py diff --git a/tests/e2e/interOp/Maverick/android & iOS/__init__.py b/tests/e2e/interOp/Maverick/android & iOS/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/e2e/interOp/Maverick/android/test_maverick.py b/tests/e2e/interOp/Maverick/android & iOS/test_maverick.py similarity index 100% rename from tests/e2e/interOp/Maverick/android/test_maverick.py rename to tests/e2e/interOp/Maverick/android & iOS/test_maverick.py diff --git a/tests/e2e/interOp/Maverick/android/test_maverick2.py b/tests/e2e/interOp/Maverick/android & iOS/test_maverick2.py similarity index 100% rename from tests/e2e/interOp/Maverick/android/test_maverick2.py rename to tests/e2e/interOp/Maverick/android & iOS/test_maverick2.py diff --git a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py b/tests/e2e/interOp/Maverick/android & iOS/test_maverick_ios.py similarity index 71% rename from tests/e2e/interOp/Maverick/android/test_maverick_ios.py rename to tests/e2e/interOp/Maverick/android & iOS/test_maverick_ios.py index e1e03c3ec4e..0a88a460398 100644 --- a/tests/e2e/interOp/Maverick/android/test_maverick_ios.py +++ b/tests/e2e/interOp/Maverick/android & iOS/test_maverick_ios.py @@ -7,7 +7,7 @@ sys.path.append(f'../libs/perfecto_libs') pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.iOS, pytest.mark.interop_iOS, pytest.mark.client_connectivity - ,pytest.mark.interop_uc_sanity, pytest.mark.nat] + ,pytest.mark.interop_uc_sanity, pytest.mark.nat, pytest.mark.maverickIOS] from iOS_lib import closeApp, set_APconnMobileDevice_iOS, Toggle_AirplaneMode_iOS, ForgetWifiConnection, openApp, \ get_ip_address_maverick_iOS,return_open_maverickpage_iOS, wifi_disconnect_and_forget @@ -38,18 +38,21 @@ def test_maverick_ios(self, request, get_vif_state, get_ap_logs,currentmav, print(text_body) allure.attach(name="Connection Status: ", body=str(text_body)) - return_open_maverickpage_iOS(request, setup_perfectoMobile_iOS, connData) - else: allure.attach(name="Connection Status: ", body=str("No Internet access")) assert True -# @pytest.mark.Mavtraios -# def test_maverick_trail(self, request, get_vif_state, get_apnos, get_configuration, get_ap_logs, -# get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): -# report = setup_perfectoMobile_iOS[1] -# driver = setup_perfectoMobile_iOS[0] -# connData = get_ToggleAirplaneMode_data -# -# return_open_maverick_iOS(request, setup_perfectoMobile_iOS, connData) -# assert True +@pytest.mark.Mavtraios +def test_maverick_trail(request, get_vif_state, get_apnos, get_configuration, + get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): + report = setup_perfectoMobile_iOS[1] + driver = setup_perfectoMobile_iOS[0] + connData = get_ToggleAirplaneMode_data + + return_open_maverickpage_iOS(request, setup_perfectoMobile_iOS, connData) + for access_point in get_configuration['access_point']: + ap_ssh = get_apnos(access_point, pwd="../libs/apnos/", sdk="2.x") + iwinfo = ap_ssh.get_iwinfo() + print("iwinfo:") + print(iwinfo) + assert True diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index b31a1ba64a9..46e771ed843 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -74,8 +74,8 @@ def get_APToMobileDevice_data(request, get_device_configuration): "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", # Android - "platformName-android": get_device_configuration["platformName-android"], - "appPackage-android": get_device_configuration["appPackage-android"] + "platformName-android & iOS": get_device_configuration["platformName-android & iOS"], + "appPackage-android & iOS": get_device_configuration["appPackage-android & iOS"] } yield passPoint_data @@ -101,8 +101,8 @@ def get_ToggleAirplaneMode_data(request, get_device_configuration): "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", # Android - "platformName-android": get_device_configuration["platformName-android"], - "appPackage-android": get_device_configuration["appPackage-android"] + "platformName-android & iOS": get_device_configuration["platformName-android & iOS"], + "appPackage-android & iOS": get_device_configuration["appPackage-android & iOS"] } yield passPoint_data @@ -119,8 +119,8 @@ def get_maverick_google_search_data(request, get_device_configuration): # "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", # "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", # Android - "platformName-android": get_device_configuration["platformName-android"], - "appPackage-android": get_device_configuration["appPackage-android"] + "platformName-android & iOS": get_device_configuration["platformName-android & iOS"], + "appPackage-android & iOS": get_device_configuration["appPackage-android & iOS"] } yield passPoint_data @@ -131,8 +131,8 @@ def get_ToggleWifiMode_data(request, get_device_configuration): # iOS "bundleId-iOS-Settings": get_device_configuration["bundleId-iOS-Settings"], # Android - "platformName-android": get_device_configuration["platformName-android"], - "appPackage-android": get_device_configuration["appPackage-android"] + "platformName-android & iOS": get_device_configuration["platformName-android & iOS"], + "appPackage-android & iOS": get_device_configuration["appPackage-android & iOS"] } yield passPoint_data @@ -435,14 +435,14 @@ def setup_perfectoMobile_android(request, get_device_configuration): urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) capabilities = { - 'platformName': get_device_configuration["platformName-android"], - 'model': get_device_configuration["model-android"], + 'platformName': get_device_configuration["platformName-android & iOS"], + 'model': get_device_configuration["model-android & iOS"], 'browserName': 'mobileOS', # 'automationName' : 'Appium', 'securityToken': PERFECTO_DETAILS["securityToken"], 'useAppiumForWeb': 'false', 'useAppiumForHybrid': 'false', - # 'bundleId' : request.config.getini("appPackage-android"), + # 'bundleId' : request.config.getini("appPackage-android & iOS"), } if not is_device_Available_timeout(request, capabilities['model']): From 1ed2f773049971a0cd2a9fd843de4b5991853195 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Tue, 5 Jul 2022 10:08:41 +0530 Subject: [PATCH 23/25] Speed test by ookla Signed-off-by: Jyothsna-setti --- tests/e2e/interOp/conftest.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/e2e/interOp/conftest.py b/tests/e2e/interOp/conftest.py index 46e771ed843..11df5d05c3e 100644 --- a/tests/e2e/interOp/conftest.py +++ b/tests/e2e/interOp/conftest.py @@ -95,11 +95,16 @@ def get_ToggleAirplaneMode_data(request, get_device_configuration): "webURL": "https://www.google.com", "lblSearch": "//*[@class='gLFyf']", "elelSearch": "(//*[@class='sbic sb43'])[1]", - "BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']", + # "SpeedCheck":"" + "elelSearch": "(//*[@class='a4bIc'])[1]", + "SpeedCheck":"//*[@class='BYM4Nd']//*[@class='q8U8x MBeuO ynAwRc oewGkc LeUQr']", + "Go":"//*[@class='js-start-test test-mode-multi']", + + # "BtnRunSpeedTest": "//*[text()='RUN SPEED TEST']", "bundleId-iOS-Settings": get_device_configuration["bundleId-iOS-Settings"], "bundleId-iOS-Safari": get_device_configuration["bundleId-iOS-Safari"], - "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", - "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", + # "downloadMbps": "//*[@id='knowledge-verticals-internetspeedtest__download']/P[@class='spiqle']", + # "UploadMbps": "//*[@id='knowledge-verticals-internetspeedtest__upload']/P[@class='spiqle']", # Android "platformName-android & iOS": get_device_configuration["platformName-android & iOS"], "appPackage-android & iOS": get_device_configuration["appPackage-android & iOS"] From 4b1f880768a7861558d6fe8c4d9f6be894dcfd57 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Tue, 5 Jul 2022 10:12:45 +0530 Subject: [PATCH 24/25] Speedtest Signed-off-by: Jyothsna-setti --- .../bridge_mode/rate_limiting/iOS/test_rate_limiting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py index 83c665d31ba..52f25d7c5da 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py @@ -107,6 +107,7 @@ class TestRateLimitingBridge(object): @pytest.mark.wpa2_personal @pytest.mark.twog + @pytest.mark.speedtestbyookla def test_rate_limiting_wpa2_2g(self, request, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0] From 90df237c1f00243301f33c4ac2cd8c95de7c4336 Mon Sep 17 00:00:00 2001 From: Jyothsna-setti Date: Thu, 7 Jul 2022 00:22:14 +0530 Subject: [PATCH 25/25] speedtest Signed-off-by: Jyothsna-setti --- .../bridge_mode/rate_limiting/android/test_rate_limiting.py | 1 + .../bridge_mode/rate_limiting/iOS/test_rate_limiting.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/android/test_rate_limiting.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/android/test_rate_limiting.py index 535fafda734..0dac8e80f11 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/android/test_rate_limiting.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/android/test_rate_limiting.py @@ -169,6 +169,7 @@ def test_rate_limiting_wpa2_5g(self, request, get_vif_state, get_ap_logs, @pytest.mark.wpa @pytest.mark.twog + @pytest.mark.speedcheckk def test_rate_limiting_wpa_2g(self, request, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, setup_perfectoMobile_android): profile_data = setup_params_general["ssid_modes"]["wpa"][0] diff --git a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py index 52f25d7c5da..83c665d31ba 100644 --- a/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py +++ b/tests/e2e/interOp/validation_of_operating_modes/bridge_mode/rate_limiting/iOS/test_rate_limiting.py @@ -107,7 +107,6 @@ class TestRateLimitingBridge(object): @pytest.mark.wpa2_personal @pytest.mark.twog - @pytest.mark.speedtestbyookla def test_rate_limiting_wpa2_2g(self, request, get_vif_state, get_ap_logs, get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS): profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]