Skip to content

Commit

Permalink
chore: connect remote alttester server
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-yangy committed Oct 23, 2024
1 parent b8ffae9 commit 38bd447
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
ALTSERVER_HOST: 54.66.58.33
ALTSERVER_PORT: 13000
with:
targetPlatform: StandaloneOSX
projectPath: sample
Expand All @@ -53,11 +55,9 @@ jobs:
name: Build-StandaloneOSX
- name: Open application
run: |
pwd
ls -la
export RUN_IN_BROWSERSTACK="false"
export ALTSERVER_HOST="54.66.58.33"
export ALTSERVER_PORT=13000
export ALTSERVER_HOST="159.196.149.251"
chmod -R 755 SampleApp.app
open SampleApp.app
- uses: actions/setup-python@v4
Expand All @@ -67,7 +67,7 @@ jobs:
run: pip install -r "sample/Tests/requirements.txt"
- name: Run UI tests
run: |
export ALTSERVER_HOST="54.66.58.33"
export ALTSERVER_PORT=13000
export ALTSERVER_HOST="159.196.149.251"
pytest -s -v sample/Tests/test.py
16 changes: 16 additions & 0 deletions sample/Assets/Editor/AndroidBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ private static void SetupAltTester(BuildPlayerOptions buildPlayerOptions)
AltBuilder.CreateJsonFileForInputMappingOfAxis();

var instrumentationSettings = new AltInstrumentationSettings();
var host = System.Environment.GetEnvironmentVariable("ALTSERVER_HOST");
if (!string.IsNullOrEmpty(host))
{
instrumentationSettings.AltServerHost = host;
}

var port = System.Environment.GetEnvironmentVariable("ALTSERVER_PORT");
if (!string.IsNullOrEmpty(port))
{
instrumentationSettings.AltServerPort = int.Parse(port);
}
else
{
instrumentationSettings.AltServerPort = 13000;
}
instrumentationSettings.ResetConnectionData = true;
AltBuilder.InsertAltInScene(buildPlayerOptions.scenes[0], instrumentationSettings);
}

Expand Down
16 changes: 16 additions & 0 deletions sample/Assets/Editor/MacBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ private static void SetupAltTester(BuildPlayerOptions buildPlayerOptions)
AltBuilder.CreateJsonFileForInputMappingOfAxis();

var instrumentationSettings = new AltInstrumentationSettings();
var host = System.Environment.GetEnvironmentVariable("ALTSERVER_HOST");
if (!string.IsNullOrEmpty(host))
{
instrumentationSettings.AltServerHost = host;
}

var port = System.Environment.GetEnvironmentVariable("ALTSERVER_PORT");
if (!string.IsNullOrEmpty(port))
{
instrumentationSettings.AltServerPort = int.Parse(port);
}
else
{
instrumentationSettings.AltServerPort = 13000;
}
instrumentationSettings.ResetConnectionData = true;
AltBuilder.InsertAltInScene(buildPlayerOptions.scenes[0], instrumentationSettings);
}

Expand Down
16 changes: 16 additions & 0 deletions sample/Assets/Editor/WindowsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ private static void SetupAltTester(BuildPlayerOptions buildPlayerOptions)
AltBuilder.CreateJsonFileForInputMappingOfAxis();

var instrumentationSettings = new AltInstrumentationSettings();
var host = System.Environment.GetEnvironmentVariable("ALTSERVER_HOST");
if (!string.IsNullOrEmpty(host))
{
instrumentationSettings.AltServerHost = host;
}

var port = System.Environment.GetEnvironmentVariable("ALTSERVER_PORT");
if (!string.IsNullOrEmpty(port))
{
instrumentationSettings.AltServerPort = int.Parse(port);
}
else
{
instrumentationSettings.AltServerPort = 13000;
}
instrumentationSettings.ResetConnectionData = true;
AltBuilder.InsertAltInScene(buildPlayerOptions.scenes[0], instrumentationSettings);
}

Expand Down
27 changes: 18 additions & 9 deletions sample/Tests/test.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import unittest
import os
from alttester import *

class UnityTest(unittest.TestCase):

# altdriver = None
#
# @classmethod
# def setUpClass(cls):
# cls.altdriver = AltDriver()
#
# @classmethod
# def tearDownClass(cls):
# cls.altdriver.stop()
altdriver = None

@classmethod
def setUpClass(cls):
host = os.getenv('ALTSERVER_HOST', '127.0.0.1')
port = int(os.getenv('ALTSERVER_PORT', '13000'))
cls.altdriver = AltDriver(host=host, port=port)

@classmethod
def tearDownClass(cls):
cls.altdriver.stop()

def test(self):
# Select use device code auth
self.altdriver.find_object(By.NAME, "DeviceCodeAuth").tap()

# Wait for unauthenticated screen
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")

assert True

0 comments on commit 38bd447

Please sign in to comment.