public string LogContent() { HostSettingsPage hostSettingsPage = new HostSettingsPage(_driver); hostSettingsPage.SetDictionary("en"); hostSettingsPage.OpenUsingUrl(_baseUrl); hostSettingsPage.WaitAndClick(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); return hostSettingsPage.FindElement(By.XPath(HostSettingsPage.LogContent)).Text.ToLower(); }
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.OpenUsingUrl(baseUrl); installerPage.FillAccountInfo(settings); installerPage.SetWebSiteLanguage(language); 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.WaitAndClick(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"); }