Skip to content

Commit 8e58151

Browse files
authored
Merge pull request #355 from immutable/test/windows-mac-ui-tests
[DX-3449] test: simplify mac and windows ui tests
2 parents ec6cdcc + a351e7e commit 8e58151

14 files changed

+496
-663
lines changed

.github/workflows/ui-tests.yml

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ jobs:
6565
include:
6666
- targetPlatform: StandaloneOSX
6767
runs-on: [self-hosted, macOS]
68-
test_script: ./test_mac.sh
68+
test_script: pytest -xs test/test_mac.py::MacTest
6969
- targetPlatform: StandaloneWindows64
7070
runs-on: [self-hosted, windows]
71-
test_script: ./test_windows.ps1
72-
- targetPlatform: Android
73-
runs-on: [ self-hosted, macOS ]
74-
test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
71+
test_script: pytest -xs test/test_windows.py::WindowsTest
72+
# - targetPlatform: Android
73+
# runs-on: [ self-hosted, macOS ]
74+
# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
7575
concurrency:
7676
group: test-${{ matrix.targetPlatform }}
7777
runs-on: ${{ matrix.runs-on }}
@@ -83,6 +83,9 @@ jobs:
8383
with:
8484
name: Build-${{ matrix.targetPlatform }}
8585
path: sample/Tests
86+
- name: Make macOS artifact executable
87+
if: ${{ matrix.targetPlatform == 'StandaloneOSX' }}
88+
run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/*
8689
- uses: actions/setup-python@v4
8790
with:
8891
python-version: "3.10"
@@ -107,26 +110,26 @@ jobs:
107110
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
108111
working-directory: sample/Tests
109112
run: ${{ matrix.test_script }}
110-
test-ios:
111-
name: Run iOS UI tests 🧪
112-
runs-on: [ self-hosted, macOS ]
113-
steps:
114-
- uses: actions/checkout@v3
115-
with:
116-
lfs: true
117-
- name: build iOS app
118-
working-directory: sample
119-
run: ./build_ios.sh
120-
- uses: actions/setup-python@v4
121-
with:
122-
python-version: "3.10"
123-
- name: Install dependencies
124-
run: pip install -r "sample/Tests/requirements.txt"
125-
- name: Run UI tests
126-
env:
127-
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
128-
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
129-
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
130-
working-directory: sample/Tests
131-
run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
113+
# test-ios:
114+
# name: Run iOS UI tests 🧪
115+
# runs-on: [ self-hosted, macOS ]
116+
# steps:
117+
# - uses: actions/checkout@v3
118+
# with:
119+
# lfs: true
120+
# - name: build iOS app
121+
# working-directory: sample
122+
# run: ./build_ios.sh
123+
# - uses: actions/setup-python@v4
124+
# with:
125+
# python-version: "3.10"
126+
# - name: Install dependencies
127+
# run: pip install -r "sample/Tests/requirements.txt"
128+
# - name: Run UI tests
129+
# env:
130+
# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
131+
# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
132+
# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
133+
# working-directory: sample/Tests
134+
# run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
132135

sample/Tests/src/device_code_login.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

sample/Tests/src/device_code_login_windows.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

sample/Tests/src/device_code_logout.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

sample/Tests/src/device_code_logout_windows.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

sample/Tests/src/fetch_otp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import mailslurp_client
3-
from mailslurp_client.api import InboxControllerApi, WaitForControllerApi
3+
from mailslurp_client.api import WaitForControllerApi
44
import re
55

6-
INBOX_ID = "a1369a61-9149-4499-a75e-610523e2baa7"
7-
EMAIL = "a1369a61-9149-4499-a75e-610523e2baa7@mailslurp.net"
6+
INBOX_ID = "26b067b8-ef3a-4655-955a-19f157b35b6e"
7+
EMAIL = "26b067b8-ef3a-4655-955a-19f157b35b6e@mailslurp.net"
88

99
def get_mailslurp_client():
1010
configuration = mailslurp_client.Configuration()

sample/Tests/test/test.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import unittest
33
import requests
44
import re
5+
import pytest
56

67
from alttester import *
78

89
class TestConfig:
9-
EMAIL = "a1369a61-9149-4499-a75e-610523e2baa7@mailslurp.net"
10-
PASSPORT_ID="email|673a7cc7219c150ace38cf60"
11-
WALLET_ADDRESS = "0xf629c9f0fee71cce1b21a6e5b0db8df2e8cd7354"
10+
EMAIL = "26b067b8-ef3a-4655-955a-19f157b35b6e@mailslurp.net"
11+
PASSPORT_ID="email|673d0795219c150acebff862"
12+
WALLET_ADDRESS = "0x9af9826a83581ddfa0bdd7754de8a741ce64ebe8"
1213

1314
class UnityTest(unittest.TestCase):
1415

@@ -22,6 +23,7 @@ def setUpClass(cls):
2223
def tearDownClass(cls):
2324
cls.altdriver.stop()
2425

26+
@pytest.mark.skip(reason="Base test should not be executed directly")
2527
def test_0_other_functions(self):
2628
# Show set call timeout scene
2729
self.altdriver.find_object(By.NAME, "CallTimeout").tap()
@@ -37,6 +39,7 @@ def test_0_other_functions(self):
3739
self.altdriver.find_object(By.NAME, "CancelButton").tap()
3840
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
3941

42+
@pytest.mark.skip(reason="Base test should not be executed directly")
4043
def test_1_passport_functions(self):
4144
output = self.altdriver.find_object(By.NAME, "Output")
4245

@@ -61,6 +64,7 @@ def test_1_passport_functions(self):
6164
time.sleep(1)
6265
self.assertEqual("No linked addresses", output.get_text())
6366

67+
@pytest.mark.skip(reason="Base test should not be executed directly")
6468
def test_2_imx_functions(self):
6569
output = self.altdriver.find_object(By.NAME, "Output")
6670

@@ -75,20 +79,20 @@ def test_2_imx_functions(self):
7579

7680
# Register off-chain
7781
# Wait up to 3 times for "Passport account already registered" to appear
78-
#attempts = 0
79-
#while attempts < 6:
80-
# self.altdriver.find_object(By.NAME, "RegisterOffchainBtn").tap()
81-
# self.assertEqual("Registering off-chain...", output.get_text())
82-
# time.sleep(20)
83-
# if "Passport account already registered" in output.get_text():
84-
# break
85-
# attempts += 1
82+
attempts = 0
83+
while attempts < 3:
84+
self.altdriver.find_object(By.NAME, "RegisterOffchainBtn").tap()
85+
self.assertEqual("Registering off-chain...", output.get_text())
86+
time.sleep(20)
87+
if "Passport account already registered" in output.get_text():
88+
break
89+
attempts += 1
8690

8791
# Assert that the desired text is found after waiting
88-
#self.assertTrue(
89-
# "Passport account already registered" in output.get_text(),
90-
# f"Expected 'Passport account already registered' not found. Actual output: '{output.get_text()}'"
91-
#)
92+
self.assertTrue(
93+
"Passport account already registered" in output.get_text(),
94+
f"Expected 'Passport account already registered' not found. Actual output: '{output.get_text()}'"
95+
)
9296

9397
# Get address
9498
self.altdriver.find_object(By.NAME, "GetAddressBtn").tap()
@@ -158,6 +162,7 @@ def test_2_imx_functions(self):
158162
self.altdriver.find_object(By.NAME, "CancelButton").tap()
159163
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
160164

165+
@pytest.mark.skip(reason="Base test should not be executed directly")
161166
def test_3_zkevm_functions(self):
162167
output = self.altdriver.find_object(By.NAME, "Output")
163168

0 commit comments

Comments
 (0)