[Non-ACR][ManualTemplate][Fix issues when using ConfirmFail] 78/182378/3
authorraycad <anh.vn@samsung.com>
Fri, 22 Jun 2018 10:18:38 +0000 (17:18 +0700)
committerLee Sanghoon <shooney.lee@samsung.com>
Mon, 25 Jun 2018 09:15:59 +0000 (09:15 +0000)
Change-Id: I7427ff341c10a672066649d91550ef6117bda8f0
Signed-off-by: raycad <anh.vn@samsung.com>
tct-suite-vs/Template/ManualTemplate/Utils.cs
tct-suite-vs/Template/ManualTemplateForWearable/Utils.cs

index 9741edc..e382e6d 100755 (executable)
@@ -246,9 +246,12 @@ namespace NUnit.Framework
     public class ManualTest
     {
         private static bool Confirmed = true;
+        private static int _type = 0;
+        private static string _messageFail = "";
 
         public static async Task WaitForConfirm()
         {
+
             LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Wait for confirm result ...");
 
             if (IsWearable())
@@ -257,13 +260,23 @@ namespace NUnit.Framework
             }
             else
             {
+                _messageFail = "";
                 Confirmed = false;
                 TestPage.GetInstance().UnlockUIButton();
                 while (true)
                 {
                     await Task.Delay(200);
-                    if (Confirmed)
+                    if (Confirmed && _type == 1)
+                    {
+                        _type = 0;
+                        break;
+                    }
+                    else if (_type == 2)
+                    {
+                        _type = 0;
+                        Assert.Fail(_messageFail);
                         break;
+                    }
                 }
             }
         }
@@ -294,21 +307,23 @@ namespace NUnit.Framework
                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "[Common] Confirm()");
 
                 Confirmed = true;
+                _type = 1;
             }
         }
 
-        public static async Task ConfirmFail(String message)
+        public static void ConfirmFail(String message)
         {
             if (IsWearable())
             {
-                await WearableTemplate.ManualTest.ConfirmFail(message);
+                WearableTemplate.ManualTest.ConfirmFail(message);
             }
             else
             {
                 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "[Common] ConfirmFail(String message)");
-                TestPage.GetInstance().UnlockUIButton();
-                await Task.Delay(2000);
-                Assert.Fail(message);
+
+                Confirmed = true;
+                _type = 2;
+                _messageFail = message;
             }
         }
 
index c4a152f..136e7d6 100755 (executable)
@@ -246,16 +246,28 @@ namespace WearableTemplate
     public class ManualTest
     {
         private static bool Confirmed = true;
+        private static int _type = 0;
+        private static string _messageFail = "";
 
         public static async Task WaitForConfirm()
         {
+            _messageFail = "";
             Confirmed = false;
             TestPage.GetInstance().UnlockUIButton();
             while (true)
             {
                 await Task.Delay(200);
-                if (Confirmed)
+                if (Confirmed && _type == 1)
+                {
+                    _type = 0;
+                    break;
+                }
+                else if (_type == 2)
+                {
+                    _type = 0;
+                    Assert.Fail(_messageFail);
                     break;
+                }
             }
         }
 
@@ -267,13 +279,14 @@ namespace WearableTemplate
         public static void Confirm()
         {
             Confirmed = true;
+            _type = 1;
         }
 
-        public static async Task ConfirmFail(String message)
+        public static void ConfirmFail(String message)
         {
-                TestPage.GetInstance().UnlockUIButton();
-                await Task.Delay(2000);
-                Assert.Fail(message);
+            Confirmed = true;
+            _type = 2;
+            _messageFail = message;
         }
 
         public static void DisplayLabel(String msg)
@@ -285,7 +298,7 @@ namespace WearableTemplate
                 HorizontalOptions = LayoutOptions.CenterAndExpand,
                 Text = msg + " is not support on this profile. So, you can not test this TC. please mark as PASS",
                 TextColor = global::Xamarin.Forms.Color.FromHex("#1E90FF"),
-                FontSize=4,
+                FontSize = 4,
             };
 
             var layout = new StackLayout()
@@ -310,7 +323,7 @@ namespace WearableTemplate
             {
                 VerticalOptions = LayoutOptions.CenterAndExpand,
                 HorizontalOptions = LayoutOptions.CenterAndExpand,
-                Text = msg ,
+                Text = msg,
                 TextColor = global::Xamarin.Forms.Color.FromHex("#1E90FF"),
                 FontSize = 4,
             };