diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 965be880..219f3d25 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/sample/Assets/Editor/AndroidBuilder.cs b/sample/Assets/Editor/AndroidBuilder.cs index f904defd..3960ba2e 100644 --- a/sample/Assets/Editor/AndroidBuilder.cs +++ b/sample/Assets/Editor/AndroidBuilder.cs @@ -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); } diff --git a/sample/Assets/Editor/MacBuilder.cs b/sample/Assets/Editor/MacBuilder.cs index 0240cc81..f838b052 100644 --- a/sample/Assets/Editor/MacBuilder.cs +++ b/sample/Assets/Editor/MacBuilder.cs @@ -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); } diff --git a/sample/Assets/Editor/WindowsBuilder.cs b/sample/Assets/Editor/WindowsBuilder.cs index fa406d96..450a6023 100644 --- a/sample/Assets/Editor/WindowsBuilder.cs +++ b/sample/Assets/Editor/WindowsBuilder.cs @@ -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); } diff --git a/sample/Tests/test.py b/sample/Tests/test.py index 1fecda73..7df71c3b 100644 --- a/sample/Tests/test.py +++ b/sample/Tests/test.py @@ -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 \ No newline at end of file