public void AddLossesTest(string lossName, string fileFormat, string delimiter, bool isTypeShared = true)
        {
            var menu = new MenuPage(driver);

            var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10000));

            menu.DataMenuLocator.ClickEx(driver);

            menu.LossesAddMenuLocator.Click();

            var lossesAddPage = new LossesAddPage(driver);

            lossesAddPage.SelectDatasetButtonLocator.Click();

            lossesAddPage.SelectDataset(datasetDescription);

            Assert.AreEqual(lossesAddPage.SelectDatasetButtonLocator.Text, datasetDescription);

            UploadLosses(lossName, fileFormat, delimiter, driver);

            if (!isTypeShared)
            {
                lossesAddPage.CarrierTypeButtonLocator.ClickEx(driver);
                lossesAddPage.ClientTypeLocator.Click();
                Thread.Sleep(500);

                lossesAddPage.SelectClient("Luxoft");
            }

            if (lossName.Contains("AdminLuxoftExport"))
            {
                lossesAddPage.SelectSharedClient("Luxoft", true);
            }

            if (lossName.Contains("AdminSharedLuxoft"))
            {
                lossesAddPage.SelectSharedClient("Luxoft");
            }

            wait.Until(ExpectedConditions.ElementToBeClickable(lossesAddPage.StartButtonLocator));

            lossesAddPage.ScrollToStartButton();

            lossesAddPage.StartButtonLocator.Click();

            wait.Until(ExpectedConditions.ElementToBeClickable(lossesAddPage.ConfirmAddRatesButtonLocator)).Click();

            Utils.WaitUntilLoadingDisappears(driver, secondtToWait: 500);

            var dataProcessingStatus = new DataProcessingStatusPage(driver);

            Utils.WaitUntilLoadingDisappears(driver);

            dataProcessingStatus.CheckRefreshRateToMinimum();

            int row = dataProcessingStatus.DatasetRow(datasetDescription);

            wait.Until(ExpectedConditions.InvisibilityOfElementWithText(By.XPath($"//*[@id='admin-table-office']//tr[{row + 1}]/td[6]"), "In queue"));

            wait.Until(ExpectedConditions.InvisibilityOfElementWithText(By.XPath($"//*[@id='admin-table-office']//tr[{row + 1}]/td[6]"), "In progress"));

            Assert.AreEqual("Completed successfully", dataProcessingStatus.Status[row].Text, "Status is not Completed successfully");
        }
Esempio n. 2
0
        public void AddLossesByAdminTest(string type, string datasetDifference, string lossName, bool isTypeShared, bool isLuxoftLoss)
        {
            loginPage.LoginToApplication();

            var menu = new MenuPage(driver);

            var datasetName = $"{DatasetUserDescription(type)} {datasetDifference}";

            menu.DataMenuLocator.ClickEx(driver);

            menu.LossesAddMenuLocator.Click();

            var lossesAddPage = new LossesAddPage(driver);

            lossesAddPage.SelectDatasetButtonLocator.Click();

            lossesAddPage.SelectDataset(datasetName);

            Assert.AreEqual(lossesAddPage.SelectDatasetButtonLocator.Text, datasetName);

            UploadLosses(type, lossName, driver);

            if (!isTypeShared)
            {
                lossesAddPage.CarrierTypeButtonLocator.ClickEx(driver);
                lossesAddPage.ClientTypeLocator.Click();
                Thread.Sleep(500);
                if (isLuxoftLoss)
                {
                    lossesAddPage.SelectClient("Luxoft");
                }
                else
                {
                    lossesAddPage.SelectClient("Test");
                }
            }

            wait.Until(ExpectedConditions.ElementToBeClickable(lossesAddPage.StartButtonLocator));

            lossesAddPage.ScrollToStartButton();

            lossesAddPage.StartButtonLocator.Click();

            wait.Until(ExpectedConditions.ElementToBeClickable(lossesAddPage.ConfirmAddRatesButtonLocator)).Click();

            Utils.WaitUntilLoadingDisappears(driver, secondtToWait: 500);

            var dataProcessingStatus = new DataProcessingStatusPage(driver);

            Utils.WaitUntilLoadingDisappears(driver);

            dataProcessingStatus.CheckRefreshRateToMinimum();

            wait.Until(ExpectedConditions.InvisibilityOfElementWithText(By.XPath($"//*[@id='admin-table-office']//tr[1]/td[6]"), "In queue"));

            wait.Until(ExpectedConditions.InvisibilityOfElementWithText(By.XPath($"//*[@id='admin-table-office']//tr[1]/td[6]"), "In progress"));

            Utils.WaitBeforeAssert(driver);

            Assert.AreEqual("Completed successfully", dataProcessingStatus.Status[0].Text, "Status is not Completed successfully");
        }