From 8215fb490e23129dea4329d68263318c491ab26a Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 11:07:37 +0400 Subject: [PATCH 01/16] dockerize job added --- .github/workflows/ui.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index befa507e8..70eeb0e1c 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -7,6 +7,25 @@ on: workflow_dispatch: jobs: + dockerize: + name: Dockerize neon tests + if: ${{ github.ref_name != 'develop'}} + runs-on: [ "self-hosted", "k8s-prod" ] + steps: + - uses: actions/checkout@v4 + - name: Dockerize neon tests + uses: ./.github/actions/dockerize-neon-tests + with: + image_tag: ${{ github.sha }} + docker_username: ${{ secrets.DOCKER_USERNAME }} + docker_password: ${{ secrets.DOCKER_PASSWORD }} + image_name: ${{ env.IMAGE }} + docker_hub_org_name: ${{ env.DOCKER_HUB_ORG_NAME }} + - name: "Define image tag" + id: image_tag + uses: ./.github/actions/define-image-tag + outputs: + tag: ${{ steps.image_tag.outputs.tag }} test: runs-on: ubuntu-latest From 6d8e5b8ba30028a6eee2fcebda1d1e01fe0fa3d6 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 12:53:44 +0400 Subject: [PATCH 02/16] notification added --- .github/workflows/ui.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 70eeb0e1c..9de2d2371 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -67,7 +67,19 @@ jobs: id: run-tests run: docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" - + send-notification: + name: Send notification on failure + needs: + - run-tests + runs-on: [ "self-hosted", "k8s-prod" ] + steps: + - uses: actions/checkout@v4 + - name: "Notify on failure." + if: failure() && github.ref_name == 'develop' + run: | + docker exec -i ${{ env.CONTAINER }} \ + python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \ + -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group ${{ env.FAILED_TEST_GROUP }} - name: "Generate allure report" if: always() uses: ./.github/actions/generate-allure-report From 7c6f213bcc11ac7751c46912ce8e89e6426e393c Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:00:53 +0400 Subject: [PATCH 03/16] notification added --- .github/workflows/ui.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 9de2d2371..6ec526ee6 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -63,6 +63,7 @@ jobs: " docker exec -i ${{ env.CONTAINER_NAME }} bash -c "$CMD" + run-tests: - name: Run tests id: run-tests run: From 62b0a4fdceeb3489f0f72991d1bf76550cb62112 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:05:19 +0400 Subject: [PATCH 04/16] notification added --- .github/workflows/ui.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 6ec526ee6..9179c11ed 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -64,13 +64,14 @@ jobs: docker exec -i ${{ env.CONTAINER_NAME }} bash -c "$CMD" run-tests: - - name: Run tests - id: run-tests - run: - docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" + name: Run tests + id: run-tests + run: + docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" send-notification: name: Send notification on failure needs: + - dockerize - run-tests runs-on: [ "self-hosted", "k8s-prod" ] steps: From fc3471ca193927c6e8df906849d88a057c9b77f0 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:33:48 +0400 Subject: [PATCH 05/16] notification added --- .github/workflows/ui.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 9179c11ed..65dd68820 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -63,25 +63,23 @@ jobs: " docker exec -i ${{ env.CONTAINER_NAME }} bash -c "$CMD" - run-tests: - name: Run tests - id: run-tests - run: - docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" - send-notification: - name: Send notification on failure - needs: - - dockerize - - run-tests - runs-on: [ "self-hosted", "k8s-prod" ] - steps: - - uses: actions/checkout@v4 - - name: "Notify on failure." + - name: Run tests + id: run-tests + run: + docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" + + - name: Send notification on failure + needs: + - dockerize + runs-on: [ "self-hosted", "k8s-prod" ] + steps: + - uses: actions/checkout@v4 + - name: "Notify on failure." if: failure() && github.ref_name == 'develop' run: | docker exec -i ${{ env.CONTAINER }} \ python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \ - -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group ${{ env.FAILED_TEST_GROUP }} + -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group == 'ui' - name: "Generate allure report" if: always() uses: ./.github/actions/generate-allure-report From b1979409af017c72f1353504886a8e3094b9e7f1 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:39:17 +0400 Subject: [PATCH 06/16] notification added --- .github/workflows/ui.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 65dd68820..8cfe09a07 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -10,7 +10,7 @@ jobs: dockerize: name: Dockerize neon tests if: ${{ github.ref_name != 'develop'}} - runs-on: [ "self-hosted", "k8s-prod" ] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Dockerize neon tests @@ -30,6 +30,7 @@ jobs: runs-on: ubuntu-latest env: + BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" IMAGE_NAME: ${{ github.repository_owner }}/neon_tests CHROME_EXT_PASSWORD: ${{ secrets.CHROME_EXT_PASSWORD }} CONTAINER_NAME: neon_tests From ac58fb2ecd440a12ecb02ec19c82783e9bb8787c Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:42:51 +0400 Subject: [PATCH 07/16] notification added --- .github/workflows/ui.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 8cfe09a07..8446fb21e 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -72,7 +72,7 @@ jobs: - name: Send notification on failure needs: - dockerize - runs-on: [ "self-hosted", "k8s-prod" ] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: "Notify on failure." From 9d803e72ac0281080f375263ddcfd381180a3648 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 13:47:52 +0400 Subject: [PATCH 08/16] notification added --- .github/workflows/ui.yml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 8446fb21e..a806cdefd 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -9,7 +9,7 @@ on: jobs: dockerize: name: Dockerize neon tests - if: ${{ github.ref_name != 'develop'}} + if: ${{ github.ref_name != 'develop' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -26,6 +26,7 @@ jobs: uses: ./.github/actions/define-image-tag outputs: tag: ${{ steps.image_tag.outputs.tag }} + test: runs-on: ubuntu-latest @@ -66,21 +67,9 @@ jobs: - name: Run tests id: run-tests - run: + run: | docker exec -i ${{ env.CONTAINER_NAME }} bash -c "CHROME_EXT_PASSWORD=${{ secrets.CHROME_EXT_PASSWORD }} python3 clickfile.py run ui --network ${{ env.NETWORK }}" - - name: Send notification on failure - needs: - - dockerize - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: "Notify on failure." - if: failure() && github.ref_name == 'develop' - run: | - docker exec -i ${{ env.CONTAINER }} \ - python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \ - -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group == 'ui' - name: "Generate allure report" if: always() uses: ./.github/actions/generate-allure-report @@ -89,4 +78,17 @@ jobs: network: ${{ env.NETWORK }} aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - tests_name: ui \ No newline at end of file + tests_name: ui + + notify: + name: Send notification on failure + needs: test + if: failure() && github.ref_name == 'develop' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: "Notify on failure" + run: | + docker exec -i ${{ needs.test.outputs.CONTAINER_NAME }} \ + python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \ + -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group ui From 340714b7e0c6936f8a46a0135caa10ece8cd3f06 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 14:00:21 +0400 Subject: [PATCH 09/16] notification added --- .github/workflows/ui.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index a806cdefd..a720b4b84 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -28,6 +28,7 @@ jobs: tag: ${{ steps.image_tag.outputs.tag }} test: + needs: dockerize runs-on: ubuntu-latest env: From 38c9e4061097cfbef9fa0ee0c43a147db5e6bf30 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 14:35:34 +0400 Subject: [PATCH 10/16] notification added --- .github/workflows/ui.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index a720b4b84..f1cbc9981 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -6,6 +6,14 @@ on: - cron: "0 3 * * 0,1,2,3,4" workflow_dispatch: +env: + BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + IMAGE_NAME: ${{ github.repository_owner }}/neon_tests + CHROME_EXT_PASSWORD: ${{ secrets.CHROME_EXT_PASSWORD }} + DOCKER_HUB_ORG_NAME: ${{ github.repository_owner }} + CONTAINER_NAME: neon_tests + NETWORK: "devnet" + jobs: dockerize: name: Dockerize neon tests @@ -19,7 +27,7 @@ jobs: image_tag: ${{ github.sha }} docker_username: ${{ secrets.DOCKER_USERNAME }} docker_password: ${{ secrets.DOCKER_PASSWORD }} - image_name: ${{ env.IMAGE }} + image_name: ${{ env.IMAGE_NAME }} docker_hub_org_name: ${{ env.DOCKER_HUB_ORG_NAME }} - name: "Define image tag" id: image_tag @@ -31,28 +39,14 @@ jobs: needs: dockerize runs-on: ubuntu-latest - env: - BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - IMAGE_NAME: ${{ github.repository_owner }}/neon_tests - CHROME_EXT_PASSWORD: ${{ secrets.CHROME_EXT_PASSWORD }} - CONTAINER_NAME: neon_tests - NETWORK: "devnet" - steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Set IMAGE_TAG - id: image-tag - run: | - GITHUB_REF="${{ github.ref }}" - IMAGE_TAG="${GITHUB_REF#refs/heads/}" - echo "IMAGE_TAG=$IMAGE_TAG" | tee -a $GITHUB_OUTPUT - - name: Run tests container id: run-container run: | - IMAGE=${{ env.IMAGE_NAME }}:${{ steps.image-tag.outputs.IMAGE_TAG }} + IMAGE=${{ env.IMAGE_NAME }}:${{ needs.dockerize.outputs.tag }} docker run -d --name ${{ env.CONTAINER_NAME }} $IMAGE tail -f /dev/null - name: Install Chrome @@ -90,6 +84,6 @@ jobs: - uses: actions/checkout@v4 - name: "Notify on failure" run: | - docker exec -i ${{ needs.test.outputs.CONTAINER_NAME }} \ + docker exec -i ${{ env.CONTAINER_NAME }} \ python3 ./clickfile.py send-notification -u ${{ secrets.SLACK_QA_CHANNEL_URL }} \ -b ${{ env.BUILD_URL }} --network ${{ env.NETWORK }} --test-group ui From 6084bcecae0d7c3d8fe856f0e236ddb96c0192b2 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 16:08:18 +0400 Subject: [PATCH 11/16] switch fixed --- utils/base_page.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/base_page.py b/utils/base_page.py index 1e6a6b45b..b40fbb0eb 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -6,6 +6,9 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.select import Select +from ui.tests.website_tests.conftest import driver + + @pytest.mark.usefixtures("setup") class BasePage(abc.ABC): _url:str @@ -27,4 +30,5 @@ def assert_page_url(self,url=None): assert url == current_url, f"The url is {current_url}" def switch_window(self,index:int): + WebDriverWait(self.driver, 10).until(len(self.driver.window_handles) > index) self.driver.switch_to.window(self.driver.window_handles[index]) \ No newline at end of file From bdaa7699790fc37f7e680cf5d1a900933e43a5bb Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 17:04:28 +0400 Subject: [PATCH 12/16] switch fixed --- utils/base_page.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/utils/base_page.py b/utils/base_page.py index b40fbb0eb..1e6a6b45b 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -6,9 +6,6 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.select import Select -from ui.tests.website_tests.conftest import driver - - @pytest.mark.usefixtures("setup") class BasePage(abc.ABC): _url:str @@ -30,5 +27,4 @@ def assert_page_url(self,url=None): assert url == current_url, f"The url is {current_url}" def switch_window(self,index:int): - WebDriverWait(self.driver, 10).until(len(self.driver.window_handles) > index) self.driver.switch_to.window(self.driver.window_handles[index]) \ No newline at end of file From 3d659b20bae8c70ea380d7ecb2fea038a8c2e1c5 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Thu, 16 Jan 2025 17:13:44 +0400 Subject: [PATCH 13/16] switch fixed --- utils/base_page.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/base_page.py b/utils/base_page.py index 1e6a6b45b..6bfa33aee 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -27,4 +27,8 @@ def assert_page_url(self,url=None): assert url == current_url, f"The url is {current_url}" def switch_window(self,index:int): + WebDriverWait(self.driver, 10).until( + lambda driver: len(driver.window_handles) > index, + message=f"Expected at least {index + 1} windows, but found {len(self.driver.window_handles)}" + ) self.driver.switch_to.window(self.driver.window_handles[index]) \ No newline at end of file From 7c73b9a77a87c924779783b7eb929d7f0a2d2259 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Fri, 17 Jan 2025 13:37:37 +0400 Subject: [PATCH 14/16] assertion for count of windows added --- utils/base_page.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/base_page.py b/utils/base_page.py index 6bfa33aee..1da632602 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -28,7 +28,8 @@ def assert_page_url(self,url=None): def switch_window(self,index:int): WebDriverWait(self.driver, 10).until( - lambda driver: len(driver.window_handles) > index, - message=f"Expected at least {index + 1} windows, but found {len(self.driver.window_handles)}" + lambda driver: len(driver.window_handles) > index ) + assert len(self.driver.window_handles) == index + 1, \ + f"Expected {index + 1} windows, but found {len(self.driver.window_handles)}" self.driver.switch_to.window(self.driver.window_handles[index]) \ No newline at end of file From b7741936f0013de3f7920a129307a00c7cc35e56 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Fri, 17 Jan 2025 14:11:55 +0400 Subject: [PATCH 15/16] made separate methods for assertion and switch --- .github/workflows/ui.yml | 1 - ui/tests/website_tests/test_MainPage.py | 3 +++ utils/base_page.py | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index f1cbc9981..f20a3b221 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -9,7 +9,6 @@ on: env: BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" IMAGE_NAME: ${{ github.repository_owner }}/neon_tests - CHROME_EXT_PASSWORD: ${{ secrets.CHROME_EXT_PASSWORD }} DOCKER_HUB_ORG_NAME: ${{ github.repository_owner }} CONTAINER_NAME: neon_tests NETWORK: "devnet" diff --git a/ui/tests/website_tests/test_MainPage.py b/ui/tests/website_tests/test_MainPage.py index 9a16593a9..30f9a7725 100644 --- a/ui/tests/website_tests/test_MainPage.py +++ b/ui/tests/website_tests/test_MainPage.py @@ -19,12 +19,14 @@ def test_logo_footer(self,main_page, menu_page, developers_page): def test_click_build_on_neon_button(self, main_page, menu_page, developers_page): main_page.click_on_build_on_neon_button() main_page.switch_window(1) + main_page.assert_windows_number(1) developers_page.assert_page_url() developers_page.assert_text_on_build_on_neon_block_link() def test_click_start_building_button(self, main_page, quick_start_page): main_page.click_start_building_button() main_page.switch_window(1) + main_page.assert_windows_number(1) quick_start_page.assert_page_url() quick_start_page.assert_text_on_quick_start_page_title() @@ -41,5 +43,6 @@ def test_explore_developer_hub_button(self, main_page, developers_page): def test_add_your_dapp_button(self, main_page, google_forms_page): main_page.click_add_your_dapp_button() main_page.switch_window(1) + main_page.assert_windows_number(1) google_forms_page.assert_page_url() google_forms_page.assert_text_on_googleform_title() \ No newline at end of file diff --git a/utils/base_page.py b/utils/base_page.py index 1da632602..707a9f486 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -30,6 +30,8 @@ def switch_window(self,index:int): WebDriverWait(self.driver, 10).until( lambda driver: len(driver.window_handles) > index ) + self.driver.switch_to.window(self.driver.window_handles[index]) + + def assert_windows_number(self,index:int): assert len(self.driver.window_handles) == index + 1, \ - f"Expected {index + 1} windows, but found {len(self.driver.window_handles)}" - self.driver.switch_to.window(self.driver.window_handles[index]) \ No newline at end of file + f"Expected {index + 1} windows, but found {len(self.driver.window_handles)}" \ No newline at end of file From 909e31f3f69ee6e2acbad4df9c0181be0c37ee90 Mon Sep 17 00:00:00 2001 From: QA get-together Date: Fri, 17 Jan 2025 14:48:48 +0400 Subject: [PATCH 16/16] fixed assertion method --- ui/tests/website_tests/test_MainPage.py | 9 ++++++--- utils/base_page.py | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/tests/website_tests/test_MainPage.py b/ui/tests/website_tests/test_MainPage.py index 30f9a7725..038f903d4 100644 --- a/ui/tests/website_tests/test_MainPage.py +++ b/ui/tests/website_tests/test_MainPage.py @@ -1,3 +1,6 @@ +import pytest +from sqlalchemy.testing import skip_test + from ui.tests.website_tests.conftest import google_forms_page, menu_page, developers_page, main_page, \ ecosystem_page, quick_start_page @@ -19,14 +22,14 @@ def test_logo_footer(self,main_page, menu_page, developers_page): def test_click_build_on_neon_button(self, main_page, menu_page, developers_page): main_page.click_on_build_on_neon_button() main_page.switch_window(1) - main_page.assert_windows_number(1) + main_page.assert_windows_count(2) developers_page.assert_page_url() developers_page.assert_text_on_build_on_neon_block_link() def test_click_start_building_button(self, main_page, quick_start_page): main_page.click_start_building_button() main_page.switch_window(1) - main_page.assert_windows_number(1) + main_page.assert_windows_count(2) quick_start_page.assert_page_url() quick_start_page.assert_text_on_quick_start_page_title() @@ -43,6 +46,6 @@ def test_explore_developer_hub_button(self, main_page, developers_page): def test_add_your_dapp_button(self, main_page, google_forms_page): main_page.click_add_your_dapp_button() main_page.switch_window(1) - main_page.assert_windows_number(1) + main_page.assert_windows_count(2) google_forms_page.assert_page_url() google_forms_page.assert_text_on_googleform_title() \ No newline at end of file diff --git a/utils/base_page.py b/utils/base_page.py index 707a9f486..322cd5452 100644 --- a/utils/base_page.py +++ b/utils/base_page.py @@ -32,6 +32,6 @@ def switch_window(self,index:int): ) self.driver.switch_to.window(self.driver.window_handles[index]) - def assert_windows_number(self,index:int): - assert len(self.driver.window_handles) == index + 1, \ - f"Expected {index + 1} windows, but found {len(self.driver.window_handles)}" \ No newline at end of file + def assert_windows_count(self,expected_windows_count:int): + assert len(self.driver.window_handles) == expected_windows_count, \ + f"Expected {expected_windows_count} windows, but found {len(self.driver.window_handles)}" \ No newline at end of file