public void WaitForInventoryInSearchResult(DateTime createdTime, CatalogStatus catalogStatus)
        {
            DateTime      lastStatusDate;
            double        timeOutInSecs = CatalogTimeOuts.CatalogSearchTimeOut.TotalSeconds;
            CatalogStatus status        = catalogStatus;

            while (timeOutInSecs > 0)
            {
                lastStatusDate = Convert.ToDateTime(CatalogsTable.GetCellValueForInventory(1, "Last Status Date"), System.Globalization.CultureInfo.InvariantCulture);
                if (CatalogsTable.GetCellValueForInventory(1, "Status") != null)
                {
                    status = UtilityMethods.ConvertToEnum <CatalogStatus>(CatalogsTable.GetCellValueForInventory(1, "Status"));
                }

                if (lastStatusDate.AddMinutes(1) > createdTime && (status == catalogStatus || status == CatalogStatus.Failed || status == CatalogStatus.FailedInstant))
                {
                    break;
                }
                else
                {
                    SearchRecordsLink.Click();
                    Thread.Sleep(TimeSpan.FromSeconds(5));
                    timeOutInSecs -= 5;
                }
            }
        }
 public void SearchCatalogs(Region region, string profileName, string identityName)
 {
     SelectOption(SelectRegionSpan, region.ConvertToString().ToUpper());
     SelectOption(SelectCustomerNameSpan, profileName.ToUpper());
     SelectOption(SelectIdentityNameSpan, identityName.ToUpper());
     SearchRecordsLink.Click();
     CatalogsTable.WaitForElementVisible(TimeSpan.FromSeconds(30));
 }
 public bool VerifyInventoryFeedCoulmnNames(string columnName)
 {
     try
     {
         List <string> columnNames = CatalogsTable.GetColumnNames();
         return(columnNames.Contains(columnName));
     }
     catch { }
     return(false);
 }
        public void WaitForCatalogInSearchResult(DateTime createdTime, CatalogStatus catalogStatus)
        {
            DateTime      lastStatusDate;
            double        timeOutInSecs = CatalogTimeOuts.CatalogSearchTimeOut.TotalSeconds;
            string        threadId      = string.Empty;
            CatalogStatus status        = catalogStatus;

            while (timeOutInSecs > 0)
            {
                lastStatusDate = Convert.ToDateTime(CatalogsTable.GetCellValue(1, "Last Status Date"), System.Globalization.CultureInfo.InvariantCulture);
                if (CatalogsTable.GetCellValue(1, "Status") != null)
                {
                    status = UtilityMethods.ConvertToEnum <CatalogStatus>(CatalogsTable.GetCellValue(1, "Status"));
                }

                if (lastStatusDate.AddMinutes(1) > createdTime)
                {
                    if (catalogStatus == CatalogStatus.Created && (status == CatalogStatus.Created || status == CatalogStatus.CreatedWarning || status == CatalogStatus.Failed))
                    {
                        break;
                    }
                    else if (catalogStatus == CatalogStatus.CreatedWarning && (status == CatalogStatus.Created || status == CatalogStatus.CreatedWarning || status == CatalogStatus.Failed))
                    {
                        break;
                    }
                    else if (catalogStatus == CatalogStatus.Published && (status == CatalogStatus.Published || status == CatalogStatus.PublishedWarning || status == CatalogStatus.Failed))
                    {
                        break;
                    }
                    else if (catalogStatus == CatalogStatus.CreatedInstant && (status == CatalogStatus.CreatedInstant || status == CatalogStatus.CreatedWarningInstant || status == CatalogStatus.FailedInstant))
                    {
                        break;
                    }
                    else if (catalogStatus == CatalogStatus.Failed && (status == CatalogStatus.Created || status == CatalogStatus.CreatedWarning || status == CatalogStatus.Failed))
                    {
                        break;
                    }
                    else if (catalogStatus == CatalogStatus.Failed && (status == CatalogStatus.Published || status == CatalogStatus.PublishedWarning || status == CatalogStatus.Failed))
                    {
                        break;
                    }
                }

                SearchRecordsLink.Click();
                Thread.Sleep(TimeSpan.FromSeconds(5));
                timeOutInSecs -= 5;
            }

            //threadId = CatalogsTable.GetCellValue(1, "Thread Id");
            //Console.WriteLine("Thread Id: " + threadId);
            //return threadId;
        }
        public void SearchInventoryRecords(Region region, string profileName = "", string identityName = "")
        {
            InventoryCheckbox.Click();
            SelectOption(SelectRegionSpan, region.ConvertToString().ToUpper());

            if (!string.IsNullOrEmpty(profileName))
            {
                SelectOption(SelectCustomerNameSpan, profileName.ToUpper());
            }

            if (!string.IsNullOrEmpty(identityName))
            {
                SelectOption(SelectIdentityNameSpan, identityName.ToUpper());
            }

            SearchRecordsLink.Click();
            CatalogsTable.WaitForElementVisible(TimeSpan.FromSeconds(30));
        }
        /// <summary>
        /// Use this method to know if the paging is enabled
        /// </summary>
        /// <returns></returns>
        public bool IsPagingEnabled()
        {
            try
            {
                var textInPagingSpan = CatalogsTable.FindElement(By.XPath("thead/tr[1]/td")).Text;

                //if (!PagingSpan.IsElementVisible())
                if (string.IsNullOrEmpty(textInPagingSpan) || !textInPagingSpan.Contains("Page of"))
                {
                    Console.WriteLine("Paging not enabled");
                    return(false);
                }
            }
            catch (NoSuchElementException)
            {
                Console.WriteLine("Paging not enabled");
                return(false);
            }

            return(true);
        }
 public string GetCatalogValue(int rowIndex, int colIndex)
 {
     return(CatalogsTable.FindElement(By.CssSelector("tr:nth-of-type(" + rowIndex + ")>td:nth-of-type(" + colIndex + ")")).Text.Trim());
 }
 public IWebElement GetInventoryDownloadButton(int rowIndex)
 {
     return(CatalogsTable.FindElement(By.CssSelector("tbody>tr:nth-of-type(" + rowIndex + ")>td[title=' download']>input[type='image'][ng-show='(Catalog.IsFeedGenerated)']")));
 }
 public IWebElement GetDownloadButton(int rowIndex)
 {
     return(CatalogsTable.FindElement(By.CssSelector("tbody>tr:nth-of-type(" + rowIndex + ")>td[title=' download']>input[type='image']")));
 }