public void SaveTrcker(string tracker)
        {
            String cdate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");

            Console.WriteLine("Current Date  " + cdate);
            String parameter = "[{\"DataSource\":0,\"DataTime\":\"" + cdate + "\",\"Measurement\":{\"Description\":\"Stress\",\"DisplayOrder\":1,\"Id\":25,\"IsRequired\":true,\"MaxRangeValue\":0,\"MeasurementType\":{\"Id\":3,\"Name\":\"Likert scale\"},\"MinRangeValue\":0,\"Name\":\"Stress\",\"ToolTip\":\"\",\"Unit\":{\"Abbreviation\":\"\",\"Description\":\"\",\"DisplayName\":\"\",\"Id\":11,\"Name\":\"best(1) to worst(5) scale\"},\"allowDecimal\":false},\"UserId\":\"" + GlobalVariables.userid + "\",\"Value\":5,\"isValueModified\":true,\"isValueValid\":true}]";
            String url;

            url = baseurl + "/mobileapi/api/trackers/userId/" + GlobalVariables.userid;
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("GET");
            ApiKeywords.SetParameter("servicecycleid", GlobalVariables.servicecycleid);
            cma.SetMobileCommonHeader(token);
            string responsce = ApiKeywords.SendRequest();
            JToken to        = JToken.Parse(responsce);
            string exp       = "$.[?(@.Name=='" + tracker + "')].Guid";

            Guid = (String)to.SelectToken(exp, true);
            url  = baseurl + "/mobileapi/api/trackers/userId/" + GlobalVariables.userid + "/trackerGuid/" + Guid;
            //Console.WriteLine("URL:  "+url);
            ApiKeywords.InitializeRequest(url);
            //Console.WriteLine("Parameter   : " + parameter);
            ApiKeywords.SetParameter("application / json", parameter, "body");
            ApiKeywords.SetMethod("POST");
            cma.SetMobileCommonHeader(token);
            string  responsce1 = ApiKeywords.SendRequest();
            JObject ob         = JObject.Parse(responsce1);
            String  exp1       = "$.allow_user_feedback";
            String  result     = (String)ob.SelectToken(exp1);

            //System.Console.WriteLine("Response of API  " +result);
            softAssertions.Add("Stress Tracker save ", "false", result, "equals", "false");
        }
        public void VerifyTakerAPIs(String tracker, String title)
        {
            String url;

            url = baseurl + "/mobileapi/api/goals/tracker";
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("GET");
            ApiKeywords.SetParameter("trackerType", tracker);
            cma.SetMobileCommonHeader(token);
            string responsce = ApiKeywords.SendRequest();

            System.Console.WriteLine("Response of API  " + responsce);
            string[]        parentpath = { "inactive_goals" };
            string[]        childpath  = { "title" };
            List <string[]> value      = ApiKeywords.GetResponse(responsce, parentpath, childpath);

            //for (int i = 0; i < value.Count(); i++)
            //{
            //    System.Console.WriteLine("Response of API  " + value[i]);
            //    softAssertions.Add("Trckers avilable", value.ElementAt(i)[0], tracker, "equals", "false");
            //}
            //softAssertions.Add("Configuration ha_percentage", "0", value, "equals", "false");
            for (int i = 0; i < value.Count; i++)
            {
                for (int j = 0; j < value.ElementAt(0).Count(); j++)
                {
                    Console.WriteLine("Title" + value.ElementAt(i)[j]);
                    softAssertions.Add("Trckers avilable", value.ElementAt(i)[j], title, "equals", "false");
                }
            }
        }
Example #3
0
        public string GetToken()
        {
            Common cmn    = new Common();
            string env    = cmn.GetEnvFromUrl();
            string apiurl = "https://" + env + "services.onlifehealth.com/login/auth/token";

            Console.WriteLine("ApiUrl : " + apiurl);
            ApiKeywords.InitializeRequest(apiurl);
            ApiKeywords.SetMethod("post");
            ApiKeywords.SetParameter("platform_Id", "android");
            ApiKeywords.SetParameter("client_secret", "YcOTVgx11etcu0KFpPTWdumUTkvs7A3wxjqSqSjPRZw");
            ApiKeywords.SetParameter("scope", "manage");
            ApiKeywords.SetParameter("password", "Password1");
            ApiKeywords.SetParameter("device_token", "f3SBXqMIq40:APA91bFRoVTbQB0fJk5Cr2fPfQF1b3e_8Tn_rmPMjaLryCrCwAuMCEqzsBAIug-E6OQ7Qe2zaF5UBjtGUh7-P30IslZL6_WV_Yd4nf9hhBVCOkO7-9WnhNqv2JPgid5TJEXkAWZOwLa9");
            ApiKeywords.SetParameter("client_id", "277a638465ca44ab917fe4f45f2154a3");
            ApiKeywords.SetParameter("username", GlobalVariables.username);
            ApiKeywords.SetParameter("grant_type", "password");
            string response = ApiKeywords.SendRequest();

            Console.WriteLine("\nResponse : " + response);

            dynamic stuff = Newtonsoft.Json.JsonConvert.DeserializeObject(response);
            string  token = stuff.Access_Token;

            token = "Bearer " + token;
            Console.WriteLine("\n\nAccess_Token : " + token);

            return(token);
        }
Example #4
0
        public void getUserLoginDetails(string username)
        {
            String url;
            string path;

            url = GetServicesUrl() + "/mobileapi/api/logindetails";
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("GET");
            ApiKeywords.SetParameter("username", username);
            string responsce = ApiKeywords.SendRequest();

            path = "actor_Id";
            string actorid = ApiKeywords.GetValueFromJSONObject(responsce, path);

            System.Console.WriteLine("Response of API  " + responsce);
            //System.Console.WriteLine("Response of API  " + actorid);
            GlobalVariables.actorid = actorid;
            path = "user_Id";
            string user_Id = ApiKeywords.GetValueFromJSONObject(responsce, path);

            GlobalVariables.userid = user_Id;
            path = "serviceCycle_Id";
            string serviceCycle_Id = ApiKeywords.GetValueFromJSONObject(responsce, path);

            GlobalVariables.servicecycleid = serviceCycle_Id;
            path = "group_Id";
            string group_Id = ApiKeywords.GetValueFromJSONObject(responsce, path);

            GlobalVariables.groupid = group_Id;
        }
Example #5
0
        public void VerifyLoginDetailsAPI(string username)
        {
            String url;

            url = baseurl + "/mobileapi/api/logindetails";
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("GET");
            ApiKeywords.SetParameter("username", username);
            string responsce = ApiKeywords.SendRequest();
            string path      = "actor_Id";
            string actorid   = ApiKeywords.GetValueFromJSONObject(responsce, path);

            //System.Console.WriteLine("Response of API  " + responsce);
            //System.Console.WriteLine("Response of API  " + actorid);
            GlobalVariables.actorid = actorid;
        }
Example #6
0
        // Call by Dashboard tile
        public void VerifyDashboardTile()
        {
            String url;

            url = baseurl + "/mobileapi/api/dashboardtiles";
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("POST");
            ApiKeywords.SetParameter("application / json", "{\"date\":\"09\\/19\\/2018\",\"tiles\":[\"points\",\"unread_messages_count\"]}", "body");
            cma.SetMobileCommonHeader(token);
            string responsce = ApiKeywords.SendRequest();

            System.Console.WriteLine("Response of API  " + responsce);
            string path  = "ha_percentage";
            string value = ApiKeywords.GetValueFromJSONObject(responsce, path);

            softAssertions.Add("Configuration ha_percentage", "0", value, "equals", "false");
        }
        public void VerifyAllmemberTrakerListAPI(string[] tracker)
        {
            String url;

            url = baseurl + "/mobileapi/api/trackers/userId/" + GlobalVariables.userid;
            ApiKeywords.InitializeRequest(url);
            ApiKeywords.SetMethod("GET");
            ApiKeywords.SetParameter("servicecycleid", GlobalVariables.servicecycleid);
            cma.SetMobileCommonHeader(token);
            string responsce = ApiKeywords.SendRequest();
            JToken to        = JToken.Parse(responsce);

            for (int i = 0; i < tracker.Length; i++)
            {
                string exp = "$.[?(@.Name=='" + tracker[i] + "')].Name";


                //String Guid = (String)to.SelectToken(exp,true);
                String name = (String)to.SelectToken(exp, true);
                // System.Console.WriteLine("exp of API  " + exp);
                System.Console.WriteLine("Name of API  " + name);
                softAssertions.Add("Trckers avilable", tracker[i], name, "equals", "false");
            }

            //JToken to = JToken.Parse(responsce);

            //String Guid = (String)to.SelectToken("$.[?(@.Name=='Stress')].Guid");
            //System.Console.WriteLine("Guid of API  " + Guid);

            //string[] path = { "Name" };
            //List<string[]> value = ApiKeywords.GetResponse(responsce, path);
            //for (int i = 0; i < value.Count(); i++)
            //{
            //    System.Console.WriteLine("Response of API  " + tracker[i]);
            //    softAssertions.Add("Trckers avilable", value.ElementAt(i)[0], tracker[i], "equals", "false");
            //}
        }