Пример #1
0
        public void GoogleTest3()
        {
            //Arrange
            var    ResultsPage = new GoogleHomePage(driver);
            string word        = "анальгін";
            string word1       = "bayer";
            bool   isCorrect1  = true;
            bool   isCorrect2;
            int    count = 2;
            var    Res   = new GoogleSearchPages(driver);

            //Act
            ResultsPage.SetWord(word).SubmitSearchWord();
            do
            {
                isCorrect2 = Res.FindWord(word1);
                if (!isCorrect2)
                {
                    string screenshot = @"C:\Users\dbodi\source\Lab6\Screenshot_3/screen_" + (count - 1) + ".png";
                    Res.GetEntereScreenshot().Save(screenshot, ImageFormat.Png);
                    isCorrect1 = Res.ListPages(count);
                }
                count++;
            } while (isCorrect1 && !isCorrect2);

            //Assert
            Assert.IsTrue(!isCorrect2);
        }
Пример #2
0
        public static void SubmitGoogleSearchTerms(IWebDriver driver)
        {
            IWebElement         element    = GoogleHomePage.GoogleSearchElements(driver, "GoogleSearchButton");
            IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)driver;

            jsExecutor.ExecuteScript("arguments[0].click();", element);
        }
Пример #3
0
        public void TestPageObjectHasDriver()
        {
            OpenPage <GoogleHomePage>("http://www.google.com");
            var page = new GoogleHomePage();

            Assert.IsNotNull(page.driver);
        }
Пример #4
0
        public void GoogleTest1()
        {
            //Arrange
            var    ResultsPage = new GoogleHomePage(driver);
            string word        = "Кнопка";
            string word1       = "канцтовары";
            bool   isCorrect1;
            bool   isCorrect2 = true;
            int    count      = 2;
            var    Res        = new GoogleSearchPages(driver);

            //Act
            ResultsPage.SetWord(word).SubmitSearchWord();
            do
            {
                isCorrect1 = Res.ListPages(count);
                if (isCorrect1)
                {
                    isCorrect2 = Res.FindWord(word1);
                }
                if (isCorrect2)
                {
                    Console.WriteLine("Number of Page - " + count);
                    string screenshot = @"C:\Users\dbodi\source\Lab6\Screenshot_1\screen.png";
                    Res.GetEntereScreenshot().Save(screenshot, ImageFormat.Png);
                }

                count++;
            } while (isCorrect1 && !isCorrect2);

            //Assert
            Assert.IsTrue(isCorrect2);
        }
Пример #5
0
        public void test(string search)
        {
            GoogleHomePage gHome = new GoogleHomePage(driver);

            gHome.MaximizeWindow();
            gHome.getSearchTextBox().SendKeys(search);
        }
Пример #6
0
        public void SearchForParameterAndVerifyIsDisplayFirst()
        {
            //Google Home Page

            GoogleHomePage site = new GoogleHomePage(driver);

            site.goToPage(test_URL);

            site.Search(parameter);

            System.Threading.Thread.Sleep(6000);

            //Google Result Page

            ResultPage resultPage = new ResultPage(driver);

            string actualResult = resultPage.FirstSite.GetAttribute("href");

            //Assert

            Assert.AreEqual(expectedResult, actualResult);

            if (actualResult == expectedResult)
            {
                Console.WriteLine("For parameter " + parameter + " in Google Result Page is displaying this site first: " + actualResult);

                resultPage.clickOnFirstSite();

                System.Threading.Thread.Sleep(6000);
            }
            else
            {
                Assert.Fail();
            }
        }
Пример #7
0
        private void ExampleTestBehaviour()
        {
            Driver.Navigate().GoToUrl(BaseUrl);
            var homePage = new GoogleHomePage(Driver);

            Assert.IsTrue(homePage.Doodle.Displayed);
        }
Пример #8
0
        public void WhenISearchGoogleFor(string query)
        {
            GoogleHomePage          googleHome  = Get <GoogleHomePage>();
            GoogleSearchResultsPage resultsPage = googleHome.Search(query);

            Set <GoogleSearchResultsPage>(resultsPage);
        }
Пример #9
0
        public AbstractSteps(IWebDriver driver)
        {
            this.driver = driver;


            abstractPage     = new AbstractPage(driver);
            googleSearchPage = new GoogleHomePage(driver);
            restSharpPage    = new RestSharpPage(driver);
        }
Пример #10
0
        public AbstractSteps(IWebDriver driver, ExtentTest extentTestReport)
        {
            this.driver           = driver;
            this.extentTestReport = extentTestReport;

            abstractPage     = new AbstractPage(driver);
            googleSearchPage = new GoogleHomePage(driver);
            restSharpPage    = new RestSharpPage(driver);
        }
Пример #11
0
        public void SearchForAppleKeywordTest()
        {
            const string searchKeyword = "apple";

            GoogleHomePage            googleMainPage            = StartNavigation();
            SearchResultsPage         searchResultsPage         = googleMainPage.SearchFor(searchKeyword);
            SearchResultTargetWebPage searchResultTargetWebPage = searchResultsPage.ClickFirstSearchResult();

            Assert.True(searchResultTargetWebPage.IsPageLoaded());
        }
Пример #12
0
        public void Setup()
        {
            Initiate();
            Driver.Navigate().GoToUrl("https://Google.bg");

            var googleHomePage     = new GoogleHomePage(Driver);
            var resultsAfterSearch = googleHomePage.PerformSearch("Selenium");

            _seleniumHomePage = resultsAfterSearch.ClickOnFirstResult();
        }
Пример #13
0
        public void CssDemoandGoogle()
        {
            DemoGuru99Page demoGuru99 = new DemoGuru99Page(driver);

            demoGuru99.MaximizeWindow();
            demoGuru99.getLinkElement().Click();
            GoogleHomePage gHome = demoGuru99.goToGoogle();

            gHome.getSearchTextBox().SendKeys("Sarasa");
        }
Пример #14
0
        public void GoogleSearch()
        {
            GoogleHomePage gHome = new GoogleHomePage(driver);

            gHome.MaximizeWindow();
            gHome.getSearchTextBox().SendKeys("Hola");

            GoogleResultPage gSearch = gHome.search();

            gSearch.getFirstResult().Text.ToLower().Should().Contain("Hola".ToLower());
        }
Пример #15
0
        public void VerifyICDPortalIsFirstSearchResultGoogle(string searchCriteria, string expectedURL, string searchEngine)
        {
            GoogleHomePage search = new GoogleHomePage(driver);

            search.GoToPage(searchEngine);
            GoogleResultPage results = search.Criteria(searchCriteria).Search();

            results.NavigateTo(results.FirstResult);

            Assert.That(driver.Url, Is.EqualTo(expectedURL), "The first returned website URL did not match the expected website URL");
        }
Пример #16
0
        public void GoogleHomePage_Visited_DoodleDisplayed()
        {
            var homePage = new GoogleHomePage(this.Driver, this.BaseUrl, "/");

            homePage.Navigate();

            System.Threading.Thread.Sleep(10000);
            var displayed = homePage.Doodle.Displayed;

            Assert.IsTrue(displayed, "Doodle is not displayed");
        }
Пример #17
0
        public void HtmlEdit_SetText_Succeeds()
        {
            GoogleHomePage pgGHomePage = WebPage.Launch <GoogleHomePage>("http://www.google.com");

            pgGHomePage.txtSearch.SetText("Coded UI Test Framework");
            GoogleSearch            pgSearch = WebPage.GetPage <GoogleSearch>();
            UITestControlCollection col      = pgSearch.divSearchResults.UnWrap().GetChildren();

            //do something with collection
            pgSearch.Close();
        }
Пример #18
0
        public void GoogleHomePage_Visited_TitleIsGoogle()
        {
            var homePage = new GoogleHomePage(this.Driver, this.BaseUrl, "/");

            homePage.Navigate();

            System.Threading.Thread.Sleep(10000);
            var text = homePage.Title;

            Assert.AreEqual("Google", text, false);
        }
Пример #19
0
        public void HtmlEdit_SetText_Succeeds()
        {
            GoogleHomePage pgGHomePage = BrowserWindowUnderTest.Launch <GoogleHomePage>("http://www.google.com");

            pgGHomePage.txtSearch.Text = "Coded UI Test Framework";
            GoogleSearch pgSearch = BrowserWindowUnderTest.GetBrowserWindow <GoogleSearch>();
// ReSharper disable once UnusedVariable
            UITestControlCollection col = pgSearch.divSearchResults.SourceControl.GetChildren();

            //do something with collection
            pgSearch.Close();
        }
Пример #20
0
        public void WhenEnterSearchTextInGoogleHomePageAndClickOnSearch_ThenSearchShouldDisplay()
        {
            //Google home page
            GoogleHomePage home = new GoogleHomePage(DriverFactory.GetDriver <IWebDriver>());

            home.EnterSearchKeyword("google");
            home.ClickSearch();
            //google search results page
            GoogleSearchResultsPage results = new GoogleSearchResultsPage(DriverFactory.GetDriver <IWebDriver>());

            results.VerifyResultLink("google");
        }
Пример #21
0
        public void Test_GoogleSearch(string keyword, string expectedTitle)
        {
            // arrange
            googleHomePage = new GoogleHomePage();
            browser.Goto("https://www.google.com/");

            // act
            googleHomePage.Search(keyword, googlePageObject);

            // assert
            Assert.AreEqual(expectedTitle, driver.Title);
        }
Пример #22
0
 internal void VerifyTextInSearchBar(string expectedTest)
 {
     try
     {
         GoogleHomePage googleHomePage  = new GoogleHomePage(_webDriver);
         string         textInSearchBar = googleHomePage.GetTextInInput();
         AssertionProvider.EqualsHardAssert(expectedTest, textInSearchBar, "the text in the search bar is not the expected");
     }
     catch (Exception ex)
     {
         AssertionProvider.FailTest(ex.Message);
     }
 }
Пример #23
0
        public void SearchWebsite()
        {
            _driver = new ChromeDriver();
            _wait   = new WebDriverWait(_driver, new TimeSpan(0, 0, 20));

            _driver.Navigate().GoToUrl("http://www.google.com/");

            var googleSeachPage = new GoogleHomePage(_driver, _wait);

            googleSeachPage.Search("feel it services iasi").SelectFirstResult().ClickTopMenuCareers().ClickTopMenuContactUs();

            Assert.NotNull(_driver.Title);
        }
Пример #24
0
        public void GoogleSearchUsingData2(string testName)
        {
            var userData = ExcelDataAccess <UserData> .GetTestData(testName, "TestDataSheetPath2");

            GoogleHomePage gHome = new GoogleHomePage(driver);

            gHome.MaximizeWindow();
            gHome.getSearchTextBox().SendKeys(userData.Sarasa);

            GoogleResultPage gSearch = gHome.search();

            gSearch.getFirstResult().Text.ToLower().Should().Contain(userData.Sarasa.ToLower());
        }
Пример #25
0
        public static void GoogleHomePageTest()
        {
            Driver.GoToSite(URL.googleUrl);
            GoogleHomePage.EnterSearchText("Selenium Webdriver");
            GoogleSERPPage.ClickSearchLink();
            string expctedData = "Selenium is a suite of tools";
            string actualData  = GoogleSearchResultPage.GetActualData();

            if (!expctedData.Equals(actualData))
            {
                logger.Info($"Expected Text : {expctedData}    Actual Output : {actualData}");
            }
            Assert.AreEqual(expctedData, actualData);
        }
Пример #26
0
        public void Test_GoogleSearch(string keyword, string expectedTitle)
        {
            // arrange
            test           = extentTest("GoogleSearch", "Google Search Test on google home page");
            googleHomePage = new GoogleHomePage();
            browser.Goto("https://www.google.com/");

            // act
            test.Log(Status.Info, "Test Case Starts.");
            googleHomePage.Search(keyword, googlePageObject);

            // assert
            Assert.AreEqual(expectedTitle, driver.Title);
        }
Пример #27
0
        public void HtmlEdit_Wrap_Succeeds()
        {
            GoogleHomePage pgGHomePage = WebPage.Launch <GoogleHomePage>("http://www.google.com");

            var tmp = new HtmlEdit(pgGHomePage);

            tmp.SearchProperties.Add("Id", "lst-ib");

            var txtEdit = new EnhancedHtmlEdit();

            txtEdit.WrapReady(tmp);
            txtEdit.SetText("Coded UI Test enhanced Framework");
            GoogleSearch pgSearch = WebPage.GetPage <GoogleSearch>();

            pgSearch.Close();
        }
Пример #28
0
        public void GivenAWebBrowserIsOnThePage(string searchEngine)
        {
            switch (searchEngine)
            {
            case ICDTestData.Google:
                _googleSearchEngine = new GoogleHomePage(_driver);
                _googleSearchEngine.GoToPage(searchEngine);
                break;

            case ICDTestData.Bing:
                _bingSearchEngine = new BingHomePage(_driver);
                _bingSearchEngine.GoToPage(searchEngine);
                break;

            default:
                break;
            }
        }
 public void WhenIEnterGoogleInSearchBarAndClickOnGoogleSearchButton(string searchKeyword)
 {
     try
     {
         googleHomePage = new GoogleHomePage(SeleniumHelper.getDriver());
         googleHomePage.EnterSearchText(searchKeyword);
         _StepImageContext = new List <StepImageContext>();
         _StepImageContext = SeleniumHelper.AddScreenshotToContext(_StepImageContext, "EnterSearchCriteria.png", "User is entering search criteria");
         googleHomePage.ClickSearchButton();
         _StepImageContext = SeleniumHelper.AddScreenshotToContext(_StepImageContext, "ClickOnSearchButton.png", "User is clicking search button");
         ScenarioContext.Current.Add("StepImageContext", _StepImageContext);
     }
     catch (Exception ex)
     {
         //Hooks.testLog.Fail(ex);
         //throw ex;
         Hooks.LogErrorWithScreenshot(ex, _StepImageContext);
     }
 }
 public void GivenIMInGoogleHomePage()
 {
     try
     {
         _StepImageContext = new List <StepImageContext>();
         SeleniumHelper.navigateToUrl("https:\\www.google.com");
         googleHomePage    = new GoogleHomePage(SeleniumHelper.getDriver());
         _StepImageContext = SeleniumHelper.AddScreenshotToContext(_StepImageContext, "GoogleHomePage.png", "User is in google home page");
         Assert.IsTrue(googleHomePage.isSearchTextBoxDisplayed(10));
         Hooks.testLog.Pass("Navigated to google url");
         ScenarioContext.Current.Add("StepImageContext", _StepImageContext);
     }
     catch (Exception ex)
     {
         //Hooks.testLog.Fail(ex);
         //throw ex;
         Hooks.LogErrorWithScreenshot(ex, _StepImageContext);
     }
 }