Exemple #1
0
        public void GetBrowserWindow_WithDynamicWindowTitle_CanInteractWithWindow()
        {
            // Arrange
            string page2GenericWindowTitle        = "window title 2";
            string page2DynamicGenericWindowTitle = "the window title changed";
            string homePageGenericWindowTitle     = "Clicking the buttons changes the window title";

            DynamicBrowserWindowTitleRepository home = BrowserWindowUnderTest.Launch <DynamicBrowserWindowTitleRepository>(currentDirectory + "/DynamicBrowserWindowTitle.html");

            home.btnGoToPage2.Click();

            DynamicBrowserWindowTitleRepository page2 = DynamicBrowserWindowUnderTest.GetBrowserWindow <DynamicBrowserWindowTitleRepository>(page2GenericWindowTitle);

            page2.btnChangeWindowTitle.Click();

            // Checkpoint
            Assert.IsTrue(page2.Title.Contains(page2DynamicGenericWindowTitle), page2.Title);

            // Act
            page2 = DynamicBrowserWindowUnderTest.GetBrowserWindow <DynamicBrowserWindowTitleRepository>(page2DynamicGenericWindowTitle);

            page2.btnGoToHomePage.Click();

            page2.SetWindowTitle(homePageGenericWindowTitle);

            // Assert
            Assert.IsTrue(page2.Title.Contains(homePageGenericWindowTitle), page2.Title);

            page2.Close();
        }
        public void GetBrowserWindow_WithDynamicWindowTitle_CanInteractWithWindow()
        {
            //Arrange
            string page2GenericWindowTitle        = "window title 2";
            string page2DynamicGenericWindowTitle = "the window title changed";
            string page2DynamicFullWindowTitle    = "the window title changed - Windows Internet Explorer";
            string homePageGenericWindowTitle     = "Clicking the buttons changes the window title";
            string homePageFullWindowTitle        = "Clicking the buttons changes the window title - Windows Internet Explorer";

            DynamicBrowserWindowTitleRepository home =
                WebPage.Launch <DynamicBrowserWindowTitleRepository>(CurrentDirectory + "/DynamicBrowserWindowTitle.html");

            home.btnGoToPage2.Click();

            DynamicBrowserWindowTitleRepository page2 =
                WebPage.GetPage <DynamicBrowserWindowTitleRepository>(page2GenericWindowTitle);

            page2.btnChangeWindowTitle.Click();

            //Checkpoint
            Assert.AreEqual(page2DynamicFullWindowTitle, page2.Title);

            //Act
            page2 =
                WebPage.GetPage <DynamicBrowserWindowTitleRepository>(
                    page2DynamicGenericWindowTitle);

            page2.btnGoToHomePage.Click();

            page2.SetWindowTitle(homePageGenericWindowTitle);

            //Assert
            Assert.AreEqual(homePageFullWindowTitle, page2.Title);

            page2.Close();
        }