示例#1
0
        public void GenerateTimingAlert()
        {
            //arrange
            _driver.Url = Url;
            var homePageSteps = new HomePageSteps(_driver);
            var automationPracticeSwitchSteps = new AutomationPracticeSwitchSteps(_driver);
            var alertExpected =
                "Knowledge increases by sharing but not by saving. Please share this website with your friends and in your organization.";

            //act
            homePageSteps.SelectSubMenu();
            automationPracticeSwitchSteps.NavigationToAutoPracticeSwitch();
            automationPracticeSwitchSteps.GenerateTimingAlert();

            var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(5));

            wait.Until(ExpectedConditions.AlertIsPresent());
            var alertText = _driver.SwitchTo().Alert().Text;

            //assert
            Assert.AreEqual(alertExpected, alertText, $"'{alertExpected}' alert should be displayed");
        }
示例#2
0
        public void OpenPageInNewTab()
        {
            //arrange
            _driver.Url = Url;
            var homePageSteps = new HomePageSteps(_driver);
            var automationPracticeSwitchSteps = new AutomationPracticeSwitchSteps(_driver);
            var expectedResult = "QA Automation Tools Tutorial";
            var currentWindow  = _driver.CurrentWindowHandle;


            //act
            homePageSteps.SelectSubMenu();
            automationPracticeSwitchSteps.NavigationToAutoPracticeSwitch();
            automationPracticeSwitchSteps.NavigateToBrowserWindow();
            var switchWindow = _driver.WindowHandles.First(h => h != currentWindow);

            _driver.SwitchTo().Window(switchWindow);
            var actualResult = _driver.Title;

            //assert
            Assert.AreEqual(expectedResult, actualResult, "Page Title is not matched");
        }