Example #1
0
 public void UIContextDidChange(string context)
 {
     Controller.BeginWrite();
     Controller.WriteScript("--wait UI load " + context);
     Controller.WriteScript("coroutine.yield(WaitUILoad(\"" + context + "\"));" + Environment.NewLine);
     Controller.EndWriting();
 }
        public override void StartRecord(RecordController controller)
        {
            var fileTarget = Path.Combine(controller.PathData(), "Files");

            controller.WriteScript("-- Restore files");
            Copy(Application.persistentDataPath, fileTarget);
            controller.WriteScript("RestoreFiles(\"Files\");" + Environment.NewLine);
        }
        //private int counter = 0;

        public override void StartRecord(RecordController controller)
        {
            Controller = controller;
            //AutoWWW.RecordComponent = this;

            PathFileTarget = Path.Combine(controller.PathData(), "Apis");
            Directory.CreateDirectory(PathFileTarget);

            controller.WriteScript("--Load api files");
            controller.WriteScript("LoadApiFiles(\"Apis\");" + Environment.NewLine);
        }
Example #4
0
        public void OnClickAssert(string s)
        {
            Controller.WriteDelay();
            Controller.WriteScript(s);

            HidenMenu();
        }
        //public string StartRequest(string url, byte[] postData, Dictionary<string, string> headers)
        //{
        //    var guid = counter + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + url.Replace("https://", string.Empty).Replace("\\", "-") + ".txt";
        //    counter++;

        //    var fileName = guid;
        //    Controller.WriteScript("// start request : " + fileName);
        //    var postString = System.Text.Encoding.UTF8.GetString(postData);

        //    File.WriteAllText(Path.Combine(PathFileTarget, fileName),
        //        "URL=" + url + Environment.NewLine
        //        + "HEADER=" + DictionaryToJson(headers) + Environment.NewLine
        //        + "POST_DATA=" + postString + Environment.NewLine
        //        );

        //    return fileName;
        //}

        //string DictionaryToJson(Dictionary<string, string> dict)
        //{
        //    var entries = dict.Select(d =>
        //        string.Format("\"{0}\": [{1}]", d.Key, d.Value)).ToArray();
        //    return "{" + string.Join(",", entries) + "}";
        //}

        //public void ReceiveResponse(AutoWWW www)
        //{
        //    var fileName = www.GUID;
        //    Controller.WriteScript("// receive response : " + fileName);

        //    File.AppendAllText(Path.Combine(PathFileTarget, fileName),
        //        "RESPONSE_HEADER=" + DictionaryToJson(www.responseHeaders) + Environment.NewLine
        //        + (www.error != null ?
        //            "RESPONSE_ERROR=" + www.error + Environment.NewLine :
        //            "RESPONSE_DATA=" + www.text + Environment.NewLine
        //            )
        //        );
        //}

        public AutoWWW CreateWWW(string url, byte[] postData, Dictionary <string, string> headers)
        {
            var guid = DateTime.Now.ToString("yyyyMMddHHmmss") + "_"
                       + url.Replace("https://", string.Empty).Replace("http://", string.Empty).Replace("/", "-").Replace(":", "_") + ".txt";
            //counter++;

            var fileName = guid;

            Controller.WriteScript("-- start request : " + url);

            var wwwRecord = new AutoWWW(url, postData, headers, Path.Combine(PathFileTarget, fileName));

            wwwRecord.OnResponse += OnResponse;

            return(wwwRecord);
        }
Example #6
0
        private InputWriter CreateTouchWriter(IEventSystemHandler handler)
        {
            if (currentInputWriter != null)
            {
                DestroyWriter();
            }

            if (recordExecuteEvent.SkipSendTouch)
            {
                return(null);
            }

            var selectable = handler as Selectable;

            if (selectable != null && !selectable.interactable)
            {
                return(null);
            }

            var selectGameObject = (handler as Component).gameObject;

            if (selectGameObject.tag == "SkipRecord")
            {
                return(null);
            }

            Controller.WriteDelay();
            var isDrag = handler is ScrollRect;
            var currentDragSessionName = (isDrag ? "Drag_" : "Click_") + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + selectGameObject.name + ".txt";
            var currentDragSessionPath = Path.Combine(PathFileTarget, currentDragSessionName);

            Controller.WriteScript((isDrag ? "--drag " : "--click ") + selectGameObject.name);
            Controller.WriteScript("coroutine.yield(MouseInput(\"" + selectGameObject.name + "\", \"" + currentDragSessionName + "\"));" + Environment.NewLine);

            currentInputWriter = new TouchWriter();

            currentInputWriter.StartWriter(selectGameObject, currentDragSessionPath);
            Controller.BeginWrite();

            return(currentInputWriter);
        }