Ejemplo n.º 1
0
		public void VerifyStandardPageLayout(BasePage currentPage)
		{
			StringAssert.Contains(currentPage.PageTitleLabel.ToUpper(),
								  currentPage.WaitForElement(By.XPath(ControlPanelIDs.PageTitleID)).
									  Text.ToUpper(),
								  "The wrong page is opened");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the error message is not present");
			Assert.IsFalse(
				currentPage.ElementPresent(
					By.XPath(
						"//div[contains(@id, 'dnnSkinMessage') and contains(@class, 'dnnFormValidationSummary')]")),
				"The error message is present on the current page");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the error popup is not present");
			Assert.IsFalse(
				currentPage.ElementPresent(
					By.XPath(
						"//div[contains(@class, 'dnnFormPopup') and contains(@style, 'display: block;')]//span[contains(text(), 'Error')]")),
				"The error popup is present on the current page");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT Copyright notice is present");
			Utilities.SoftAssert(
				() => StringAssert.Contains(ControlPanelIDs.CopyrightText, currentPage.FindElement(By.Id(ControlPanelIDs.CopyrightNotice)).Text,
											"Copyright notice is not present or contains wrong text message"));
		}
Ejemplo n.º 2
0
		public void VerifyStandardPageLayout(BasePage currentPage)
		{
			StringAssert.Contains(currentPage.PageTitleLabel.ToUpper(),
								  currentPage.WaitForElement(By.XPath(ControlPanelIDs.PageTitleID)).
									  Text.ToUpper(),
								  "The wrong page is opened");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the error message is not present");
			Assert.IsFalse(
				currentPage.ElementPresent(
					By.XPath(
						"//div[contains(@id, 'dnnSkinMessage') and contains(@class, 'dnnFormValidationSummary')]")),
				"The error message is present on the current page");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the error popup is not present");
			Assert.IsFalse(
				currentPage.ElementPresent(
					By.XPath(
						"//div[contains(@class, 'dnnFormPopup') and contains(@style, 'display: block;')]//span[contains(text(), 'Error')]")),
				"The error popup is present on the current page");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The Message Link or Message Link bubble-help is present");
			Utilities.SoftAssert(
				() => Assert.IsNotEmpty(currentPage.FindElement(By.XPath(ControlPanelIDs.MessageLink)).GetAttribute("title"),
				                        "The Message Link or Message Link bubble-help is missing."));

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The Notification Link or Notification Link bubble-help is present");
			Utilities.SoftAssert(
				() => Assert.IsNotEmpty(currentPage.FindElement(By.XPath(ControlPanelIDs.NotificationLink)).GetAttribute("title"),
				                        "The Notification Link or Notification Link bubble-help is missing."));

			Trace.WriteLine(BasePage.TraceLevelPage +
			                "ASSERT The Registered User Link or Registered User Link bubble-help is present");
			Utilities.SoftAssert(
				() => Assert.IsNotEmpty(currentPage.FindElement(By.XPath(ControlPanelIDs.RegisterLink)).GetAttribute("title"),
				                        "The Registered User Link or Registered User Link bubble-help is missing."));

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The User Avatar or User Avatar bubble-help is present");
			Utilities.SoftAssert(
				() => Assert.IsNotEmpty(currentPage.FindElement(By.Id(ControlPanelIDs.UserAvatar)).GetAttribute("title"),
				                        "The User Avatar or User Avatar bubble-help is missing."));

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The Logout Link or Logout Link bubble-help is present");
			Utilities.SoftAssert(
				() => Assert.IsNotEmpty(currentPage.FindElement(By.XPath(ControlPanelIDs.LogoutLink)).GetAttribute("title"),
				                        "The Logout Link or Logout Link bubble-help is missing."));

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The Search Box is present");
			Assert.IsTrue(currentPage.ElementPresent(By.XPath(ControlPanelIDs.SearchBox)),
			              "The Search Box is missing.");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT The Search Button is present");
			Assert.IsTrue(currentPage.ElementPresent(By.XPath(ControlPanelIDs.SearchButton)),
			              "The Search Button is missing.");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT Copyright notice is present");
			Utilities.SoftAssert(
				() => StringAssert.Contains(ControlPanelIDs.CopyrightText, currentPage.FindElement(By.Id(ControlPanelIDs.CopyrightNotice)).Text,
				                            "Copyright notice is not present or contains wrong text message"));
		}
Ejemplo n.º 3
0
        public void SelectByValue(string value)
        {
            Trace.WriteLine(BasePage.TraceLevelElement + "Select '" + value + "' in the list '" + _dropDownId + "'");

            BasePage.WaitForElement(_driver, _dropDownId).Click();
            BasePage.WaitForElement(_driver, By.XPath("//div[contains(@class, '-tree')]//a[text() = '" + value + "']")).ScrollIntoView().Click();
            BasePage.WaitForElement(_driver, By.XPath("//a[@class = 'selected-value' and text() ='" + value + "']")).Info();
        }
Ejemplo n.º 4
0
		public void VerifyQuickSearch(BasePage currentPage)
		{
			currentPage.WaitAndType(By.XPath(ControlPanelIDs.SearchBox), "home");
			currentPage.WaitForElement(By.XPath("//ul[@class = 'searchSkinObjectPreview']"), 60);

			Assert.IsTrue(currentPage.ElementPresent(By.XPath("//li/a[@class = 'searchSkinObjectPreview_more']")),
			              "The link 'See More Results' is missing");

			Assert.That(currentPage.FindElements(By.XPath("//ul[@class = 'searchSkinObjectPreview']/li[@data-url]")).Count,
			            Is.AtLeast(1),
			            "At least one item is displayed");
		}
Ejemplo n.º 5
0
        public void ClickOnButton(By buttonName)
        {
            Trace.WriteLine(BasePage.TraceLevelElement + "Click on button:");

            IWebElement button = BasePage.WaitForElement(_driver, buttonName);

            if (!button.Displayed)
            {
                FindElement(buttonName).ScrollIntoView().WaitTillVisible();
            }

            FindElement(buttonName).Click();
        }
Ejemplo n.º 6
0
        public void OpenTab(By tabName)
        {
            Trace.WriteLine(BasePage.TraceLevelElement + "Click on Tab:");

            IWebElement tab = BasePage.WaitForElement(_driver, tabName);

            if (!tab.Displayed)
            {
                ScrollIntoView(FindElement(tabName), 200).WaitTillVisible();
            }

            FindElement(tabName).Click();
        }
Ejemplo n.º 7
0
        public void SelectUsingSearch(string value)
        {
            IWebElement listDropDown = _driver.FindElement(_dropDownId);

            Trace.WriteLine(BasePage.TraceLevelElement + "Search '" + value + "' in the list '" + _dropDownId + "'");

            BasePage.WaitForElement(_driver, By.XPath("//div[@id='" + listDropDown.GetAttribute("id") + "']" + "/div/a")).Click();

            BasePage.WaitForElement(_driver, By.XPath("//*[@id='" + listDropDown.GetAttribute("id") + "']" + "//input[@class = 'search-input']"));
            _driver.FindElement(By.XPath("//div[@id='" + listDropDown.GetAttribute("id") + "']" + "//input[@class = 'search-input']")).SendKeys(value);
            _driver.FindElement(By.XPath("//div[@id='" + listDropDown.GetAttribute("id") + "']" + "//a[@class = 'search-button']")).Click();

            BasePage.WaitForElement(_driver, By.XPath("//div[contains(@class, '-tree')]//a[text() = '" + value + "']")).Click();
            BasePage.WaitForElement(_driver, By.XPath("//a[@class = 'selected-value' and text() ='" + value + "']")).Info();
        }
Ejemplo n.º 8
0
        public void Open()
        {
            IWebElement accordion = BasePage.WaitForElement(_driver, _accordionId);

            if (accordion.Displayed)
            {
                accordion.ScrollIntoView().WaitTillVisible();
            }

            accordion.Info();

            if (!accordion.GetAttribute("class").Contains("dnnSectionExpanded"))
            {
                accordion.Click();
                //BasePage.WaitForElement(_driver, accordion.GetAttribute();
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 9
0
		public void NumberOfLinksOnPage(BasePage currentPage, string featureList, int numberOfLinks)
		{
			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of links on page: " +
							numberOfLinks);

			currentPage.WaitForElement(By.XPath(featureList + "/div[last()]"));
			Assert.That(currentPage.FindElements(By.XPath(featureList)).Count,
						Is.EqualTo(numberOfLinks),
						"The number of links on page is not correct");
		}