private void RunInstallerLogTest(XElement settings) { string testName = settings.Attribute("name").Value; string baseUrl = settings.Attribute("baseURL").Value; string browser = settings.Attribute("browser").Value; string installerLanguage = settings.Attribute("InstallerLanguage").Value; string language = settings.Attribute("Language").Value; IWebDriver driver = StartBrowser(browser); Trace.WriteLine("Running TEST: '" + testName + "'"); InstallerPage installerPage = new InstallerPage(driver); installerPage.OpenUsingUrl(baseUrl); installerPage.SetInstallerLanguage(installerLanguage); installerPage.SetDictionary(installerLanguage); installerPage.FillAccountInfo(settings); installerPage.ClickOnContinueButton(); installerPage.WaitForInstallationProcessToFinish(); installerPage.ClickOnSeeLogsButton(); installerPage.WaitForLogContainer(); Trace.WriteLine("Assert Log records: "); StringAssert.DoesNotContain("ERROR", installerPage.FindElement(By.Id(InstallerPage.InstallerLogContainer)).Text, "PLZ check log file, it contains error messages"); installerPage.ClickOnVisitWebsiteButton(); installerPage.WelcomeScreen(); Trace.WriteLine("Assert Log files do not contain ERRORs "); HostSettingsPage hostSettingsPage = new HostSettingsPage(driver); hostSettingsPage.SetDictionary(language); hostSettingsPage.OpenUsingButtons(baseUrl); hostSettingsPage.Click(By.XPath(HostSettingsPage.LogsTab)); SlidingSelect.SelectByValue(driver, By.XPath("//a[contains(@id, '" + HostSettingsPage.LogFilesDropDownArrow + "')]"), By.XPath(HostSettingsPage.LogFilesDropDownList), HostSettingsPage.OptionOne, SlidingSelect.SelectByValueType.Contains); hostSettingsPage.WaitForElement(By.XPath(HostSettingsPage.LogContent), 30); StringAssert.Contains(hostSettingsPage.Translate("Successfull Log"), hostSettingsPage.FindElement(By.XPath(HostSettingsPage.LogContent)).Text, "The Log File is not empty"); SlidingSelect.SelectByValue(driver, By.XPath("//a[contains(@id, '" + HostSettingsPage.LogFilesDropDownArrow + "')]"), By.XPath(HostSettingsPage.LogFilesDropDownList), HostSettingsPage.OptionTwo, SlidingSelect.SelectByValueType.Contains); hostSettingsPage.WaitForElement(By.XPath(HostSettingsPage.LogContent), 30); StringAssert.DoesNotContain("ERROR", hostSettingsPage.FindElement(By.XPath(HostSettingsPage.LogContent)).Text, "The Installer Log File contains ERRORS"); }
public void RunBeforeBVTTests() { Trace.WriteLine(BasePage.TraceLevelComposite + "BVT Setup"); var doc = XDocument.Load(@"BVT\" + Settings.Default.BVTDataFile); XElement settings = doc.Document.Element("Tests").Element("settings"); string testName = settings.Attribute("name").Value; string installerLanguage = settings.Attribute("InstallerLanguage").Value; IWebDriver driver = TestBase.StartDriver(settings.Attribute("browser").Value); string baseUrl = settings.Attribute("baseURL").Value; Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'"); Trace.WriteLine(BasePage.PreconditionsKeyWord); var installerPage = new InstallerPage(driver); installerPage.OpenUsingUrl(baseUrl); installerPage.SetInstallerLanguage(installerLanguage); installerPage.SetDictionary(installerLanguage); installerPage.FillAccountInfo(settings); installerPage.ClickOnContinueButton(); installerPage.WaitForInstallationProcessToFinish(); installerPage.ClickOnVisitWebsiteButton(); installerPage.WelcomeScreen(); AdminSiteSettingsPage adminSiteSettingsPage = new AdminSiteSettingsPage(driver); adminSiteSettingsPage.OpenUsingButtons(baseUrl); adminSiteSettingsPage.DisablePopups(); driver.Quit(); }
private void RunInstallTest(XElement settings) { string testName = settings.Attribute("name").Value; string baseUrl = settings.Attribute("baseURL").Value; string browser = settings.Attribute("browser").Value; string template = settings.Attribute("Template").Value; string installerLanguage = settings.Attribute("InstallerLanguage").Value; string language = settings.Attribute("Language").Value; string username = settings.Attribute("UserName").Value; string password = settings.Attribute("Password").Value; string websiteName = settings.Attribute("WebsiteName").Value; IWebDriver driver = StartBrowser(browser); Trace.WriteLine("Running TEST: '" + testName + "'"); InstallerPage installerPage = new InstallerPage(driver); installerPage.OpenUsingUrl(baseUrl); installerPage.SetInstallerLanguage(installerLanguage); installerPage.SetDictionary(installerLanguage); installerPage.OpenUsingUrl(baseUrl); installerPage.FillAccountInfo(settings); installerPage.SetWebSiteLanguage(language); installerPage.ClickOnContinueButton(); installerPage.WaitForInstallationProcessToFinish(); installerPage.ClickOnVisitWebsiteButton(); Trace.WriteLine(BasePage.TraceLevelComposite + "Login to the site first time, using 'Visit Website' button:"); Trace.WriteLine(BasePage.TraceLevelComposite + "Set site language: '" + language + "'"); installerPage.SetDictionary(language); Trace.WriteLine(BasePage.TraceLevelPage + "Verify frame title: '" + installerPage.CurrentFrameTitle() + "'"); Utilities.SoftAssert(() => StringAssert.AreEqualIgnoringCase(installerPage.Translate("WelcomeScreenTitle"), installerPage.CurrentFrameTitle(), "The Welcome Screen title is missing or incorrect")); installerPage.WaitAndSwitchToFrame(60); installerPage.WaitForElement(By.Id(InstallerPage.IntroVideo), 60).WaitTillVisible(60); installerPage.WaitForElement(By.Id(InstallerPage.WhatIsNew), 60).WaitTillVisible(60); installerPage.WaitForElement(By.Id(InstallerPage.LetMeAtIn), 60).WaitTillEnabled().Click(); installerPage.WaitAndSwitchToWindow(60); LoginPage loginPage = new LoginPage(driver); Trace.WriteLine("Verify Website Name: '" + websiteName + "'"); Utilities.SoftAssert(() => StringAssert.Contains(websiteName, installerPage.CurrentWindowTitle(), "The website name is incorrect")); switch (template) { case "Default Template": { loginPage.LoginUsingLoginLinkAndFrame(username, password); //default template; look for menu options, 4 options should be present Trace.WriteLine("Assert current Template: Default: "); Assert.AreEqual(4, installerPage.FindElements(By.XPath("//ul[@id='dnn_pnav']/li")).Count(), "This is not a Default page or The number of options are incorrect"); loginPage.LoginUsingUrl(baseUrl, username, password); //default template; look for menu options, 4 options should be present Trace.WriteLine("Assert current Template: Default: "); Assert.AreEqual(4, installerPage.FindElements(By.XPath("//ul[@id='dnn_pnav']/li")).Count(), "This is not a Default page or The number of options are incorrect"); break; } case "Mobile Template": { Trace.WriteLine("Assert current Template: Mobile: "); Assert.AreEqual(3, installerPage.FindElements(By.XPath("//ol[@class='mobileInstruction']/li")).Count(), "This is not a Mobile page or The mobile instructions are not present on the page or The number of mobile instructions steps are incorrect"); break; } case "Blank Template": { loginPage.LoginUsingLoginLinkAndFrame(username, password); //blank template; look for the "Home" option (only one option is present) Trace.WriteLine("Assert current Template: Blank: "); Assert.AreEqual(1, installerPage.FindElements(By.XPath("//ul[@id='dnn_pnav']/li")).Count(), "This is not a Blank page or The number of options are incorrect"); loginPage.LoginUsingUrl(baseUrl, username, password); //blank template; look for the "Home" option (only one option is present) Trace.WriteLine("Assert current Template: Blank: "); Assert.AreEqual(1, installerPage.FindElements(By.XPath("//ul[@id='dnn_pnav']/li")).Count(), "This is not a Blank page or The number of options are incorrect"); break; } } }