Пример #1
0
		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[@class ='nav nav-pills']/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[@class = 'nav nav-pills']/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;
					}
			}

		}