public void BVT_Graph_S03_TC10_CanLoadGettingStartedPlatformImages()
 {
     //Platform platform = Platform.PHP;
     //GraphPages.Office365Page.CardSetupPlatform.ChoosePlatform(platform);
     GraphBrowser.Goto(GraphUtility.RemoveRedundantPartsfromExtractBaseAddress() + "/quick-start#setup");
     Assert.IsTrue(GraphPages.Office365Page.CanLoadImages());
 }
Example #2
0
    public static Graph Defleshed(this Graph graph,
                                  Graph xray,
                                  GraphUtility.Metric metric)
    {
        Dictionary <Node, Node> xray_analogs = new Dictionary <Node, Node>();

        foreach (Node node in xray.Nodes)
        {
            xray_analogs[node] = graph.GetNearestNode(node.GetPosition());
        }

        HashSet <Edge> skeleton = new HashSet <Edge>();

        foreach (Edge bone in xray.Edges)
        {
            Path path = xray_analogs[bone.A].GetPathTo(xray_analogs[bone.B], metric);

            for (int i = 0; i < path.Count - 1; i++)
            {
                skeleton.Add(new Edge(path[i], path[i + 1]));
            }
        }

        return(GraphUtility.CreateGraph(skeleton));
    }
Example #3
0
        private void OnPlayBtnClick()
        {
            playBtn.gameObject.SetActive(false);
            progressBar.gameObject.SetActive(true);

            GraphUtility.AsyncLoadGifAsFrames(gifFile, OnGifLoading, OnGifLoaded);
        }
Example #4
0
    void Update()
    {
        if (OperationTile.Selected != null)
        {
            if (OperationTile.Selected != cursor_operation_tile)
            {
                if (OperationTile.Selected.Operation.Style.Cursor != null)
                {
                    OperationTile.Selected.Operation.Style.Cursor.Use();
                }

                cursor_operation_tile = OperationTile.Selected;
            }
        }
        else if (Cursor.Current != Cursor.Default)
        {
            Cursor.Default.Use();
            cursor_operation_tile = null;
        }

        if (this.IsModulusUpdate(60))
        {
            GraphUtility.ClearMetricTable();
        }
    }
Example #5
0
 public void Acceptance_Graph_S02_TC03_ClickTryAPIOnExplorerCanShowPage()
 {
     GraphUtility.SelectToTryAPI();
     Assert.IsTrue(
         GraphBrowser.SwitchToWindow("Graph Explorer"),
         @"The opened page should be ""Graph explorer"" when clicking Try the API");
 }
Example #6
0
 public void TestInitialize()
 {
     GraphBrowser.Goto(GraphBrowser.BaseAddress);
     GraphBrowser.SetWindowSize(0, 0, true);
     GraphBrowser.Goto(GraphUtility.RemoveRedundantPartsfromExtractBaseAddress() + "/code-samples-and-sdks");
     this._codeSamplesPage = new GraphCodeSamplesPage();
 }
        public void Comps_Graph_S04_TC01_CanToggleArrowWorkInSmallDocumentaionPage()
        {
            int currentWidth  = 0;
            int currentHeight = 0;

            GraphBrowser.GetWindowSize(out currentWidth, out currentHeight);
            GraphPages.Navigation.Select("Documentation");

            Size windowSize;
            //Set as the screen size of IPad2
            double deviceScreenSize = double.Parse(GraphUtility.GetConfigurationValue("IPad2Size"));

            GraphBrowser.TransferPhysicalSizeToPixelSize(
                deviceScreenSize,
                new Size
            {
                Width  = int.Parse(GraphUtility.GetConfigurationValue("IPad2ScreenResolutionWidth")),
                Height = int.Parse(GraphUtility.GetConfigurationValue("IPad2ScreenResolutionHeight"))
            },
                out windowSize);
            GraphBrowser.SetWindowSize(windowSize.Width, windowSize.Height);

            Assert.IsTrue(
                GraphUtility.IsToggleArrowDisplayed(),
                "An IPad2 window size ({0} inches) can make table of content arrow appear.",
                deviceScreenSize);
            Assert.IsFalse(GraphUtility.IsMenuContentDisplayed(),
                           "When the arrows exists, table of content should be hidden.");

            GraphUtility.ToggleMenu();
            Assert.IsTrue(GraphUtility.IsMenuContentDisplayed(),
                          "When the arrows exists and table of content is hidden,clicking the arrow should show table of content.");

            GraphUtility.ToggleMenu();
            Assert.IsFalse(GraphUtility.IsMenuContentDisplayed(),
                           "When the arrows exists and table of content is shown,clicking the arrow should hide table of content.");

            //Set as the screen size of IPhone6 plus
            deviceScreenSize = double.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusSize"));
            //Since mobile phone width<Height, invert the output values
            GraphBrowser.TransferPhysicalSizeToPixelSize(
                deviceScreenSize,
                new Size
            {
                Width  = int.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusScreenResolutionWidth")),
                Height = int.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusScreenResolutionHeight"))
            },
                out windowSize);
            //Since mobile phone widh<height, invert height and width
            GraphBrowser.SetWindowSize(windowSize.Height, windowSize.Width);

            Assert.IsTrue(
                GraphUtility.IsToggleArrowDisplayed(),
                "An IPhone6 Plus window size ({0} inches) can make table of content arrow appear.",
                deviceScreenSize);

            //Recover the window size
            GraphBrowser.SetWindowSize(currentWidth, currentHeight);
        }
Example #8
0
 void DrawInspectFrame(Rect graphPanelRect)
 {
     if (m_InspectFrame != m_LatestFrame)
     {
         var ix = graphPanelRect.xMin + GraphUtility.ValueToPixel(m_InspectFrame, m_GraphList.visibleStartTime, m_GraphList.visibleStartTime + m_GraphList.visibleDuration, graphPanelRect.width);
         EditorGUI.DrawRect(new Rect(ix - 1, graphPanelRect.yMin, 3, graphPanelRect.height), Color.white * .8f);
     }
 }
        public void DownloadCode()
        {
            var downloadBtn = GraphBrowser.Driver.FindElement(By.Id("downloadCodeSampleButtonRest"));

            GraphBrowser.Click(downloadBtn);

            // Give 3 seconds for download to finish before checking for postdownload instructions
            GraphBrowser.Wait(TimeSpan.FromSeconds(int.Parse(GraphUtility.GetConfigurationValue("WaitTime"))));
        }
Example #10
0
 public void Acceptance_Graph_S03_TC01_CanGoToOffice365GettingStartedPage()
 {
     GraphPages.Navigation.Select("Get started");
     GraphUtility.SelectO365GettingStarted();
     Assert.IsTrue(
         GraphBrowser.SwitchToWindow("Office Dev Center - Getting started with Office 365 REST APIs"),
         @"Clicking ""Office 365 Getting Started"" on Get started page can navigate to devofficecom, getting started page");
     GraphBrowser.SwitchBack();
 }
 public void BVT_Graph_S07_TC01_CanGoToDevOfficeCom()
 {
     GraphPages.Navigation.Select("App registration");
     GraphUtility.SelectO365AppRegisstration();
     Assert.IsTrue(
         GraphUtility.IsAtApplicationRegistrationPortal(false),
         @"Clicking ""Office 365 App Registration Tool"" on App registration page can navigate to devofficecom, App Registration Tool page");
     GraphBrowser.SwitchBack();
 }
 public void BVT_Graph_S07_TC02_CanGoToNewAppRegistrationPortal()
 {
     GraphPages.Navigation.Select("App registration");
     GraphUtility.SelectNewAppRegisstrationPortal();
     GraphBrowser.SwitchToNewWindow();
     Assert.IsTrue(
         GraphUtility.IsAtApplicationRegistrationPortal(true),
         @"Clicking ""New App Registration Portal (preview)"" on App registration page can navigate to apps.dev.microsoft.com page");
     GraphBrowser.SwitchBack();
 }
Example #13
0
        public void LastSampleBeforeLastEndFrame_LastSegmentSpansToEndOfFrame()
        {
            EventDataSetStream stream = new EventDataSetStream();

            stream.AddSample(50, 99);
            GraphUtility.Segment[] segs = GraphUtility.IterateSegments(stream, 0, 100, IsContinuationOfSegment).ToArray();
            Assert.AreEqual(1, segs.Length);
            Assert.AreEqual(50, segs[0].frameStart);
            Assert.AreEqual(100, segs[0].frameEnd);
            Assert.AreEqual(99, segs[0].data);
        }
Example #14
0
        public void FirstSampleBeforeStartFrame_IsFirstSegmentAndCropped()
        {
            EventDataSetStream stream = new EventDataSetStream();

            stream.AddSample(0, 99);
            GraphUtility.Segment[] segs = GraphUtility.IterateSegments(stream, 25, 100, IsContinuationOfSegment).ToArray();
            Assert.AreEqual(1, segs.Length);
            Assert.AreEqual(25, segs[0].frameStart);
            Assert.AreEqual(100, segs[0].frameEnd);
            Assert.AreEqual(99, segs[0].data);
        }
Example #15
0
        public void Acceptance_Graph_S02_TC02_ClickSeeOverviewCanShowDocumentaionPage()
        {
            GraphUtility.SelectToSeeOverView();
            bool   isOverview = GraphUtility.ValidateDocument(GraphBrowser.BaseAddress + "/overview/overview");
            string docTitle   = GraphUtility.GetDocTitle();

            Assert.IsTrue(
                isOverview,
                "The documentation should be {0} when clicking See overview on Home page",
                docTitle);
        }
        public void Acceptance_Graph_S03_TC09_CanDownloadCode_Node()
        {
            Platform platform = Platform.Node;

            //Simulate app registration via hardcoded querystring
            GraphBrowser.Goto(GraphUtility.RemoveRedundantPartsfromExtractBaseAddress() + "/quick-start?appID=c4664f74-aec4-4462-93e9-fb84a25d1f28&appName=My%20Node.js%20App&redirectUrl=http://localhost:3000/login&platform=option-node");
            Assert.IsTrue(GraphPages.Office365Page.CardSetupPlatform.IsShowingPlatformSetup(platform), "Failed to choose platform {0}, which should be picked from querystring and selected on page load", platform.ToString());

            GraphPages.Office365Page.CardDownloadCode.DownloadCode();
            Assert.IsTrue(GraphPages.Office365Page.CardDownloadCode.IsCodeDownloaded(), "Failed to download code and display post-download instructions.");
        }
Example #17
0
        public void SegmentBeforeStartFrame_IsIgnored()
        {
            EventDataSetStream stream = new EventDataSetStream();

            stream.AddSample(0, 99);
            stream.AddSample(50, 0);
            GraphUtility.Segment[] segs = GraphUtility.IterateSegments(stream, 100, 200, IsContinuationOfSegment).ToArray();
            Assert.AreEqual(1, segs.Length);
            Assert.AreEqual(0, segs[0].data);
            Assert.AreEqual(100, segs[0].frameStart);
            Assert.AreEqual(200, segs[0].frameEnd);
        }
    private void Start()
    {
        if (!GraphUtility.IsDebugGraphAvailable)
        {
            Debug.Log("No debug graph available");
            return;
        }

        DirectedGraph graph = (DirectedGraph)GraphUtility.LoadDebugGraph();

        constructor.CreateGraph(graph);
    }
    public static void SaveCurrentGraph()
    {
        if (GraphConstructor.CurrentGraph == null)
        {
            throw new System.NullReferenceException("No CurrentGraph available!");
        }

        string json         = Serializer.Serialize(GraphConstructor.CurrentGraph);
        string fullFilename = GraphUtility.GetDebugGraphFileName();

        File.WriteAllText(fullFilename, json);
    }
 public void Acceptance_Graph_S05_TC01_CanLogin()
 {
     GraphPages.Navigation.Select("Graph explorer");
     if (GraphUtility.IsLoggedIn())
     {
         GraphUtility.ClickLogout();
     }
     GraphUtility.ClickLogin();
     GraphUtility.Login(
         GraphUtility.GetConfigurationValue("GraphExplorerUserName"),
         GraphUtility.GetConfigurationValue("GraphExplorerPassword"));
     Assert.IsTrue(GraphUtility.IsLoggedIn(GraphUtility.GetConfigurationValue("GraphExplorerUserName")), "");
 }
Example #21
0
    public Path PlanRoadtrip(Vector3 source, Vector3 destination)
    {
        Node source_node      = GraphUtility.CreatePositionNode(source).AsGuestTo(Highways);
        Node destination_node = GraphUtility.CreatePositionNode(destination);
        Path roadtrip         = source_node.GetPathTo_Obstacle(destination_node);

        if (roadtrip == null)
        {
            return(null);
        }

        return(roadtrip);
    }
    public static IGraph LoadDebugGraph()
    {
        string fullFilename = GraphUtility.GetDebugGraphFileName();

        if (!File.Exists(fullFilename))
        {
            Debug.LogWarning("No file exists at " + fullFilename);
            return(null);
        }

        string        jsonString = File.ReadAllText(fullFilename);
        DirectedGraph graph      = Serializer.Deserialize <DirectedGraph>(jsonString);

        return(graph);
    }
        public void ChoosePlatform(Platform platformName)
        {
            if (!GraphBrowser.Url.Contains("/quick-start"))
            {
                GraphBrowser.Goto(GraphUtility.RemoveRedundantPartsfromExtractBaseAddress() + "/quick-start#setup");
            }

            //To account for iOS_Swift and iOS_Objective_C enums, since enum cannot contain - character but the div IDs contain -
            var platform = GraphBrowser.Driver.FindElement(By.Id("option-" + platformName.ToString().ToLower().Replace("_", "-")));

            GraphBrowser.Click(platform);

            // Need refactor: Sometimes case failed for the platform setup text is not changed in time
            GraphBrowser.Wait(TimeSpan.FromSeconds(2));
        }
Example #24
0
        public void MultipleSamples_SegmentPerSample()
        {
            EventDataSetStream stream          = new EventDataSetStream();
            const int          kSampleCount    = 20;
            const int          kFrameIncrement = 100;

            AddAlternativeSegments(stream, -99, 99, 0, kFrameIncrement, kSampleCount);
            GraphUtility.Segment[] segs = GraphUtility.IterateSegments(stream, 0, kSampleCount * kFrameIncrement, IsContinuationOfSegment).ToArray();
            Assert.AreEqual(kSampleCount, segs.Length);
            for (int i = 0; i < segs.Length; i++)
            {
                Assert.AreEqual(segs[i].data, (i % 2 == 0) ? -99 : 99);
                Assert.AreEqual(segs[i].frameStart, i * kFrameIncrement);
                Assert.AreEqual(segs[i].frameEnd, (i + 1) * kFrameIncrement);
            }
        }
        public void CanTraverseTocAndAccessDocs()
        {
            GraphBrowser.SetWindowSize(0, 0, true);
            GraphPages.Navigation.Select("Documentation");
            //If the table of content is replaced by the toggle arrow, click the arrow to display table of content
            //if (GraphUtility.IsToggleArrowDisplayed())
            //{
            //    GraphUtility.ToggleMenu();
            //}

            //int layerCount = Utility.GetTOCLayer();
            //var failedDocList = Utility.CheckAllDocuments(layerCount);
            var failedDocList = GraphUtility.TraverseTocAndGetFailedDocs();

            Assert.IsTrue(failedDocList.Count == 0, "Failed documents: " + String.Join("; ", failedDocList));
        }
Example #26
0
        public bool CanLoadImages()
        {
            var elements = GraphBrowser.Driver.FindElements(By.CssSelector("#pickPlatform > div > button"));

            foreach (IWebElement item in elements)
            {
                IWebElement subItem  = item.FindElement(By.CssSelector("img"));
                string      Url      = subItem.GetAttribute("src");
                string      whiteUrl = Url.Replace("grey_", ""); //Check both the grey and white versions of the images
                if (!GraphUtility.FileExist(Url) || !GraphUtility.FileExist(whiteUrl))
                {
                    return(false);
                }
            }
            return(true);
        }
        ///// <summary>
        ///// Verify whether clicking different subject on Documentation page's
        ///// table of content will show the correct doc content.
        ///// </summary>
        //[TestMethod]
        //public void Comps_Graph_S04_TC03_CanDisplayCorrectContentOnDocumentaionPage()
        //{
        //    GraphBrowser.SetWindowSize(0, 0, true);
        //    GraphPages.Navigation.Select("Documentation");
        //    //If the table of content is replaced by the toggle arrow, click the arrow to display table of content
        //    if (GraphUtility.IsToggleArrowDisplayed())
        //    {
        //        GraphUtility.ToggleMenu();
        //    }

        //    string[] testPaths = { "OVERVIEW>Call the API", "GET STARTED>iOS", "USERS>USER>List users", "WEBHOOKS>SUBSCRIPTION>Get subscription" };
        //    string[] tocPath = { };

        //    for (int i = 0; i < testPaths.Length; i++)
        //    {
        //        tocPath = testPaths[i].Split(new char[] { '>' });

        //        for (int j = 0; j < tocPath.Length; j++)
        //        {
        //            //Avoid to fold the sublayer
        //            if (!GraphUtility.SubLayerDisplayed(tocPath[j]))
        //            {
        //                GraphUtility.Click(tocPath[j]);
        //            }
        //        }
        //        GraphBrowser.Wait(TimeSpan.FromSeconds(int.Parse(GraphUtility.GetConfigurationValue("WaitTime"))));
        //        string docTitle = GraphUtility.GetDocTitle();
        //        bool isCorrectDoc = docTitle != "Document not found.";

        //        Assert.IsTrue(
        //           isCorrectDoc,
        //           @"The shown content is {0} when {1} is chosen in the table of content on Documentation page",
        //           docTitle, tocPath);
        //    }

        //}

        // disabled temporary as Keyur is running an optimizely experiment on "PREVIEW APIS" or "/BETA REFERENCE"
        ///// <summary>
        ///// Verify whether a sub menu can appear by clicking its parent layer.
        ///// </summary>
        //[TestMethod]
        //public void Acceptance_Graph_S04_TC04_CanShowTOCSubLayer()
        //{
        //    GraphPages.Navigation.Select("Documentation");
        //    if (!GraphUtility.IsMenuContentDisplayed())
        //    {
        //        GraphUtility.ToggleMenu();
        //    }

        //    int tocLayerCount = GraphUtility.GetTOCLayer();
        //    //Random generate a layer index, check a menu item at this layer from its top layers
        //    //Because the last layer menu item doesn't have sub menu, use tocLayerCount-1 as the max value
        //    int index = new Random().Next(tocLayerCount - 1);

        //    List<string> tocPath = GraphUtility.FindTOCParentItems(index);
        //    string itemPath = string.Empty;
        //    for (int j = 0; j < tocPath.Count; j++)
        //    {
        //        GraphUtility.Click(tocPath[j]);
        //        itemPath += (j == 0 ? string.Empty : "->");
        //        itemPath += tocPath[j];
        //        Assert.IsTrue(GraphUtility.SubLayerDisplayed(tocPath[j]), "Clicking {0} can display its sub layer");
        //    }
        //}

        /// <summary>
        /// Verify whether the arrow hide table of content,
        /// and whether clicking it can hide/show table of content alternatively
        /// </summary>
        private void VerifyArrowAvailability()
        {
            Assert.IsFalse(
                GraphUtility.IsMenuContentDisplayed(),
                "Without clicking the toogle arrow, the menu content should not appear.");
            //Click the arrow to show the menu content
            GraphUtility.ToggleMenu();
            Assert.IsTrue(
                GraphUtility.IsMenuContentDisplayed(),
                "After clicking the toogle arrow, the menu content should appear.");

            //Click the arrow again to hide the menu content
            GraphUtility.ToggleMenu();
            Assert.IsFalse(
                GraphUtility.IsMenuContentDisplayed(),
                "After clicking the toogle arrow for the second time, the menu content should disappear.");
        }
        public void Comps_Graph_S05_TC04_CanPatchMe()
        {
            GraphPages.Navigation.Select("Graph explorer");
            string userName = GraphUtility.GetConfigurationValue("GraphExplorerUserName");

            if (!GraphUtility.IsLoggedIn())
            {
                GraphUtility.ClickLogin();

                GraphUtility.Login(
                    userName,
                    GraphUtility.GetConfigurationValue("GraphExplorerPassword"));
            }
            //Change the operation from GET to PATCH
            GraphUtility.ClickButton("GET");
            GraphUtility.Click("PATCH");
            string jobTitle = "JobTitle_" + DateTime.Now.ToString("M/d/yyyy/hh/mm/ss");
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("jobTitle", jobTitle);
            GraphUtility.InputExplorerJSONBody(dic);
            GraphUtility.InputExplorerQueryString("https://graph.microsoft.com/v1.0/me" + "\n");
            GraphBrowser.WaitForExploreResponse();
            string patchResponse = GraphUtility.GetExplorerResponse();

            //Change the operation from PATCH to GET
            GraphUtility.ClickButton("PATCH");
            GraphUtility.Click("GET");
            GraphUtility.InputExplorerQueryString("https://graph.microsoft.com/v1.0/me" + "\n");
            string getResponse = GraphUtility.GetExplorerResponse();
            //The response doesn't change means no GET response is returned.So wait and re-obtain it
            int waitTime   = Int32.Parse(GraphUtility.GetConfigurationValue("WaitTime"));
            int retryCount = Int32.Parse(GraphUtility.GetConfigurationValue("RetryCount"));
            int i          = 0;

            while (i < retryCount && getResponse == patchResponse)
            {
                GraphBrowser.Wait(TimeSpan.FromSeconds(waitTime));
                getResponse = GraphUtility.GetExplorerResponse();
                i++;
            }
            string newjobTitle = GraphUtility.GetProperty(getResponse, "jobTitle");

            Assert.AreEqual(jobTitle, newjobTitle, "The patched property should be updated accordingly");
        }
Example #29
0
    public static Node GetNearestNode(this Path path,
                                      Vector3 position,
                                      GraphUtility.Metric metric         = null,
                                      System.Func <Node, bool> predicate = null)
    {
        if (metric == null)
        {
            metric = GraphUtility.EuclideanMetric;
        }

        if (predicate == null)
        {
            predicate = node => true;
        }

        return(path
               .Where(predicate)
               .MinElement(node => metric(node, GraphUtility.CreatePositionNode(position))));
    }
        public void Comps_Graph_S07_TC01_CheckInThisArticle()
        {
            GraphPages.Navigation.Select("Documentation");
            GraphBrowser.ZoomToPercent(50);
            GraphBrowser.Wait(TimeSpan.FromSeconds(3)); //In this article renders after the doc renders, so must wait
            Assert.IsTrue(GraphUtility.IsInThisArticleDisplayed(),
                          "On a large screen, in this article should be displayed");
            GraphBrowser.ZoomToPercent(100);

            Size windowSize;
            //Set as the screen size of IPad2
            double deviceScreenSize = double.Parse(GraphUtility.GetConfigurationValue("IPad2Size"));

            GraphBrowser.TransferPhysicalSizeToPixelSize(
                deviceScreenSize,
                new Size
            {
                Width  = int.Parse(GraphUtility.GetConfigurationValue("IPad2ScreenResolutionWidth")),
                Height = int.Parse(GraphUtility.GetConfigurationValue("IPad2ScreenResolutionHeight"))
            },
                out windowSize);
            GraphBrowser.SetWindowSize(windowSize.Width, windowSize.Height);

            Assert.IsFalse(GraphUtility.IsInThisArticleDisplayed(),
                           "On an iPad, in this article should not be displayed");

            //Set as the screen size of IPhone6 plus
            deviceScreenSize = double.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusSize"));
            //Since mobile phone width<Height, invert the output values
            GraphBrowser.TransferPhysicalSizeToPixelSize(
                deviceScreenSize,
                new Size
            {
                Width  = int.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusScreenResolutionWidth")),
                Height = int.Parse(GraphUtility.GetConfigurationValue("IPhone6PlusScreenResolutionHeight"))
            },
                out windowSize);
            //Since mobile phone widh<height, invert height and width
            GraphBrowser.SetWindowSize(windowSize.Height, windowSize.Width);

            Assert.IsFalse(GraphUtility.IsInThisArticleDisplayed(),
                           "On an iPhone, in this article should not be displayed");
        }