[Bluetooth][Non-ACR] Enable Bluetooth Visiable Manual TCs 17/192917/4
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 13 Nov 2018 02:13:43 +0000 (11:13 +0900)
committerPyun DoHyun <dh79.pyun@samsung.com>
Wed, 14 Nov 2018 08:11:49 +0000 (08:11 +0000)
Change-Id: I53893aee2afee4f48f89390893722c3cc98561d5
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityDurationChangedEventArgs.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityModeChangedEventArgs.cs

index fae48e6..bfffc2a 100755 (executable)
@@ -32,7 +32,7 @@ namespace Tizen.Network.Bluetooth.Tests
             ManualTest.Confirm();
         }
 
-       //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Duration. Check if Duration has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityDurationChangedEventArgs.Duration A")]
@@ -40,34 +40,28 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Go to Bluetooth in Settings and change Visibility timeout to a value in minutes or hour")]
+        [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")]
         [Step(1, "Tap the Run button")]
-        [Postcondition(1, "Go to Bluetooth in Settings and set Visibility timeout to Always on")]
+        [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableTimeoutChanged int32:0 int16:0")]
+        [Step(3, "(Because there is no UX senario or entry point to set the visiable timeout, so we should generate the event using command line to pass this TCT")]
+        [Postcondition(1, "NA")]
         public static async Task Duration_READ_ONLY()
         {
             try
             {
-                BluetoothHelper.LaunchVisiblityAppControl("10");
+                EventHandler<VisibilityDurationChangedEventArgs> EventHandlerVisibilityDurationChanged = null;
 
-                await Task.Delay(5000);
-
-                // PRECONDITION
-                VisibilityMode mode = BluetoothAdapter.Visibility;
+                EventHandlerVisibilityDurationChanged = (sender, e) => {
+                    Assert.IsInstanceOf<int>(e.Duration, "duration parameter should be of type int");
+                    Log.Debug ("TCT", "[TestCase][VisibilityDurationChangedEventArgs][Duration_READ_ONLY] Pass");
+                    BluetoothHelper.DisplayPassLabel("VisibilityDurationChangedEventArgs.Duration_READ_ONLY");
+                    BluetoothAdapter.VisibilityDurationChanged -= EventHandlerVisibilityDurationChanged;
+                };
 
-                // TEST CODE
-                if (mode == VisibilityMode.TimeLimitedDiscoverable)
-                {
-                    BluetoothAdapter.VisibilityDurationChanged += EventHandlerVisibilityDurationChanged;
-                    await ManualTest.WaitForConfirm ();
+                BluetoothAdapter.VisibilityDurationChanged += EventHandlerVisibilityDurationChanged;
 
-                    // POSTCONDITON
-                    BluetoothAdapter.VisibilityDurationChanged -= EventHandlerVisibilityDurationChanged;
-                }
-                else
-                {
-                    Assert.Fail("Visibility mode is not properly set on the device");
-                }
-               }
+                await ManualTest.WaitForConfirm();
+            }
             catch (NotSupportedException)
             {
                 if (isBluetoothSupported == false)
index 058ac19..6643816 100755 (executable)
@@ -27,31 +27,7 @@ namespace Tizen.Network.Bluetooth.Tests
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static void EventHandlerVisibilityModeChanged(object sender, VisibilityModeChangedEventArgs e)
-        {
-            visibility = BluetoothAdapter.Visibility;
-            if (e.Result == BluetoothError.None)
-            {
-                Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Result_READ_ONLY] Pass");
-                BluetoothHelper.DisplayPassLabel("Result_READ_ONLY");
-                return;
-            }
-            else
-            {
-                Assert.Fail("[TestCase][VisibilityModeChanged][Result_READ_ONLY] Failed");
-            }
-            if (visibility == e.Visibility)
-            {
-                Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Visibility_READ_ONLY] Pass");
-                BluetoothHelper.DisplayPassLabel("Visibility_READ_ONLY");
-            }
-            else
-            {
-                Assert.Fail("[TestCase][VisibilityModeChanged][Visibility_READ_ONLY] Failed");
-            }
-        }
-
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Result. Check if Result has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Result A")]
@@ -59,22 +35,30 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
+        [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")]
         [Step(1, "Tap the Run button")]
-        [Step(2, "Go to Bluetooth in Settings and change Visibility timeout value")]
+        [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")]
+        [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")]
         [Postcondition(1, "NA")]
         public static async Task Result_READ_ONLY()
         {
             try
             {
-                BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged;
+                EventHandler<VisibilityModeChangedEventArgs> EventHandlerVisibilityModeChanged = null;
 
-                BluetoothHelper.LaunchVisiblityAppControl("10");
+                EventHandlerVisibilityModeChanged = (sender, e) => {
+                    if (e.Result == BluetoothError.None)
+                    {
+                        Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Result_READ_ONLY] Pass");
+                        BluetoothHelper.DisplayPassLabel("VisibilityModeChangedEventArgs.Result_READ_ONLY");
+                        BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged;
+                    }
+                };
+
+                BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged;
 
                 await ManualTest.WaitForConfirm();
-    
-               // POSTCONDITON
-                BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged;
-               }
+            }
             catch (NotSupportedException)
             {
                 if (isBluetoothSupported == false)
@@ -97,7 +81,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Visibility. Check if the Visibility has correct value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Visibility A")]
@@ -105,22 +89,28 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
+        [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")]
         [Step(1, "Tap the Run button")]
-        [Step(2, "Go to Bluetooth in Settings and change Visibility timeout value")]
+        [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")]
+        [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")]
         [Postcondition(1, "NA")]
         public static async Task Visibility_READ_ONLY()
         {
             try
             {
-                BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged;
+                EventHandler<VisibilityModeChangedEventArgs> EventHandlerVisibilityModeChanged = null;
 
-                BluetoothHelper.LaunchVisiblityAppControl("10");
+                EventHandlerVisibilityModeChanged = (sender, e) => {
+                    Assert.IsInstanceOf<VisibilityMode>(e.Visibility, "Visibility parameter should be of type VisibilityMode");
+                    Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Result_READ_ONLY] Pass");
+                    BluetoothHelper.DisplayPassLabel("VisibilityModeChangedEventArgs.Result_READ_ONLY");
+                    BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged;
+                };
 
-                await ManualTest.WaitForConfirm();
+                BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged;
 
-                // POSTCONDITON
-                BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged;
-               }
+                await ManualTest.WaitForConfirm();
+            }
             catch (NotSupportedException)
             {
                 if (isBluetoothSupported == false)