From 7bfce7630c301bd172094207fbbc4a45eceea545 Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Fri, 15 Nov 2024 09:55:46 +1300 Subject: [PATCH 1/5] test: update email --- sample/Tests/src/fetch_otp.py | 4 ++-- sample/Tests/test/test.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sample/Tests/src/fetch_otp.py b/sample/Tests/src/fetch_otp.py index 1513c4e7..f0fb422d 100644 --- a/sample/Tests/src/fetch_otp.py +++ b/sample/Tests/src/fetch_otp.py @@ -3,8 +3,8 @@ from mailslurp_client.api import InboxControllerApi, WaitForControllerApi import re -INBOX_ID = "33f17f82-274b-4269-9ce6-c620e89fcd8d" -EMAIL = "user-33f17f82-274b-4269-9ce6-c620e89fcd8d@mailslurp.biz" +INBOX_ID = "7cff2120-f684-4f31-886f-b29ca2400247" +EMAIL = "7cff2120-f684-4f31-886f-b29ca2400247@mailslurp.net" def get_mailslurp_client(): configuration = mailslurp_client.Configuration() diff --git a/sample/Tests/test/test.py b/sample/Tests/test/test.py index 299a2b81..05ebcc72 100644 --- a/sample/Tests/test/test.py +++ b/sample/Tests/test/test.py @@ -6,9 +6,9 @@ from alttester import * class TestConfig: - EMAIL = "user-33f17f82-274b-4269-9ce6-c620e89fcd8d@mailslurp.biz" - PASSPORT_ID="email|671ed01e2ab74483c4fb1f42" - WALLET_ADDRESS = "0x7dd423aeaccfbdd3a043bb8583085c7d97032de9" + EMAIL = "7cff2120-f684-4f31-886f-b29ca2400247@mailslurp.net" + PASSPORT_ID="email|67365ff8219c150ace187e28" + WALLET_ADDRESS = "0xdd571aa2f37f6b5166b14c6e43f1114bf444cdd8" class UnityTest(unittest.TestCase): From e5ddefef47fb8af56037cb6fed7b4f3a1d0d120e Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Fri, 15 Nov 2024 13:42:07 +1300 Subject: [PATCH 2/5] ci: fix ui tests directory --- .github/workflows/ui-tests.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 6105f7e3..32fb618e 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -64,10 +64,10 @@ jobs: include: - targetPlatform: StandaloneOSX runs-on: [self-hosted, macOS] - test_script: test_mac.sh + test_script: ./test_mac.sh - targetPlatform: StandaloneWindows64 runs-on: [self-hosted, windows] - test_script: test_windows.ps1 + test_script: ./test_windows.ps1 - targetPlatform: Android runs-on: [ self-hosted, macOS ] test_script: browserstack-sdk pytest -s ./test/test_android.py @@ -94,6 +94,9 @@ jobs: MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - working-directory: sample/Tests - run: ${{ matrix.test_script }} + run: | + pwd + ls -la + cd sample/Tests + ./${{ matrix.test_script }} \ No newline at end of file From eb60e39051923e794a5e0efcd6a3edd37607def9 Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Fri, 15 Nov 2024 16:43:42 +1300 Subject: [PATCH 3/5] test: update requirements for desktop and mobile --- .github/workflows/ui-tests.yml | 18 ++++++++++++++++-- sample/Tests/requirements-desktop.txt | 9 +++++++++ ...equirements.txt => requirements-mobile.txt} | 0 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 sample/Tests/requirements-desktop.txt rename sample/Tests/{requirements.txt => requirements-mobile.txt} (100%) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 32fb618e..82eff8f0 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -85,8 +85,22 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.10" - - name: Install dependencies - run: pip install -r "sample/Tests/requirements.txt" + - name: Install dependencies (Windows) + if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} + shell: pwsh + run: | + if (${{ matrix.targetPlatform }} -eq "StandaloneWindows64") { + pip install -r "sample/Tests/requirements-desktop.txt" + } + - name: Install dependencies (Mac) + if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} + shell: bash + run: | + if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then + pip install -r "sample/Tests/requirements-desktop.txt" + else + pip install -r "sample/Tests/requirements-mobile.txt" + fi - name: Run UI tests env: UNITY_APP_PATH: SampleApp.app diff --git a/sample/Tests/requirements-desktop.txt b/sample/Tests/requirements-desktop.txt new file mode 100644 index 00000000..d8c4eab0 --- /dev/null +++ b/sample/Tests/requirements-desktop.txt @@ -0,0 +1,9 @@ +AltTester_Driver==2.1.1 +google_api_python_client==2.136.0 +google_auth_oauthlib==1.2.0 +protobuf==5.27.2 +selenium==4.22.0 +pytest==8.2.2 +requests==2.32.3 +mailslurp-client==15.19.22 +Appium-Python-Client \ No newline at end of file diff --git a/sample/Tests/requirements.txt b/sample/Tests/requirements-mobile.txt similarity index 100% rename from sample/Tests/requirements.txt rename to sample/Tests/requirements-mobile.txt From e4088506ff0ab6d55560d440238815abb8c8519e Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Sat, 16 Nov 2024 11:00:49 +1300 Subject: [PATCH 4/5] test: remove ui test install dependency shell --- .github/workflows/ui-tests.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 57c8b76c..3dfa0359 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -88,14 +88,9 @@ jobs: python-version: "3.10" - name: Install dependencies (Windows) if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} - shell: pwsh - run: | - if (${{ matrix.targetPlatform }} -eq "StandaloneWindows64") { - pip install -r "sample/Tests/requirements-desktop.txt" - } + run: pip install -r "sample/Tests/requirements-desktop.txt" - name: Install dependencies (Mac) if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} - shell: bash run: | if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then pip install -r "sample/Tests/requirements-desktop.txt" From 85e0a138f5f8185ac1f15c5fe04da92532c15943 Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Sat, 16 Nov 2024 11:39:04 +1300 Subject: [PATCH 5/5] test: fix tests --- .github/workflows/ui-tests.yml | 1 + ..._code_logout.py => test_device_code_logout.py} | 0 sample/Tests/test/test_mac.py | 15 +++++++++++++-- sample/Tests/test/test_windows.py | 6 ++++-- sample/Tests/test_mac.sh | 4 ++-- sample/Tests/test_windows.ps1 | 2 +- 6 files changed, 21 insertions(+), 7 deletions(-) rename sample/Tests/test/{test_mac_device_code_logout.py => test_device_code_logout.py} (100%) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 3dfa0359..e1986d39 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -93,6 +93,7 @@ jobs: if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} run: | if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then + pip uninstall -y browserstack-sdk || true pip install -r "sample/Tests/requirements-desktop.txt" else pip install -r "sample/Tests/requirements-mobile.txt" diff --git a/sample/Tests/test/test_mac_device_code_logout.py b/sample/Tests/test/test_device_code_logout.py similarity index 100% rename from sample/Tests/test/test_mac_device_code_logout.py rename to sample/Tests/test/test_device_code_logout.py diff --git a/sample/Tests/test/test_mac.py b/sample/Tests/test/test_mac.py index 507df3c1..bd18c6d5 100644 --- a/sample/Tests/test/test_mac.py +++ b/sample/Tests/test/test_mac.py @@ -5,6 +5,8 @@ from alttester import * +from test import TestConfig + class MacTest(unittest.TestCase): altdriver = None @@ -52,7 +54,7 @@ def test_2_device_code_connect_imx(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x9cb14f273de4a8c3d8e9b4c5decbb53519dfa7bd", output.get_text()) + self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text()) def test_3_device_code_relogin(self): # Select use device code auth @@ -98,4 +100,13 @@ def test_4_device_code_reconnect(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x9cb14f273de4a8c3d8e9b4c5decbb53519dfa7bd", output.get_text()) \ No newline at end of file + self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text()) + + def test_5_logout(self): + # Logout + self.altdriver.find_object(By.NAME, "LogoutBtn").tap() + + time.sleep(10) + + # Wait for authenticated screen + self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene") \ No newline at end of file diff --git a/sample/Tests/test/test_windows.py b/sample/Tests/test/test_windows.py index 9aad24be..e5124d67 100644 --- a/sample/Tests/test/test_windows.py +++ b/sample/Tests/test/test_windows.py @@ -4,6 +4,8 @@ from alttester import * +from test import TestConfig + class WindowsTest(unittest.TestCase): altdriver = None @@ -39,7 +41,7 @@ def test_2_device_code_connect_imx(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x7dd423aeaccfbdd3a043bb8583085c7d97032de9", output.get_text()) + self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text()) def test_3_device_code_relogin(self): # Relogin @@ -73,4 +75,4 @@ def test_4_device_code_reconnect(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x7dd423aeaccfbdd3a043bb8583085c7d97032de9", output.get_text()) + self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text()) diff --git a/sample/Tests/test_mac.sh b/sample/Tests/test_mac.sh index 89e03bbf..aa00c476 100755 --- a/sample/Tests/test_mac.sh +++ b/sample/Tests/test_mac.sh @@ -96,7 +96,7 @@ run_python_script "src/device_code_logout.py" sleep 5 activate_sample_app "$app_name" echo "Running Mac device code logout test..." -pytest test/test_mac_device_code_logout.py +pytest test/test_device_code_logout.py wait close_chrome @@ -118,7 +118,7 @@ run_python_script "src/device_code_logout.py" sleep 5 activate_sample_app "$app_name" echo "Running Mac device code logout test..." -pytest test/test_mac_device_code_logout.py +pytest test/test_device_code_logout.py wait close_chrome diff --git a/sample/Tests/test_windows.ps1 b/sample/Tests/test_windows.ps1 index 9eb0552a..f1650a28 100644 --- a/sample/Tests/test_windows.ps1 +++ b/sample/Tests/test_windows.ps1 @@ -105,7 +105,7 @@ function Logout { Bring-SampleAppToForeground Write-Output "Running logout test..." - $pytestProcess = Start-Process -FilePath "pytest" -ArgumentList "test/test_mac_device_code_logout.py" -NoNewWindow -PassThru + $pytestProcess = Start-Process -FilePath "pytest" -ArgumentList "test/test_device_code_logout.py" -NoNewWindow -PassThru $pythonProcess | Wait-Process