From 973377b4d77b3db934ffa91f0ca1652517de200d Mon Sep 17 00:00:00 2001 From: Dor-bl Date: Sun, 29 Dec 2024 07:23:42 +0200 Subject: [PATCH] test: refactor OrientationTest to improve teardown logic and reset orientation --- test/integration/IOS/OrientationTest.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/integration/IOS/OrientationTest.cs b/test/integration/IOS/OrientationTest.cs index 306e394e..4049bc1c 100644 --- a/test/integration/IOS/OrientationTest.cs +++ b/test/integration/IOS/OrientationTest.cs @@ -23,16 +23,21 @@ public void BeforeAll() public void AfterAll() { _driver?.Quit(); - if (!Env.ServerIsRemote()) - { - AppiumServers.StopLocalService(); - } + if (Env.ServerIsRemote()) return; + AppiumServers.StopLocalService(); + } + + [TearDown] + public void AfterEach() + { + var rotatable = (IRotatable)_driver; + rotatable.Orientation = ScreenOrientation.Portrait; } [Test] public void DeviceOrientationTest() { - var rotatable = ((IRotatable) _driver); + var rotatable = (IRotatable) _driver; rotatable.Orientation = ScreenOrientation.Landscape; Assert.That(rotatable.Orientation, Is.EqualTo(ScreenOrientation.Landscape)); }