Exemplo n.º 1
0
        public void SearchTheWordClick()
        {
            #region Variables

            Logger1 newLog1 = new Logger1();
            newLog1.CreateStory(driver, MethodBase.GetCurrentMethod().Name, GetTestDescription(MethodBase.GetCurrentMethod().CustomAttributes));
            string wordToSearch         = "Click";
            string textResultfromDialog = string.Empty;
            string textResulFromPage    = string.Empty;
            int    timeout = 1;

            #endregion

            #region Navigate to Home Page and Click "API" Button from NavBar

            HomePage homePage = new HomePage(driver);
            homePage.Navigate();
            var         аpiPage   = homePage.GoToAPIPage();
            DialogPages newSearch = аpiPage.OpenSearch(wordToSearch);

            #endregion

            #region Fill the word "Click" in Search Dialog

            newSearch.SearchTextField = "Click";
            Thread.Sleep(TimeSpan.FromSeconds(1));
            newLog1.Step("Fill the word 'Click' in Search Dialog", driver);

            //This while is used for timeout
            while (newSearch.SearchTextField != "Click" || timeout > 10)
            {
                Thread.Sleep(TimeSpan.FromSeconds(2));
                timeout++;
            }

            textResultfromDialog = newSearch.GetSearchResultInfo;
            string numberFromDialog = Regex.Match(textResultfromDialog, @"\d+").Value;

            #endregion

            #region Navigate to Search Page and Fill The Word "Click"

            SearchPage searchPage = new SearchPage(driver);
            searchPage.Navigate();
            searchPage.FillTextForSearch(wordToSearch);
            newLog1.Step("Navigate to Search Page and Fill The Word 'Click'", driver);
            textResulFromPage = searchPage.ResultsInfo();
            string numberFromPage = Regex.Match(textResulFromPage, @"\d+").Value;

            #endregion

            #region Verify The number of results are equal on Dialog Window and Search Page

            Assert.AreEqual(numberFromPage, numberFromDialog);
            newLog1.SaveStory();

            #endregion
        }
Exemplo n.º 2
0
        public void VerifyProtocolsList()
        {
            #region Variables

            Logger1 newLog1 = new Logger1();
            newLog1.CreateStory(driver, MethodBase.GetCurrentMethod().Name, GetTestDescription(MethodBase.GetCurrentMethod().CustomAttributes));
            List <string> listOfProtocols = new List <string>
            {
                "WebDriver Protocol",
                "Appium",
                "Mobile JSON Wire Protocol",
                "Chromium",
                "Sauce Labs",
                "Selenium Standalone",
                "JSON Wire Protocol"
            };

            #endregion

            #region Navigate to Home Page and Click "Protocol" section in the left navigation bar

            HomePage homePage = new HomePage(driver);
            homePage.Navigate();
            APIPage аpiPage = homePage.GoToAPIPage();
            аpiPage.ExpandProtocols();

            #endregion

            #region Get Number of Protocols and Their Names from the menu

            Thread.Sleep(TimeSpan.FromSeconds(10));
            var protocols    = аpiPage.Protocols;
            var protocolList = new List <string>();
            for (int i = 0; i < protocols.Count; i++)
            {
                protocolList.Add(protocols[i].Text);
            }

            #endregion

            #region Verify Protocol Names in Exact Order

            newLog1.Step("Protocols", driver);
            Assert.IsTrue(listOfProtocols.SequenceEqual(protocolList));
            newLog1.SaveStory();

            #endregion
        }