Example #1
0
        public void TestMethod2()
        {
            HomeObject homeObj     = new HomeObject(driver);
            HomeAction homePageAct = new HomeAction(driver);

            try
            {
                Console.WriteLine("Test Started");
                WaitForMoment(4);
                homePageAct.ClickOnReportsLink();
                WaitForMoment(4);
                homePageAct.ClickOnHomePageLink();
                WaitForMoment(4);
                homePageAct.ClickOnDashboardLink();
                WaitForMoment(4);
                homePageAct.ClickOnHomePageLink();
                WaitForMoment(4);
                homePageAct.ClickOnAdministratonLink();
                WaitForMoment(4);
                homePageAct.ClickOnHomePageLink();
                WaitForMoment(2);

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
 public bool Grab(HomeObject objToGrab)
 {
     animator.SetTrigger("Interact");
     animator.SetFloat("DirX", direction.x);
     animator.SetFloat("DirY", direction.y);
     return(objToGrab.BeingGrabed());
 }
Example #3
0
        public void TC06_ImportDashboardReport()
        {
            HomeObject      homeObj      = new HomeObject(driver);
            HomeAction      homePageAct  = new HomeAction(driver);
            DashboardAction dashboardAct = new DashboardAction(driver);
            ReportingAction reportAct    = new ReportingAction(driver);
            string          fileName     = string.Empty;

            try
            {
                Console.WriteLine("Test Started");

                WaitForMoment(5);
                homePageAct.ClickOnDashboardLink();
                dashboardAct.SelectTheDashboardReport11(driver, out fileName);
                dashboardAct.ClickOnExportButton();
                dashboardAct.CreateCopyFile(fileName + ".dashboard", @"C:\Users\z003uutr\Downloads");
                dashboardAct.ClickOnImportButton();
                dashboardAct.ClickOnSelectFileAndEnterPath(@"C:\Users\z003uutr\Downloads" + "\\" + "Copy_" + fileName + ".dashboard");
                reportAct.ClickOnSaveReportButton();
                dashboardAct.SelectTheDashboardReport(driver, fileName);
                dashboardAct.ClickOnDeleteButton();
                reportAct.ClickOnYesButton();
                dashboardAct.DeleteFiles(@"C:\Users\z003uutr\Downloads");

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #4
0
 public bool Release(HomeObject objToRelease, Vector3 position)
 {
     animator.SetTrigger("Interact");
     animator.SetFloat("DirX", direction.x);
     animator.SetFloat("DirY", direction.y);
     return(objToRelease.BeingReleased(position));
 }
Example #5
0
        public void TC06_CreateReportForDashboard_UsingChartWidget()
        {
            HomeObject      homeObj             = new HomeObject(driver);
            HomeAction      homePageAct         = new HomeAction(driver);
            DashboardAction dashboardAct        = new DashboardAction(driver);
            ReportingAction reportAct           = new ReportingAction(driver);
            Random          random              = new Random();
            string          dashboardReportName = "Test_DashboardChartName_" + random.Next(0, 400);

            try
            {
                Console.WriteLine("Test Started");

                WaitForMoment(4);
                homePageAct.ClickOnDashboardLink();
                WaitForMoment(4);
                dashboardAct.ClickOnCreate();
                WaitForMoment(4);
                dashboardAct.SelectChart(driver);
                WaitForMoment(4);
                dashboardAct.ClickOnAddTimeFilterButton();
                WaitForMoment(4);
                reportAct.ExpandALL();
                WaitForMoment(4);
                dashboardAct.ClickOnAlaramItem();
                WaitForMoment(4);
                dashboardAct.ClickOnTotalAlaramCountButton();
                WaitForMoment(4);
                dashboardAct.ClickOnSaveTimeFilterButton();
                WaitForMoment(4);
                reportAct.ClickOnSaveReportButton();
                WaitForMoment(4);
                //dashboardAct.HandleException();
                WaitForMoment(4);
                dashboardAct.ClickOnSaveOneReportButton();
                WaitForMoment(4);
                dashboardAct.EnterDashboardReportName(dashboardReportName);
                WaitForMoment(4);
                dashboardAct.ClickOnAddTimeFilterButton();
                WaitForMoment(4);
                dashboardAct.EnterTimefilterName("Timefilter_Name_" + random.Next(400, 800));
                WaitForMoment(4);
                dashboardAct.ClickOnSaveTimeFilterButton();
                WaitForMoment(4);
                reportAct.ClickOnSaveReportButton();
                WaitForMoment(4);
                dashboardAct.SelectTheDashboardReport(driver, dashboardReportName);
                WaitForMoment(4);
                dashboardAct.ClickOnDeleteButton();
                WaitForMoment(4);
                reportAct.ClickOnYesButton();
                WaitForMoment(10);

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #6
0
        public void TC06_ExportDashboardReport()
        {
            HomeObject      homeObj      = new HomeObject(driver);
            HomeAction      homePageAct  = new HomeAction(driver);
            DashboardAction dashboardAct = new DashboardAction(driver);
            string          fileName     = string.Empty;

            try
            {
                Console.WriteLine("Test Started");

                WaitForMoment(5);
                homePageAct.ClickOnDashboardLink();
                dashboardAct.SelectTheDashboardReport11(driver, out fileName);
                dashboardAct.ClickOnExportButton();
                dashboardAct.CheckFile(fileName + ".dashboard", @"C:\Users\z003uutr\Downloads");
                dashboardAct.DeleteFiles(@"C:\Users\z003uutr\Downloads");

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    public void init(HomeObject obj)
    {
        hObject = obj;
        FishItemSpec spec = SpecController.getItemById(obj.trappedId) as FishItemSpec;

        transform.Find("Fish").GetComponent <Animator> ().Play(spec.name);
    }
Example #8
0
    public bool BeingPushed(Dog dog, Vector3 position)
    {
        if (pushable)
        {
            bool actionSuccessful = true;

            Debug.Log("Dans le beingpushed !");
            if (onTopObject != null)
            {
                if (onTopObject == key)
                {
                    Open();
                }
                onTopObject.size = ObjectSize.Ground;
                onTopObject.MoveObject(dog.transform.position);
                GameController.Instance.gridSystem.NodeFromWorlPoint(dog.transform.position).objectOnNode = onTopObject.gameObject;
                onTopObject = null;
            }

            if (movable)
            {
                MoveObject(position);
            }

            return(actionSuccessful);
        }
        else
        {
            return(pushable);
        }
    }
Example #9
0
        internal static async Task InformLastContactAsync(string command)
        {
            command += $" Client ip: {GetClientIp()}";
            await HomeObject.SetValueAsync("LastHeardFromAlexa", DateTime.Now.ToString(CultureInfo.CurrentCulture)).ConfigureAwait(false);

            await HomeObject.SetValueAsync("LastHeardCommand", command).ConfigureAwait(false);
        }
Example #10
0
        public static async Task IncrementCounterAsync(string property)
        {
            int count = await HomeObject.GetValueAsync <int>(property).ConfigureAwait(false);

            count++;
            await HomeObject.SetValueAsync(property, count.ToString()).ConfigureAwait(false);
        }
Example #11
0
        internal static async Task <bool> CheckAccessTokenAsync(string token)
        {
            var accessToken = await HomeObject.GetValueAsync <string>("AccessToken").ConfigureAwait(false);

            var tokens = new List <string>(accessToken.Split(','));

            return(-1 != tokens.IndexOf(token));
        }
Example #12
0
        public static async Task <List <DiscoveryEndpoint> > GetEndpointsAsync()
        {
            using (endpointsLock.Lock())
            {
                if (endpoints.Count != 0)
                {
                    endpoints.Clear();
                }
                // discovery json is now generated in Premise vb script to vastly improve discovery
                // event response time
                var     returnClause = new[] { "discoveryJson", "IsDiscoverable" };
                dynamic whereClause  = new ExpandoObject();
                whereClause.TypeOf = AlexaApplianceClassPath;
                int count = 0;
                // ReSharper disable once AsyncConverter.ConfigureAwaitHighlighting
                var devices = await HomeObject.SelectAsync(returnClause, whereClause).ConfigureAwait(false);

                foreach (var device in devices)
                {
                    if (device.IsDiscoverable == false)
                    {
                        continue;
                    }

                    DiscoveryEndpoint endpoint;
                    try
                    {
                        string json = device.discoveryJson.ToString();
                        if (string.IsNullOrEmpty(json))
                        {
                            continue;
                        }
                        endpoint = JsonConvert.DeserializeObject <DiscoveryEndpoint>(json, new JsonSerializerSettings
                        {
                            NullValueHandling = NullValueHandling.Ignore
                        });
                    }
                    catch
                    {
                        continue;
                    }

                    if (endpoint != null)
                    {
                        endpoints.Add(endpoint);
                        if (++count >= AlexaDeviceLimit)
                        {
                            break;
                        }
                    }
                }

                // Seems like a good idea here.
                HostingEnvironment.QueueBackgroundWorkItem(ct => BackgroundGarbageCollectAsync());

                return(endpoints);
            }
        }
Example #13
0
        public static async Task NotifyErrorAsync(EventLogEntryType errorType, string errorMessage, int id)
        {
            await HomeObject.SetValueAsync("AlexaLastCommunicationsError", errorMessage).ConfigureAwait(false);

            await IncrementCounterAsync("AlexaCommunicationsErrorCount").ConfigureAwait(false);

            WriteToWindowsApplicationEventLog(errorType, errorMessage, id);
            Debug.WriteLine(errorMessage);
        }
    HomeObject creatNewHomeData(string id)
    {
        HomeObject obj = new HomeObject();

        obj.gameUid = id;
        GameController.GetInstance().creatTrappedFish(obj, 0);

        PlayerData.updateHomeObject(obj);
        return(obj);
    }
Example #15
0
 public void Push(HomeObject objToPush, Vector3 position)
 {
     animator.SetTrigger("Push");
     animator.SetFloat("DirX", direction.x);
     animator.SetFloat("DirY", direction.y);
     if (!objToPush.BeingPushed(this, position))
     {
         BeConfused();
     }
 }
Example #16
0
 public void Examine(HomeObject objToExamine)
 {
     animator.SetTrigger("Interact");
     animator.SetFloat("DirX", direction.x);
     animator.SetFloat("DirY", direction.y);
     if (!objToExamine.BeingExamined(this))
     {
         BeConfused();
     }
 }
Example #17
0
 private static void SubScribeToHomeObjectEvents()
 {
     using (homeObjectSubscriptionLock.Lock())
     {
         if (_asyncEventSubscription == null)
         {
             _asyncEventSubscription = HomeObject
                                       .SubscribeAsync("SendAsyncEventsToAlexa", "NoController", EnableAsyncPropertyChanged).GetAwaiter().GetResult();
         }
     }
 }
    void showHomeObjects(string id, Vector3 pos)
    {
        if (currentHomeId != id)
        {
            cleanHomeLayer();
            currentHomeId = id;

            List <GameObject> Glist     = new List <GameObject> ();
            HomeObject        curObject = PlayerData.getHomeObject(id);
            if (curObject == null)
            {
                curObject = creatNewHomeData(id);
            }
            //Trapped
            if (curObject.trappedId == null)
            {
                GameController.GetInstance().creatTrappedFish(curObject, 0);
            }
            GameObject tFish = (GameObject)Instantiate(GameController.GetInstance().getPrefab("TrapedFish"), new Vector3(pos.x + (float)curObject.trappedPosx, pos.y + (float)curObject.trappedPosy, pos.z), Quaternion.identity, HomeFishCanvas.transform);
            tFish.name = "TrappedFish";
            tFish.GetComponent <TrappedFish> ().init(curObject);
            Glist.Add(tFish);
            if (tFish.GetComponent <TrappedFish> ().canBeClick())
            {
                tFish.SetActive(true);
            }
            else
            {
                tFish.SetActive(false);
            }

            //MISSION
            if (id == PlayerData.getGameuid())
            {
                curObject.missionFishes = checkMissionFishes(curObject.missionFishes);
            }

            foreach (MissionFishData data in curObject.missionFishes)
            {
                if (data.showTime <= GameController.GetInstance().getCurrentSystemNum())
                {
                    GameObject mFish = (GameObject)Instantiate(GameController.GetInstance().getPrefab("MissionFish"), pos, Quaternion.identity, HomeFishCanvas.transform);
                    mFish.name = "MissionFish";
                    mFish.GetComponent <MissionFish> ().init(data, pos);
                }
            }

            if (id == PlayerData.getGameuid())
            {
                PlayerData.updateHomeObject(curObject);
            }
        }
    }
Example #19
0
    //world FISH
    public void creatTrappedFish(HomeObject obj, int creatTime)
    {
        string id = BattleFormation.getRanFishId();

        obj.trappedId = "10029";
        Vector2 p   = UnityEngine.Random.insideUnitCircle * 3;
        Vector2 pos = p.normalized * (2.5f + p.magnitude);

        obj.trappedPosx = pos.x * 50;
        obj.trappedPosy = pos.y * 50;
        obj.trappedTime = creatTime;
        PlayerData.updateHomeObject(obj);
    }
Example #20
0
    public void CreatePlayers()
    {
        m_Players = new List <PlayerBase>();
        for (int i = 0; i < m_Nests.Count; ++i)
        {
            m_Players.Add(m_Nests[i].CreatePlayer());
        }

        m_Home = (Instantiate(HomePrefab) as GameObject).gameObject.GetComponent <HomeObject>();

        m_Lighting        = (Instantiate(LightingPrefab) as GameObject).gameObject.GetComponent <PlayerLighting>();
        m_Lighting.target = m_Players[1].transform;
        m_Lighting.start  = m_Players[0].transform;
    }
    public static void updateHomeObject(HomeObject h)
    {
        List <HomeObject> datas = getHomeObjects();

        foreach (HomeObject hObj in datas)
        {
            if (hObj.gameUid == h.gameUid)
            {
                datas.Remove(hObj);
                break;
            }
        }
        datas.Add(h);
        PlayerPrefs.SetString("HomeDatas", JsonMapper.ToJson(datas));
    }
    void finishMission()
    {
        List <OwnedItem> rewards = new List <OwnedItem> ();

        if (missionData.fishLevel == 3)
        {
            OwnedItem item0 = new OwnedItem();
            item0.item_id = "gem";
            item0.count   = 2;
            rewards.Add(item0);
        }

        OwnedItem item = new OwnedItem();

        item.item_id = "coin";
        item.count   = getCatchFishCoin() * 2;
        rewards.Add(item);

        OwnedItem item1 = new OwnedItem();

        item1.item_id = "exp";
        item1.count   = getPetCatchExp();
        rewards.Add(item1);

        OwnedItem item2 = new OwnedItem();

        item2.item_id = "bullet";
        item2.count   = missionData.fishLevel * 500;
        rewards.Add(item2);

        MissionFishData newMissionData = GameController.GetInstance().creatMissionFish(missionData.fishLevel, Mathf.Max(missionData.getEndTime(), GameController.GetInstance().getCurrentSystemNum()));
        HomeObject      curObject      = PlayerData.getHomeObject(PlayerData.getGameuid());

        foreach (MissionFishData mData in  curObject.missionFishes)
        {
            if (mData.item_id == missionData.item_id)
            {
                curObject.missionFishes.Remove(mData);
                break;
            }
        }
        curObject.missionFishes.Add(newMissionData);
        PlayerData.updateHomeObject(curObject);

        DialogController.GetInstance().showRewardsPanel(rewards, LanController.getString("MissionRewards"), delegate {
            GameController.GetInstance().OpenWorldScene();
        });
    }
Example #23
0
        private static async Task SubscribeAllAsync()
        {
            using (subscriptionsLock.Lock())
            {
                if (endpoints.Count == 0)
                {
                    await GetEndpointsAsync().ConfigureAwait(false);
                }
                if (subscriptions.Count != 0)
                {
                    await UnsubscribeAllAsync().ConfigureAwait(false);
                }
                Action <dynamic> callback = AlexaPropertyChanged;
                using (endpointsLock.Lock())
                {
                    foreach (DiscoveryEndpoint discoveryEndpoint in endpoints)
                    {
                        Guid           premiseId = new Guid(discoveryEndpoint.endpointId);
                        IPremiseObject endpoint  = await HomeObject.GetObjectAsync(premiseId.ToString("B")).ConfigureAwait(false);

                        if (!endpoint.IsValidObject())
                        {
                            await NotifyErrorAsync(EventLogEntryType.Warning, $"Cannot find object {discoveryEndpoint.friendlyName} ({premiseId.ToString()})to subscribe on premise server.", 250).ConfigureAwait(false);

                            continue;
                        }

                        // use reflection to instantiate all device type controllers
                        var interfaceType = typeof(IAlexaDeviceType);
                        var all           = AppDomain.CurrentDomain.GetAssemblies()
                                            .SelectMany(x => x.GetTypes())
                                            .Where(x => interfaceType.IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract)
                                            .Select(Activator.CreateInstance);

                        foreach (IAlexaDeviceType deviceType in all)
                        {
                            Dictionary <string, IPremiseSubscription> subs =
                                deviceType.SubscribeToSupportedProperties(endpoint, discoveryEndpoint, callback);
                            foreach (string key in subs.Keys)
                            {
                                subscriptions.Add(key, subs[key]);
                            }
                        }
                    }
                }
            }
        }
Example #24
0
        public void TC05_CreateReportForMessageTemplate()
        {
            HomeObject      homeObj     = new HomeObject(driver);
            HomeAction      homePageAct = new HomeAction(driver);
            ReportingAction reportAct   = new ReportingAction(driver);

            try
            {
                Console.WriteLine("Test Started");

                WaitForMoment(4);
                homePageAct.ClickOnReportsLink();
                WaitForMoment(4);
                reportAct.ExpandALL();
                reportAct.ExpandALL();
                reportAct.ExpandALL();
                reportAct.ExpandALL();
                reportAct.ClickOnDurationUntilAcknowledgementReport();
                WaitForMoment(4);
                reportAct.ClickOnCreateReportButton();
                WaitForMoment(4);
                reportAct.EnterStartDateTime("11/19/2017 4:37:10 PM");
                WaitForMoment(4);
                reportAct.ClickOnShowPreviewButton();
                WaitForMoment(15);
                reportAct.ClickOnCreateReportButtonAfterPreview();
                WaitForMoment(4);
                reportAct.EnterReportName("IS_Report_" + DateTime.Now.Millisecond);
                WaitForMoment(4);
                reportAct.ClickOnSaveReportButton();
                WaitForMoment(10);

                // Deletes the Created Report
                reportAct.SelectFirstReport();
                WaitForMoment(4);
                reportAct.ClickOnRemoveButton();
                WaitForMoment(4);
                reportAct.ClickOnYesButton();
                WaitForMoment(4);

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #25
0
        public void TC02_VerifyingNavigationToDownloadPage()
        {
            HomeObject homeObj     = new HomeObject(driver);
            HomeAction homePageAct = new HomeAction(driver);

            try
            {
                Console.WriteLine("Test Started");

                homePageAct.VerifyingPageTitle("SIMATIC Information Server");
                homePageAct.VerifyHomePageLinks();
                homePageAct.ClickOnDownloadLink();
                WaitForMoment(4);
                homePageAct.VerifyingDownloadLink();

                Console.WriteLine("Test Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #26
0
 public bool BeingExamined(Dog dog)
 {
     if (examinable)
     {
         Debug.Log("Coucou");
         bool actionSuccessful = true;
         if (containedObject != null)
         {
             Debug.Log("containedObject = " + containedObject.name);
             containedObject.gameObject.SetActive(false);
             containedObject.GetComponent <HomeObject>().grabed = true;
             containedObject.size        = ObjectSize.Ground;
             containedObject.currentNode = GameController.Instance.gridSystem.NodeFromWorlPoint(containedObject.transform.position);
             containedObject             = null;
         }
         GameController.Instance.phase = Phase.SELECTACTION;
         GameController.Instance.ath.CleanOrder();
         return(actionSuccessful);
     }
     else
     {
         return(examinable);
     }
 }
Example #27
0
    public IEnumerator CleanNannyColliders(HomeObject ho)
    {
        yield return(new WaitForSeconds(1));

        ho.CleanColliders();
    }
Example #28
0
 public HomeAction(IWebDriver driver)
 {
     this.homeObject = new HomeObject(driver);
 }
Example #29
0
 public void Init(HomeObject model)
 {
     m_HomeObjectModel = model;
     m_HomeObjectModel.mActionChange += HandleCustomEvent;
 }
Example #30
0
        private static bool CheckStatus()
        {
            try
            {
                if (BackgroundTaskManager.Shutdown.IsCancellationRequested)
                {
                    return(false);
                }
                if (IsClientConnected())
                {
                    return(true);
                }

                if (_homeObject == null)
                {
                    using (HomeObjectLock.Lock())
                    {
                        try
                        {
                            _homeObject = _sysClient.ConnectAsync(PremiseServerAddress)?.GetAwaiter().GetResult();
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.Message);
                            _homeObject = null;
                        }
                    }

                    if (_homeObject == null)
                    {
                        Debug.WriteLine("Cannot connect to Premise server!");
                        return(false);
                    }
                }
                else
                {
                    _sysClient.Disconnect();

                    using (homeObjectSubscriptionLock.Lock())
                    {
                        _asyncEventSubscription = null;
                    }
                    using (subscriptionsLock.Lock())
                    {
                        subscriptions.Clear();
                        _sysClient.Subscriptions.Clear();
                    }
                    using (endpointsLock.Lock())
                    {
                        endpoints.Clear();
                    }
                    using (HomeObjectLock.Lock())
                    {
                        _homeObject = null;
                        try
                        {
                            _homeObject = _sysClient.ConnectAsync(PremiseServerAddress).GetAwaiter().GetResult();
                        }
                        catch
                        {
                            _homeObject = null;
                            return(false);
                        }
                    }
                }
                using (homeObjectSubscriptionLock.Lock())
                {
                    enableAsyncEvents = HomeObject.GetValueAsync <bool>("SendAsyncEventsToAlexa").GetAwaiter().GetResult();
                }
                if (IsAsyncEventsEnabled)
                {
                    Task.Run(SubscribeAllAsync);
                }
                SubScribeToHomeObjectEvents();
                return(true);
            }
            catch (Exception ex)
            {
                _homeObject = null;
                subscriptions.Clear();
                endpoints.Clear();
                Debug.WriteLine(ex.Message);
                return(false);
            }
        }