Skip to content

Commit aed31c9

Browse files
committed
test: fix ios browserstack appium set up
1 parent 07bab81 commit aed31c9

File tree

13 files changed

+290
-349
lines changed

13 files changed

+290
-349
lines changed

.github/workflows/ui-tests.yml

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -141,35 +141,6 @@ jobs:
141141
- name: Build iOS app
142142
working-directory: sample
143143
run: ./build_ios.sh
144-
- name: Install jq (if not installed)
145-
run: |
146-
if ! command -v jq &> /dev/null; then
147-
echo "jq not found, installing..."
148-
brew install jq
149-
else
150-
echo "jq is already installed"
151-
fi
152-
- name: Upload iOS app to BrowserStack
153-
working-directory: sample/Tests
154-
env:
155-
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
156-
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
157-
run: |
158-
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
159-
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
160-
161-
162-
# Extract app_url from the response using jq
163-
app_url=$(echo "$response" | jq -r '.app_url')
164-
165-
if [ -z "$app_url" ]; then
166-
echo "Error: app_url is not found in the response"
167-
exit 1 # Fail the workflow if app_url is not present
168-
fi
169-
170-
echo "app_url: $app_url"
171-
172-
echo "APP_URL=$app_url" >> $GITHUB_ENV
173144
- uses: actions/setup-python@v4
174145
with:
175146
python-version: "3.10"
@@ -180,6 +151,6 @@ jobs:
180151
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
181152
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
182153
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
183-
working-directory: sample/Tests
184-
run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
154+
working-directory: sample/Tests/test/ios
155+
run: browserstack-sdk pytest -xs ./test_ios.py --browserstack.config "browserstack.ios.yml"
185156

sample/Assets/Scenes/Passport/ZkEvm/ZkEvmSendTransaction.unity

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ MonoBehaviour:
12881288
m_TargetGraphic: {fileID: 1741513414}
12891289
m_HandleRect: {fileID: 1741513413}
12901290
m_Direction: 2
1291-
m_Value: 1
1291+
m_Value: 0
12921292
m_Size: 1
12931293
m_NumberOfSteps: 0
12941294
m_OnValueChanged:
@@ -1368,7 +1368,7 @@ RectTransform:
13681368
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
13691369
m_AnchorMin: {x: 0, y: 0}
13701370
m_AnchorMax: {x: 0, y: 0}
1371-
m_AnchoredPosition: {x: 432.63553, y: 0}
1371+
m_AnchoredPosition: {x: 427.93484, y: 0}
13721372
m_SizeDelta: {x: 0, y: 60}
13731373
m_Pivot: {x: 0.5, y: 0.5}
13741374
--- !u!114 &885137217
@@ -2046,7 +2046,7 @@ MonoBehaviour:
20462046
m_EditorClassIdentifier:
20472047
Output: {fileID: 1253661940}
20482048
ConfirmToggle: {fileID: 1782090444}
2049-
GetTrasactionReceiptToggle: {fileID: 1873101809}
2049+
GetTransactionReceiptToggle: {fileID: 1873101809}
20502050
ToInputField: {fileID: 649013321}
20512051
ValueInputField: {fileID: 1901422923}
20522052
DataInputField: {fileID: 1391622483}
@@ -3406,8 +3406,8 @@ RectTransform:
34063406
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
34073407
m_AnchorMin: {x: 0, y: 0}
34083408
m_AnchorMax: {x: 0, y: 0}
3409-
m_AnchoredPosition: {x: 885.5994, y: 0}
3410-
m_SizeDelta: {x: 1771.1991, y: 0}
3409+
m_AnchoredPosition: {x: 1153.199, y: 0}
3410+
m_SizeDelta: {x: 2306.398, y: 0}
34113411
m_Pivot: {x: 0.5, y: 0.5}
34123412
--- !u!114 &1833965463
34133413
MonoBehaviour:
@@ -4341,8 +4341,8 @@ RectTransform:
43414341
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
43424342
m_AnchorMin: {x: 0, y: 0}
43434343
m_AnchorMax: {x: 0, y: 0}
4344-
m_AnchoredPosition: {x: 885.59955, y: 0}
4345-
m_SizeDelta: {x: 1771.1991, y: 0}
4344+
m_AnchoredPosition: {x: 1153.199, y: 0}
4345+
m_SizeDelta: {x: 2306.398, y: 0}
43464346
m_Pivot: {x: 0.5, y: 0.5}
43474347
--- !u!114 &2131064088
43484348
MonoBehaviour:

sample/Assets/Scripts/Passport/ZkEvm/ZkEvmSendTransactionScript.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
using Immutable.Passport;
77
using Immutable.Passport.Model;
88
using Cysharp.Threading.Tasks;
9+
using UnityEngine.Serialization;
910

1011
public class ZkEvmSendTransactionScript : MonoBehaviour
1112
{
1213
#pragma warning disable CS8618
1314
[SerializeField] private Text Output;
1415

1516
[SerializeField] private Toggle ConfirmToggle;
16-
[SerializeField] private Toggle GetTrasactionReceiptToggle;
17+
[SerializeField] private Toggle GetTransactionReceiptToggle;
1718
[SerializeField] private InputField ToInputField;
1819
[SerializeField] private InputField ValueInputField;
1920
[SerializeField] private InputField DataInputField;
@@ -31,7 +32,7 @@ void Start()
3132
// Show get transaction receipt option if send transaction with confirmation toggle is off
3233
ConfirmToggle.onValueChanged.AddListener(delegate
3334
{
34-
GetTrasactionReceiptToggle.gameObject.SetActive(!ConfirmToggle.isOn);
35+
GetTransactionReceiptToggle.gameObject.SetActive(!ConfirmToggle.isOn);
3536
});
3637
}
3738
else
@@ -73,7 +74,7 @@ public async void SendTransaction()
7374
string transactionHash = await Passport.ZkEvmSendTransaction(request);
7475

7576
// Check if receipt is requested
76-
if (GetTrasactionReceiptToggle.isOn)
77+
if (GetTransactionReceiptToggle.isOn)
7778
{
7879
// Poll for the receipt and display transaction status
7980
string? status = await PollStatus(transactionHash);

sample/ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ PlayerSettings:
157157
applicationIdentifier:
158158
Android: com.immutable.ImmutableSample
159159
Standalone: com.immutable.Immutable-Sample
160-
iPhone: com.immutable.Immutable-Sample
160+
iPhone: com.immutable.Immutable-Sample-GameSDK
161161
buildNumber:
162162
Standalone: 0
163163
VisionOS: 0
164164
iPhone: 0
165165
tvOS: 0
166-
overrideDefaultApplicationIdentifier: 0
166+
overrideDefaultApplicationIdentifier: 1
167167
AndroidBundleVersionCode: 1
168168
AndroidMinSdkVersion: 26
169169
AndroidTargetSdkVersion: 33

sample/Tests/requirements-mobile.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ pytest==8.2.2
77
requests==2.32.3
88
mailslurp-client==15.19.22
99
Appium-Python-Client
10-
browserstack-sdk
10+
browserstack-sdk
11+
browserstack-local
12+
pytest-variables
13+
pytest-selenium

sample/Tests/browserstack.ios.yml renamed to sample/Tests/test/ios/browserstack.ios.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ buildName: iOS build
2121
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
2222
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
2323
framework: pytest
24-
source: pytest-browserstack:sample-sdk:v1.0
24+
source: pytest-appium-browserstack:sample-sdk:v1.0
2525

2626
# Set `app` to define the app that is to be used for testing.
2727
# It can either take the id of any uploaded app or the path of the app directly.
@@ -35,9 +35,9 @@ app: ./Payload.ipa #For running local tests
3535
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
3636

3737
platforms:
38-
- platformName: ios
39-
deviceName: iPhone 14 Pro Max
40-
platformVersion: 16
38+
- deviceName: iPhone 14 Pro
39+
osVersion: 16
40+
platformName: ios
4141

4242
# =======================
4343
# Parallels per Platform
@@ -57,10 +57,10 @@ parallelsPerPlatform: 1
5757
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
5858
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
5959
browserstackLocal: true # <boolean> (Default false)
60-
browserStackLocalOptions:
60+
# browserStackLocalOptions:
6161
#Options to be passed to BrowserStack local in-case of advanced configurations
6262
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
63-
forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
63+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
6464
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
6565

6666
# ===================
@@ -70,4 +70,3 @@ debug: false # <boolean> # Set to true if you need screenshots for every seleniu
7070
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
7171
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
7272
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)
73-
acceptInsecureCerts: true

sample/Tests/test/ios/conftest.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pytest
2+
from appium import webdriver
3+
from alttester import *
4+
5+
@pytest.fixture(scope='function')
6+
def setWebdriver(request, session_capabilities):
7+
session_capabilities["autoAcceptAlerts"] = True
8+
remoteURL = "https://hub.browserstack.com/wd/hub"
9+
driver = webdriver.Remote(remoteURL, session_capabilities)
10+
11+
altdriver = AltDriver(timeout=120)
12+
13+
request.instance.driver = driver
14+
request.instance.altdriver = altdriver
15+
16+
request.node._driver = driver
17+
18+
yield driver
19+
20+
driver.quit()
21+
altdriver.stop()

0 commit comments

Comments
 (0)