Skip to content

[DX-3449] test: simplify mac and windows ui tests #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ jobs:
include:
- targetPlatform: StandaloneOSX
runs-on: [self-hosted, macOS]
test_script: ./test_mac.sh
test_script: pytest -xs test/test_mac.py::MacTest
- targetPlatform: StandaloneWindows64
runs-on: [self-hosted, windows]
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"
test_script: pytest -xs test/test_windows.py::WindowsTest
# - targetPlatform: Android
# runs-on: [ self-hosted, macOS ]
# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
concurrency:
group: test-${{ matrix.targetPlatform }}
runs-on: ${{ matrix.runs-on }}
Expand All @@ -83,6 +83,9 @@ jobs:
with:
name: Build-${{ matrix.targetPlatform }}
path: sample/Tests
- name: Make macOS artifact executable
if: ${{ matrix.targetPlatform == 'StandaloneOSX' }}
run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/*
- uses: actions/setup-python@v4
with:
python-version: "3.10"
Expand All @@ -107,26 +110,26 @@ jobs:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
working-directory: sample/Tests
run: ${{ matrix.test_script }}
test-ios:
name: Run iOS UI tests 🧪
runs-on: [ self-hosted, macOS ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: build iOS app
working-directory: sample
run: ./build_ios.sh
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r "sample/Tests/requirements.txt"
- name: Run UI tests
env:
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
working-directory: sample/Tests
run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
# test-ios:
# name: Run iOS UI tests 🧪
# runs-on: [ self-hosted, macOS ]
# steps:
# - uses: actions/checkout@v3
# with:
# lfs: true
# - name: build iOS app
# working-directory: sample
# run: ./build_ios.sh
# - uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# - name: Install dependencies
# run: pip install -r "sample/Tests/requirements.txt"
# - name: Run UI tests
# env:
# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
# working-directory: sample/Tests
# run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"

69 changes: 0 additions & 69 deletions sample/Tests/src/device_code_login.py

This file was deleted.

66 changes: 0 additions & 66 deletions sample/Tests/src/device_code_login_windows.py

This file was deleted.

37 changes: 0 additions & 37 deletions sample/Tests/src/device_code_logout.py

This file was deleted.

33 changes: 0 additions & 33 deletions sample/Tests/src/device_code_logout_windows.py

This file was deleted.

6 changes: 3 additions & 3 deletions sample/Tests/src/fetch_otp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import mailslurp_client
from mailslurp_client.api import InboxControllerApi, WaitForControllerApi
from mailslurp_client.api import WaitForControllerApi
import re

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

def get_mailslurp_client():
configuration = mailslurp_client.Configuration()
Expand Down
35 changes: 20 additions & 15 deletions sample/Tests/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import unittest
import requests
import re
import pytest

from alttester import *

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

class UnityTest(unittest.TestCase):

Expand All @@ -22,6 +23,7 @@ def setUpClass(cls):
def tearDownClass(cls):
cls.altdriver.stop()

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

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

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

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

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

# Register off-chain
# Wait up to 3 times for "Passport account already registered" to appear
#attempts = 0
#while attempts < 6:
# self.altdriver.find_object(By.NAME, "RegisterOffchainBtn").tap()
# self.assertEqual("Registering off-chain...", output.get_text())
# time.sleep(20)
# if "Passport account already registered" in output.get_text():
# break
# attempts += 1
attempts = 0
while attempts < 3:
self.altdriver.find_object(By.NAME, "RegisterOffchainBtn").tap()
self.assertEqual("Registering off-chain...", output.get_text())
time.sleep(20)
if "Passport account already registered" in output.get_text():
break
attempts += 1

# Assert that the desired text is found after waiting
#self.assertTrue(
# "Passport account already registered" in output.get_text(),
# f"Expected 'Passport account already registered' not found. Actual output: '{output.get_text()}'"
#)
self.assertTrue(
"Passport account already registered" in output.get_text(),
f"Expected 'Passport account already registered' not found. Actual output: '{output.get_text()}'"
)

# Get address
self.altdriver.find_object(By.NAME, "GetAddressBtn").tap()
Expand Down Expand Up @@ -158,6 +162,7 @@ def test_2_imx_functions(self):
self.altdriver.find_object(By.NAME, "CancelButton").tap()
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")

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

Expand Down
Loading
Loading