Exemple #1
0
        public void SelectAProductAndClickOnAddCart(string productName)
        {
            wait.WaitUntilElementPresent(driver, HomeFeatureElements[0]);
            IWebElement element = null;

            foreach (var item in HomeFeatureElements)
            {
                string GetTextOfProduct = item.Text.Split('\n')[0].TrimEnd('\r');

                if (GetTextOfProduct.Equals(productName))
                {
                    element = item;
                    Console.WriteLine(item.Text);
                    break;
                }
            }

            if (element != null)
            {
                //string xpath = "//div[@class='product-image-container']//parent::div";
                //IWebElement productLi = this.driver
                IWebElement productLi = this.driver.FindElement(By.XPath("//li[@class='ajax_block_product col-xs-12 col-sm-4 col-md-3 first-in-line first-item-of-tablet-line first-item-of-mobile-line']"));
                commonUtils.ScrollToView(driver, element);
                commonUtils.MoveToElement(driver, productLi);
                IWebElement AddToCart = driver.FindElement(By.XPath("//a[@class='button ajax_add_to_cart_button btn btn-default']/span"));
                AddToCart.Click();
            }
        }
Exemple #2
0
        public ProjectSettingsPage GoToProjectLink(string url)
        {
            Waits.WaitUntilElementPresent(drv => SearchProjectTextBox);
            Uri ProjectURL = new Uri(url);

            Driver.Instance.Navigate().GoToUrl(ProjectURL);
            return(NewPage <ProjectSettingsPage>().LoadProject());
        }
Exemple #3
0
 public CalculationPage CancelActiveJob()
 {
     if (CancelJob != null)
     {
         LogHelpers.Write(string.Format("Cancel active job."));
         CancelJob.ClickAndWaitForAjax();
         Waits.WaitUntilElementPresent(drv => BeginCalculationButton);
     }
     return(this);
 }
Exemple #4
0
 public ReviewPage ExecuteReviewProcess()
 {
     Waits.WaitUntilElementPresent(drv => ReviewButton);
     LogHelpers.Write(string.Format("Click \"Review\" button."));
     ReviewButton.ClickJS();
     LogHelpers.Write(string.Format("Wait for \"Review process\" to finish..."));
     Waits.WaitUntilElementPresent(drv => ReviewProgress);
     Waits.WaitForProcessToFinish(drv => ReviewProgress);
     return(this);
 }
Exemple #5
0
        private void ConfirmChanges()
        {
            LogHelpers.Write(string.Format("Click \"Commit changes\" button."));
            CommitChangesButton.ClickAndWaitForAjax();
            Waits.WaitUntilElementPresent(drv => CommitChangesTextBox);

            LogHelpers.Write(string.Format("Write text on \"Commit changes\" text box."));
            CommitChangesTextBox.Type("Text to have this text box with data.");

            LogHelpers.Write(string.Format("Click \"Save comment\" button on \"Commit changes\" modal."));
            CommitChangesSaveCommentButton.ClickAndWaitForAjax();
            Waits.WaitUntilElementPresent(drv => ImportDataButton);
        }
Exemple #6
0
        public CalculationPage ExecuteCalculationForEYDS()
        {
            LogHelpers.Write(string.Format("Click \"Begin calculation\" button."));
            BeginCalculationButton.ClickJS();
            Waits.WaitUntilElementPresent(drv => ForceReRunContinueButton);

            LogHelpers.Write(string.Format("Click \"Force Re-Run\" button."));
            ForceReRunContinueButton.ClickAndWaitForAjax();
            Waits.WaitForProcessToFinish(drv => CalculationProgress);

            WaitForBackendCalcEnd();
            return(this);
        }
        public string DownloadReport()
        {
            WaitForReportGeneration();
            LogHelpers.Write(string.Format("Click \"Download Report\" button."));
            DownloadReportButton.ClickJS();
            Waits.WaitDownloadDocument();
            LogHelpers.Write(string.Format("Click \"Close Queue\" button."));
            Waits.WaitUntilElementPresent(drv => CloseQueueButton).ClickAndWaitForAjax();
            var directory = new DirectoryInfo(Settings.DownloadPath);
            var myFile    = directory.GetFiles().Where(f => !f.Attributes.HasFlag(FileAttributes.Hidden)).OrderByDescending(f => f.LastWriteTime).First();

            return(myFile.FullName);
        }
Exemple #8
0
        public CalculationPage GetCalculationProcessTime()
        {
            LogHelpers.Write(string.Format("Read \"Calculation process\" time."));
            Waits.WaitUntilElementPresent(drv => CalculationTimeElement);
            string elementValue  = CalculationTimeElement.Read();
            string replacedValue = elementValue.Replace("Time Elapsed : ", "");

            string[] timeValues = replacedValue.Split(':');
            if (timeValues.Length == 1)
            {
                CalculationProcessTime = new DateTime(1, 1, 1, 0, 0, int.Parse(timeValues[0]));
            }
            else
            {
                CalculationProcessTime = new DateTime(1, 1, 1, 1, int.Parse(timeValues[0]), int.Parse(timeValues[1]));
            }
            return(this);
        }
Exemple #9
0
        public ReviewPage GetReviewProcessTime()
        {
            LogHelpers.Write(string.Format("Get \"Review process\" time."));
            /*'02 min' '17 sec' there is a WebElement for each part of the time*/

            #region TODO: Need to check if Waits.WaitUntilElementPresent is enough
            //ISSUE: Random behavior => ReviewTimeElements are read by the framework but Read()
            //returns empty and "Data is not on valid a string format" error is displayed.
            //POSSIBLE REASON: When the browser is not maximized it returns empty indeed.
            //Not sure if that's the only reason.
            #endregion
            Waits.WaitUntilElementPresent(drv => ReviewTimeElements[0]);

            List <int> timeData = new List <int>();
            string     numberPartData;
            foreach (IWebElement item in ReviewTimeElements)
            {
                numberPartData = string.Empty;
                foreach (char chr in item.Read().ToCharArray())
                {
                    if (chr.IsANumber())
                    {
                        numberPartData += chr;
                    }
                }
                timeData.Add(Convert.ToInt32(numberPartData));
            }
            if (timeData.Count == 1)
            {
                ReviewProcessTime = new DateTime(1, 1, 1, 0, 0, timeData[0]);
            }
            else
            {
                ReviewProcessTime = new DateTime(1, 1, 1, 1, timeData[0], timeData[1]);
            }
            return(this);
        }
Exemple #10
0
 private void ActivateUpdateScreenMode()
 {
     LogHelpers.Write(string.Format("Perform double click on \"Regular Tax Book Set\" text box on \"Recoverable row\" to activate edit mode."));
     RegularTaxBookSetTextBoxGrossOrCostBasisRecoverableRow.DoubleClick();
     Waits.WaitUntilElementPresent(drv => CommitChangesButton);
 }