Пример #1
0
        private void FooterCertifications()
        {
            //ICANN
            Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterIcannCertification.Text, UiConstantHelper.Icann);
            Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterIcannCertification.Text, UiConstantHelper.AccreditedRegistrar);
            //Payment Options
            string footerPaymentOptions = ".//*[@id='footer']/*[contains(@class,'certifications')]/*[2]/dd";

            for (int footerPaymentOption = 1; footerPaymentOption <= BrowserInit.Driver.FindElements(By.XPath(footerPaymentOptions)).Count; footerPaymentOption++)
            {
                string paymentOption = BrowserInit.Driver.FindElement(By.XPath(footerPaymentOptions + "[" + footerPaymentOption + "]")).Text;
                Assert.IsTrue(paymentOption.Contains(UiConstantHelper.AmericanExpress) || paymentOption.Contains(UiConstantHelper.Bitcoin) || paymentOption.Contains(UiConstantHelper.Dwolla) || paymentOption.Contains(UiConstantHelper.MasterCard) || paymentOption.Contains(UiConstantHelper.PayPal) || paymentOption.Contains(UiConstantHelper.Visa));
            }
            //Security and Privacy Certifications
            string footerSecurityandPrivacy = ".//*[@id='footer']/*[contains(@class,'certifications')]/*[3]/li";

            for (int footerSecurityandPrivacyLinks = 1; footerSecurityandPrivacyLinks <= BrowserInit.Driver.FindElements(By.XPath(footerSecurityandPrivacy)).Count; footerSecurityandPrivacyLinks++)
            {
                PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(BrowserInit.Driver.FindElement(By.XPath(footerSecurityandPrivacy + "[" + footerSecurityandPrivacyLinks + "]/a")));

                BrowserInit.Driver.FindElement(By.XPath(footerSecurityandPrivacy + "[" + footerSecurityandPrivacyLinks + "]/a")).Click();
                PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

                var popupWindow = BrowserInit.Driver.WindowHandles.Count;
                if (popupWindow > 1)
                {
                    BrowserInit.Driver.SwitchTo().Window(BrowserInit.Driver.WindowHandles[1]).Close();
                    BrowserInit.Driver.SwitchTo().Window(BrowserInit.Driver.WindowHandles.Last());
                }
                else
                {
                    BrowserInit.Driver.Navigate().Back();
                }
            }
        }
Пример #2
0
 private void FooterCauses()
 {
     Assert.IsTrue(PageInitHelper <FooterPageFactory> .PageInit.FooterCausesSupport.Text.IndexOf(UiConstantHelper.WeSupport, StringComparison.InvariantCultureIgnoreCase) != -1);
     //We Support EFF & FFTF
     foreach (var footerOrganization in PageInitHelper <FooterPageFactory> .PageInit.FooterCausesOrganization)
     {
         Assert.IsTrue(footerOrganization.FindElement(By.XPath("/*")).Displayed);
     }
 }
Пример #3
0
        private void FooterLegal()
        {
            //Footer Copyright
            string footerLegalCopyrightTxt = PageInitHelper <FooterPageFactory> .PageInit.FooterLegalCopyright.Text;

            Assert.Contains(footerLegalCopyrightTxt, UiConstantHelper.Copyright);
            Assert.Contains(footerLegalCopyrightTxt, DateTime.Now.Year.ToString());
            //Footer Legal Links
            string footerLegalLinks      = ".//*[@id='footer']/*[contains(@class,'legal')]/ul/li";
            int    footerLegalLinksCount = BrowserInit.Driver.FindElements(By.XPath(footerLegalLinks)).Count;

            for (int footerLegalLink = 1; footerLegalLink <= footerLegalLinksCount; footerLegalLink++)
            {
                BrowserInit.Driver.FindElement(By.XPath(footerLegalLinks + "[" + footerLegalLink + "]")).Click();
                PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

                BrowserInit.Driver.Navigate().Back();
            }
        }
Пример #4
0
        private void FooterNewsLetterAndSocialNetwork()
        {
            //Footer Namecheap Logo
            string altTxt = PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapLogo.GetAttribute(UiConstantHelper.Alt).Trim();

            Assert.Contains(altTxt, UiConstantHelper.Namecheap.Trim());
            //Footer About Namecheap
            Assert.IsTrue(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutText.Displayed);
            PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutLink);

            PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutLink.Click();

            PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

            BrowserInit.Driver.Navigate().Back();
            //Footer Namecheap Blog
            PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutBlogLink.Click();

            PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

            BrowserInit.Driver.Navigate().Back();
            //Footer Newsletter Form
            Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapNewsletter.Text, UiConstantHelper.Newsletter);
            Assert.IsTrue(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapNewsletterPeriodic.Displayed);
            foreach (var footerNewsletter in PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapJoinNewsletter)
            {
                string inputAttribute = footerNewsletter.GetAttribute(UiConstantHelper.Name);
                Assert.IsTrue(inputAttribute.Contains(UiConstantHelper.Email.ToLower()) || inputAttribute.Contains(UiConstantHelper.Action));
            }
            //Footer Social
            string footerSocial      = "//*[@id='footer']//*[contains(@class,'social')]/li";
            int    footerSocialCount = BrowserInit.Driver.FindElements(By.XPath(footerSocial)).Count;

            for (int social = 1; social <= footerSocialCount; social++)
            {
                BrowserInit.Driver.FindElement(By.XPath(footerSocial + "[" + social + "]")).GetAttribute(UiConstantHelper.AttributeClass);
                BrowserInit.Driver.FindElement(By.XPath(footerSocial + "[" + social + "]/a")).Click();
                PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

                BrowserInit.Driver.Navigate().Back();
            }
        }
Пример #5
0
        public string performGlobalNCSearch()
        {
            string searchContent;

            if (AppConfigHelper.MainUrl.Contains("sandbox") || AppConfigHelper.MainUrl.Contains("live"))
            {
                Assert.IsTrue(PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchIcon.Enabled, " Header Search Icon Is Not Enable");
                PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchIcon.Click();

                Assert.IsTrue(PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchInput.Displayed, " Header Search Input Is Not Displayed");
                searchContent = UiConstantHelper.KnowledgebaseArticlesTitle[PageInitHelper <PageValidationHelper> .PageInit.RandomGenrator(UiConstantHelper.KnowledgebaseArticlesTitle.Length)];
                PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchInput.SendKeys(searchContent);

                Assert.IsTrue(PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchBtn.Enabled, " Header Search Button Is Not Enable");
                PageInitHelper <GlobalNCSearchPageFactory> .PageInit.HeaderSearchBtn.Click();

                Assert.IsTrue(PageInitHelper <GlobalNCSearchPageFactory> .PageInit.KnowledgebaseBreadcrumbs.Text.Equals(UiConstantHelper.KnowledgebaseSearchResultBreadcrumbs), " Incorrect Knowledgebase Breadcrumbs");
            }
            else
            {
                throw new InconclusiveException("User Exception : We are not able to perform the tests due to insufficient knowledgebase articles  in " + AppConfigHelper.MainUrl);
            }
            return(searchContent);
        }
Пример #6
0
        internal void checkArticleTypeAndValidateArticle(string searchContent, string caseType)
        {
            int selectedArticle;
            int knowledgebaseArticleCount = PageInitHelper <GlobalNCSearchPageFactory> .PageInit.ArticleListItems.Count;

            if (PageInitHelper <GlobalNCSearchPageFactory> .PageInit.ArticleListItems.Count == 0)
            {
                throw new Exception("User Exception : Insufficient knowledgebase articles available in the selected page");
            }

            for (selectedArticle = 1; selectedArticle <= knowledgebaseArticleCount; selectedArticle++)
            {
                StringBuilder wholePageTxt = new StringBuilder();
                /*articleName not required for validation and it may use of future validation*/
                //string articleName = BrowserInit.Driver.FindElement(By.XPath("//ul[contains(@class,'article-list')]/li[" + selectedArticle + "]/p/a[1]")).Text;
                string articleType = BrowserInit.Driver.FindElement(By.XPath("//ul[contains(@class,'article-list')]/li[" + selectedArticle + "]/p/a[2]")).Text;

                /*  Need To Satisfy both the Calling Case and articleType should be the same
                 *  Condition 1.Verify both Selected articleType and Calling Method
                 *  Condition 2.Verify both Selected articleType and Selected Type link  */
                if (articleType.Contains(caseType.ToLower()) && articleType.Contains(UiConstantHelper.Website))
                {
                    BrowserInit.Driver.FindElement(By.XPath("//ul[contains(@class,'article-list')]/li[" + selectedArticle + "]/p/a[1]")).Click();
                    new WebDriverWait(BrowserInit.Driver, TimeSpan.FromSeconds(200)).Until(driver1 => ((IJavaScriptExecutor)BrowserInit.Driver).ExecuteScript("return document.readyState").Equals("complete"));
                    PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

                    /*Verify the Page title with searchcontent else get entire text from the page except "Header" & "Footer" and verfiy he text presence*/
                    if (BrowserInit.Driver.Title.IndexOf(searchContent, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        Assert.IsTrue(BrowserInit.Driver.Title.IndexOf(searchContent, StringComparison.OrdinalIgnoreCase) >= 0, "Expected page is " + searchContent + " but getting wrong page " + BrowserInit.Driver.Title);
                        break;
                    }
                    /*else is not required due to the above condtion satisfied means, need not to comes down the below code*/
                    foreach (var pageBodyContent in PageInitHelper <GlobalNCSearchPageFactory> .PageInit.PageBodyContent)
                    {
                        string pageBodyContentText = pageBodyContent.Text.Replace("\r\n", " ");
                        if (string.IsNullOrEmpty(pageBodyContentText) || string.IsNullOrWhiteSpace(pageBodyContentText))
                        {
                            continue;
                        }
                        wholePageTxt.Append(pageBodyContentText + " ");
                    }
                    Assert.IsTrue(wholePageTxt.ToString().ToLower().Contains(searchContent.ToLower()), " Expected page is " + searchContent + " but getting wrong page " + BrowserInit.Driver.Title);
                    break;
                }
                else if (articleType.Contains(caseType.ToLower()) && articleType.Contains(UiConstantHelper.Knowledgebase))
                {
                    BrowserInit.Driver.FindElement(By.XPath("//ul[contains(@class,'article-list')]/li[" + selectedArticle + "]/p/a[1]")).Click();
                    new WebDriverWait(BrowserInit.Driver, TimeSpan.FromSeconds(200)).Until(driver1 => ((IJavaScriptExecutor)BrowserInit.Driver).ExecuteScript("return document.readyState").Equals("complete"));
                    PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode();

                    //Validate the sub article knowledgebase page
                    if (PageInitHelper <GlobalNCSearchPageFactory> .PageInit.ArticleHeader.GetAttribute("id").Contains("CategoryInfoDisplayControl1"))
                    {
                        BrowserInit.Driver.Navigate().Back();
                        continue;
                    }
                    wholePageTxt.Append(PageInitHelper <GlobalNCSearchPageFactory> .PageInit.ArticleBodyContent.Text);
                    Assert.IsTrue(wholePageTxt.ToString().Replace("\r\n", " ").ToLower().Contains(searchContent.ToLower()), " Expected knowledgebase article page is " + searchContent + " but getting wrong page " + BrowserInit.Driver.Title);
                    break;
                }
            }
            /* Searching article is not present in the current page. Throw, Inconslusive exception*/
            if (selectedArticle > knowledgebaseArticleCount)
            {
                throw new InconclusiveException("User Exception : Insufficient " + searchContent + " article avaliable in the selected page");
            }
        }