diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 6d57c9893..e1986d39e 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -65,10 +65,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 --browserstack.config "browserstack.android.yml" @@ -86,8 +86,18 @@ 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' }} + run: pip install -r "sample/Tests/requirements-desktop.txt" + - name: Install dependencies (Mac) + 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" + 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 000000000..d8c4eab0c --- /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 diff --git a/sample/Tests/src/fetch_otp.py b/sample/Tests/src/fetch_otp.py index 1513c4e79..f0fb422db 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 299a2b815..05ebcc72a 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): 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 507df3c1e..bd18c6d5d 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 9aad24be4..e5124d670 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 89e03bbfd..aa00c4768 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 9eb0552aa..f1650a28d 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