Ejemplo n.º 1
0
        public static void DeletePermissions()
        {
            GridHelper.GridId = "entityRolesDetailsGrid";
            IList <IWebElement> tableRows = GridHelper.GetGridRows();

            var rows = tableRows.Count;

            for (int i = 0; i < rows; i++)
            {
                var rowBtns = tableRows[0].FindElements(By.TagName("a"));
                rowBtns[1].Click();

                WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(3);
                var dialog = WaitHelper.WaitToConfrimWindow();
                WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(10);

                var btnOk = dialog.FindElement(By.XPath("//button[contains(text(),'אישור')]"));

                btnOk.Click();
                Thread.Sleep(500);

                tableRows = GridHelper.GetGridRows();
            }

            if (tableRows.Count > 0)
            {
                Assert.Fail("Fail to DeleteRols for Entity : " + GridHelper.RowId);
            }
        }
Ejemplo n.º 2
0
 public static void CreateNewClick()
 {
     WaitHelper.WaitUntilTableIsVisible(GridId);
     WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id='" + GridId + "']/div[1]/a")));
     SeleniumDriver.driver.FindElement(By.XPath("//*[@id='" + GridId + "']/div[1]/a")).Click();
     WaitHelper.WaitToFinishloading();
 }
Ejemplo n.º 3
0
        public static void RefreshPage()
        {
            SeleniumDriver.driver.Navigate().Refresh();

            AdminPageHelper.AdminButtonClick();

            AdminPageHelper.SwitchToIframeInContainerId(IframeInContainerId);

            GoToActiveTab();

            WaitHelper.WaitUntilTableIsVisible(GridId);

            if (!string.IsNullOrWhiteSpace(DropDownTaxonomyName))
            {
                DropDownTaxonomyClick();

                IList <IWebElement> containers = DropDownGetContainers();

                IList <IWebElement> optionslist = containers[containers.Count - 1].FindElements(By.TagName("li"));

                IWebElement option = optionslist[DropDownTaxonomyValue];

                WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(option));

                option.Click();

                WaitHelper.WaitToFinishloading();
            }
        }
Ejemplo n.º 4
0
        public static IWebElement FindRow()
        {
            WaitHelper.WaitToFinishloading();

            tableRows = GetGridRows();

            foreach (IWebElement row in tableRows)
            {
                RowTD = row.FindElements(By.TagName("td"));

                var rowTdText = string.Empty;

                if (UpdateIdColumn)
                {
                    rowTdText = RowTD[ColumnsToEdit[0].ColumnNum].Text;
                }
                else
                {
                    if (ColumnsToEdit != null)
                    {
                        rowTdText = RowTD[ColumnsToEdit[1].ColumnNum].Text;
                    }
                    else
                    {
                        rowTdText = RowTD[0].Text;
                    }
                }
                if (rowTdText.Equals(RowId))
                {
                    return(row);
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        public static void DialogWindowBtnClick()
        {
            WaitHelper.WaitToDialogWindow();

            SeleniumDriver.driver.FindElement(By.XPath("//button")).Click();

            WaitHelper.WaitToFinishloading();
        }
Ejemplo n.º 6
0
        public static void BtnClick(string type)
        {
            var buttons = GetRowButtons(RowId);

            WaitHelper.WaitToFinishloading();
            if (type == "UpdateNewRow")
            {
                buttons = GetRowButtons(RowId, true);
            }

            if (buttons != null)
            {
                switch (type)
                {
                case "Edit":
                    WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(buttons[0]));
                    buttons[0].Click();
                    break;

                case "Update":
                    WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(buttons[0]));
                    buttons[0].Click();
                    break;

                case "UpdateNewRow":
                    WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(buttons[0]));
                    buttons[0].Click();
                    break;

                case "Cancel":
                    var td = RowTD.Where(x => x.Text.Contains("בטל עריכה")).FirstOrDefault();

                    if (td != null)
                    {
                        Thread.Sleep(100);
                        td.Click();
                    }
                    break;

                case "Delete":
                    td = RowTD.Where(x => x.Text.Contains("מחק")).FirstOrDefault();

                    if (td != null)
                    {
                        Thread.Sleep(100);
                        td.Click();
                    }
                    break;

                default:
                    break;
                }
            }

            WaitHelper.WaitToFinishloading();
        }
Ejemplo n.º 7
0
        public static IList <IWebElement> GetGridRows()
        {
            WaitHelper.WaitUntilTableIsVisible(GridId);

            var grid  = SeleniumDriver.driver.FindElement(By.Id(GridId));
            var table = grid.FindElement(By.TagName("tbody"));

            tableRows = table.FindElements(By.TagName("tr"));
            return(tableRows);
        }
Ejemplo n.º 8
0
        public static void AdminButtonClick()
        {
            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("xms-reports-buttons")));
            var adminBtns = SeleniumDriver.driver.FindElement(By.ClassName("xms-reports-buttons"));
            var adminBtn  = adminBtns.FindElement(By.ClassName("xms-reports-admin-button"));

            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(adminBtn));
            adminBtn.Click();

            WaitHelper.WaitUntilModelIsVisible();
        }
Ejemplo n.º 9
0
        public static void SetReporsForRole()
        {
            GridHelper.GridId = "entityRolesDetailsGrid";
            var tableRows = GridHelper.GetGridRows();


            foreach (var row in tableRows)
            {
                var rowBtns = row.FindElements(By.TagName("a"));

                try
                {
                    if (row.Text.Contains("דוחות"))
                    {
                        var reportsBtn = rowBtns[2];

                        reportsBtn.Click();

                        WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("close-button")));
                        Thread.Sleep(500);
                        var window = SeleniumDriver.driver.FindElement(By.XPath("/html/body/div[4]"));

                        var taxnomyDropDown = SeleniumDriver.driver.FindElement(By.ClassName("k-dropdown"));

                        GridHelper.GridId = "entityRolesDetailsGrid_ReportsWindow_reportsGrid";

                        tableRows           = GridHelper.GetGridRows();
                        PermissionsToReport = tableRows[0].Text;

                        var input = tableRows[0].FindElement(By.TagName("input"));
                        input.Click();

                        var saveBtn = window.FindElement(By.ClassName(" k-grid-save-changes"));
                        saveBtn.Click();

                        WaitHelper.WaitToDialogWindow();
                        SeleniumDriver.driver.FindElement(By.XPath("//button")).Click();
                        Thread.Sleep(500);

                        WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("close-button")));
                        var closeBtn = window.FindElement(By.ClassName("close-button"));
                        closeBtn.Click();
                        Thread.Sleep(500);
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
        }
Ejemplo n.º 10
0
        public static IList <IWebElement> GetRowButtons(string rowId, bool getFirstRowButtns = false)
        {
            WaitHelper.WaitToFinishloading();

            tableRows = GetGridRows();

            foreach (IWebElement row in tableRows)
            {
                RowTD = row.FindElements(By.TagName("td"));
                var rowTdText = string.Empty;

                if (rowTdText.Contains("מחק"))
                {
                    rowTdText = RowTD[RowTD.Count - 1].Text;
                }

                if (ColumnsToEdit != null)
                {
                    if (ColumnsToEdit.Count > 1)
                    {
                        rowTdText = RowTD[ColumnsToEdit[1].ColumnNum].Text;
                    }
                }
                else
                {
                    rowTdText = RowTD[0].Text;
                }

                IList <IWebElement> buttons = row.FindElements(By.TagName("a"));
                if (UpdateIdColumn)
                {
                    rowTdText = RowTD[ColumnsToEdit[0].ColumnNum].Text;
                }

                if (getFirstRowButtns)
                {
                    return(buttons);
                }
                if (rowTdText.Equals("יש להכניס מזהה ייחודי") ||
                    rowTdText.Equals("שדה חובה"))
                {
                    return(buttons);
                }
                if (rowTdText.Equals(rowId) ||
                    rowTdText.Equals(string.Empty))
                {
                    return(buttons);
                }
            }
            return(null);
        }
Ejemplo n.º 11
0
        public static void AddRoleThatExsistinEntity(int role)
        {
            AddEntity(role);
            try
            {
                WaitHelper.WaitToDialogWindow();

                SeleniumDriver.driver.FindElement(By.XPath("//button")).Click();
                Thread.Sleep(500);
            }
            catch (Exception)
            {
                Assert.Fail("AddRoleThatExsistinEntity fail");
            }
        }
Ejemplo n.º 12
0
        public static void DeleteTemplet()
        {
            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("xms-reports-filter-period-type")));
            var container = SeleniumDriver.driver.FindElements(By.ClassName("cards-container"));

            var buttonadmin = container[0].FindElements(By.ClassName("card-button-admin"));

            buttonadmin[0].Click();
            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.Id("report-admin-modal")));

            AdminPageHelper.SwitchToIframeInContainerId("report-admin-modal");

            GridHelper.GridId = "templatesGrid";
            GridHelper.RowId  = "test";
            var row = GridHelper.GetRow();

            GridHelper.BtnClick("Delete");
            GridHelper.ConfrimButtonClick(true);

            var dialog = WaitHelper.WaitToConfrimWindow();
            var btnOk  = dialog.FindElement(By.XPath("//button[contains(text(),'אישור')]"));

            btnOk.Click();

            AdminPageHelper.SwitchToMainPage();
            SeleniumDriver.driver.Navigate().Refresh();
            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("xms-reports-filter-period-type")));
            container = SeleniumDriver.driver.FindElements(By.ClassName("cards-container"));

            buttonadmin = container[0].FindElements(By.ClassName("card-button-admin"));

            buttonadmin[0].Click();
            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.Id("report-admin-modal")));

            AdminPageHelper.SwitchToIframeInContainerId("report-admin-modal");

            row = GridHelper.GetRow();

            if (row != null)
            {
                Assert.Fail("Fail to delete templet");
            }
            AdminPageHelper.SwitchToMainPage();
            SeleniumDriver.driver.Navigate().Refresh();
        }
Ejemplo n.º 13
0
        public static void SelectValueDropDownList(DropDownsToEdit dropDown)
        {
            tableRows = GetGridRows();

            foreach (IWebElement row in tableRows)
            {
                RowTD = row.FindElements(By.TagName("td"));
                WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("k-select")));
                IWebElement select = RowTD[dropDown.ColumnNum].FindElement(By.ClassName("k-select"));
                select.Click();

                IList <IWebElement> containers = DropDownGetContainers();


                IWebElement list = containers[dropDown.NumOfDropDownOnGrid].FindElement(By.TagName("ul"));

                WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(list));

                DropDownListValues = list.FindElements(By.TagName("li"));

                SetDropDownListTextValuesFromDropDownListValues();

                IWebElement option;

                if (dropDown.ContainsEmptyValue)
                {
                    option = DropDownListValues[dropDown.selectedValue];

                    WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(option));

                    option.Click();
                }
                else
                {
                    option = DropDownListValues[dropDown.selectedValue];

                    WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(option));

                    option.Click();
                }
                break;
            }
            WaitHelper.WaitToFinishloading();
        }
Ejemplo n.º 14
0
        public static void ConfrimButtonClick(bool btnConfrim)
        {
            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(3);
            var dialog = WaitHelper.WaitToConfrimWindow();

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(10);

            var btnOk     = dialog.FindElement(By.XPath("//button[contains(text(),'אישור')]"));
            var btnCancel = dialog.FindElement(By.XPath("//button[contains(text(),'ביטול')]"));

            if (btnConfrim)
            {
                btnOk.Click();
            }
            else
            {
                btnCancel.Click();
            }
            WaitHelper.WaitToFinishloading();
        }
Ejemplo n.º 15
0
        public static void UploadEditedExcelReport()
        {
            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("xms-reports-filter-period-type")));

            var container = SeleniumDriver.driver.FindElements(By.ClassName("cards-container"));

            var    cardcontent = container[0].FindElement(By.ClassName("card-content"));
            var    cardname    = "d" + container[0].FindElement(By.ClassName("card-name")).Text;
            string path        = Environment.GetEnvironmentVariable("USERPROFILE") + "\\Downloads\\" + cardname + ".xlsm";

            path = UpdateReportExcel(cardname);

            cardcontent.FindElement(By.Id("unique1")).SendKeys(path);

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(20);

            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));

            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.Id("validation-messages-modal")));

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(10);
            var validationmessages = SeleniumDriver.driver.FindElement(By.Id("validation-messages-modal"));

            validationmessages.FindElement(By.ClassName("button")).Click();
            Thread.Sleep(500);
            var status = cardcontent.FindElement(By.ClassName("card-xbrl-status"));

            if (!status.Text.Contains("דיווח שגוי"))
            {
                Assert.Fail("card-xbrl-status not change after excel errors ");
            }

            var cardlastupdatedate = cardcontent.FindElement(By.ClassName("card-last-update-date"));

            if (cardlastupdatedate.Text != DateTime.Now.ToString("dd/MM/yyyy"))
            {
                Assert.Fail("card-last-update-date not updated after update");
            }
            var cardlastupdatetime = cardcontent.FindElement(By.ClassName("card-last-update-time"));

            path = Environment.GetEnvironmentVariable("USERPROFILE") + "\\Downloads\\" + cardname + ".xlsm";

            cardcontent.FindElement(By.Id("unique1")).SendKeys(path);
            Thread.Sleep(500);
            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(20);
            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));
            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(10);

            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("card-xbrl-status")));

            status = cardcontent.FindElement(By.ClassName("card-xbrl-status"));
            if (!status.Text.Contains("תקין"))
            {
                Assert.Fail("card-xbrl-status not change after excel errors ");
            }
            path = Environment.GetEnvironmentVariable("USERPROFILE") + "\\Downloads\\testing.xlsx";

            cardcontent.FindElement(By.Id("unique1")).SendKeys(path);

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(20);
            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));

            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("xms-reports-filter-period-type")));

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(3);
            var dialog = WaitHelper.WaitToConfrimWindow();

            WaitHelper.Wait.Timeout = TimeSpan.FromSeconds(10);

            var btnOk = dialog.FindElement(By.ClassName("swal2-confirm"));

            btnOk.Click();
            Thread.Sleep(500);
            var lastupdates = cardcontent.FindElement(By.ClassName("card-last-update-log"));

            lastupdates.Click();
            Thread.Sleep(500);
            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));
            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.Id("log-modal")));
            var logmodal = SeleniumDriver.driver.FindElement(By.Id("log-modal"));

            var table = logmodal.FindElement(By.TagName("tbody"));
            var rows  = table.FindElements(By.TagName("tr"));

            var td = rows[0].FindElements(By.TagName("td"));

            if (td[0].Text != DateTime.Now.ToString("dd/MM/yyyy"))
            {
                Assert.Fail("testing  Last reports updates failed");
            }

            if (td[3].Text != "תקין")
            {
                Assert.Fail("testing  Last reports updates failed");
            }

            var td1 = rows[1].FindElements(By.TagName("td"));

            if (td1[0].Text != DateTime.Now.ToString("dd/MM/yyyy"))
            {
                Assert.Fail("testing  Last reports updates failed");
            }
            if (td1[3].Text != "דיווח שגוי")
            {
                Assert.Fail("testing  Last reports updates failed");
            }

            var index         = rows.Count - 1;
            var name          = container[0].FindElement(By.ClassName("card-name")).Text + "." + index;
            var downloadexcel = td[4].FindElement(By.ClassName("download-xbrl-xls-button"));

            downloadexcel.Click();
            Thread.Sleep(500);
            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));
            if (!CheckFileDownloaded(name))
            {
                Assert.Fail("Can not download a version of a report from the last Updates window");
            }

            SeleniumDriver.driver.Navigate().Refresh();
        }
Ejemplo n.º 16
0
        public static void DownloadEmptyTempletAndUpdate()
        {
            WaitHelper.Wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("xms-reports-filter-period-type")));
            var container = SeleniumDriver.driver.FindElements(By.ClassName("cards-container"));

            var buttonadmin = container[0].FindElements(By.ClassName("card-button-admin"));
            var cardcontent = container[0].FindElement(By.ClassName("card-content"));
            var cardname    = "d" + container[0].FindElement(By.ClassName("card-name")).Text;
            var cardbuttons = cardcontent.FindElements(By.ClassName("btn-group"));
            var dropdown    = cardbuttons[1].FindElement(By.ClassName("dropdown-toggle"));

            dropdown.Click();

            var dropdownmenu = cardbuttons[1].FindElement(By.ClassName("dropdown-menu"));

            var emptyTemplete = dropdownmenu.FindElements(By.XPath("//*[contains(text(), 'תבנית ריקה')]"));

            emptyTemplete[0].Click();
            Thread.Sleep(3000);
            WaitHelper.Wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("loading-message")));
            if (!CheckFileDownloaded(cardname))
            {
                Assert.Fail("Fail to Download Empty Templet");
            }

            buttonadmin[0].Click();

            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.Id("report-admin-modal")));

            AdminPageHelper.SwitchToIframeInContainerId("report-admin-modal");

            GridHelper.GridId = "templatesGrid";
            GridHelper.CreateNewClick();

            WaitHelper.Wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("/html/body/div[5]")));
            var windowNewTemplete = SeleniumDriver.driver.FindElement(By.XPath("/html/body/div[5]"));

            var description = windowNewTemplete.FindElement(By.Id("Description"));

            description.SendKeys("test");
            string path = Environment.GetEnvironmentVariable("USERPROFILE") + "\\Downloads\\" + cardname + ".xlsm";

            windowNewTemplete.FindElement(By.Id("templateUpload")).SendKeys(path);

            var updatebtn = windowNewTemplete.FindElement(By.ClassName("k-grid-update"));

            Thread.Sleep(500);
            updatebtn.Click();

            var dialog = WaitHelper.WaitToConfrimWindow();
            var btnOk  = dialog.FindElement(By.XPath("//button[contains(text(),'אישור')]"));

            btnOk.Click();
            GridHelper.RowId = "test";
            if (!GridHelper.IsRowExists(true))
            {
                Assert.Fail("EmptyTemplet and not updated");
            }

            AdminPageHelper.SwitchToMainPage();
            SeleniumDriver.driver.Navigate().Refresh();
        }