Exemplo n.º 1
0
        /// <summary>
        /// Export Keys
        /// </summary>
        /// <param name="mainWindow"></param>
        public static void ReExportKeys(MainWindow mainWindow, string WindowTitle)
        {
            mainWindow.Ribbon.ExportButton.Click();
            ExportKeyWizard exportWindow = new ExportKeyWizard(mainWindow.MainElement, WindowTitle);
            TextLog.LogMessage("Loaded Export Window " + mainWindow.Title);
            Thread.Sleep(1000);
            bool resultCell = false;
            bool resultPath = false;
            bool resultQuantity = false;
            exportWindow.RexportKeys.Click();
            Thread.Sleep(1000);

            exportWindow.NextButton.Click();

            //Set value

            if (exportWindow.DataGridReExport.RowCount > 0)
            {
                TextLog.LogMessage("There are [" + exportWindow.DataGridReExport.RowCount.ToString() + "] keys in the DataGrid ReExport.");
                string expectIndex = ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Quantity"];

                int index = Convert.ToInt32(expectIndex);
                if (index > exportWindow.DataGridReExport.RowCount)
                {
                    index = exportWindow.DataGridReExport.RowCount;
                    expectIndex = index.ToString();
                }
                exportWindow.RdbtnReExport.Click(--index);
                Thread.Sleep(600);
                string ExpectQuantity = exportWindow.DataGridReExport.GetValue(index, 3);
                string ExpectPath = exportWindow.Path.Text;
                TextLog.LogMessage("Get Expect Value from DataGrid : [" + ExpectQuantity + "] \n " + ExpectPath);
                exportWindow.ViewButton.Click();
                Thread.Sleep(1000);
                string ExpectCell = exportWindow.ExportView.DataGridViewFile.GetValue(0, 1);
                string ActualQuantity1 = exportWindow.ExportView.DataGridViewFile.RowCount.ToString();
                exportWindow.ExportView.CloseBtn.Click();
                exportWindow.OKButton.Click();

                Thread.Sleep(500);
                ProgressBarisFinish(exportWindow.ProgressBar, 3);
                string ActualCell = exportWindow.DataGridSummary.GetValue(0, 1);
                string ActualQuantity2 = exportWindow.DataGridSummary.RowCount.ToString();
                string ActualPath = exportWindow.TextBoxFileName.Text;
                TextLog.LogMessage("Get Actual Value from DataGrid : [View: " + ActualQuantity1 + " and Summary: " + ActualQuantity2 + "] \n " + ActualPath);
                // ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Path"]

                resultCell = Helper.CompareTwoStr(ExpectCell, ActualCell);
                resultPath = Helper.CompareTwoStr(ExpectPath, ActualPath);
                resultQuantity = Helper.CompareTwoStr(ExpectQuantity, ActualQuantity2);
                Thread.Sleep(600);
                exportWindow.CloseButton.Click();
            }
            else
            {
                TextLog.LogMessage("There not available key in the DataGridByQuantity!");
                Helper.CloseApp(exportWindow.MainElement);
            }
            bool result = resultCell && resultPath && resultQuantity == true ? true : false;
            Verification.AssertKMTResponse(result, ReaderXML.CurrentCase + "Test case ");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Export Keys
        /// </summary>
        /// <param name="mainWindow"></param>
        public static void ExportKeys(MainWindow mainWindow, string WindowTitle, exportType type, bool isEncrypt)
        {
            mainWindow.Ribbon.ExportButton.Click();
            ExportKeyWizard exportWindow = new ExportKeyWizard(mainWindow.MainElement, WindowTitle);
            TextLog.LogMessage("Loaded Export Window " + mainWindow.Title);
            Thread.Sleep(1000);
            bool resultCell = false;
            bool resultPath = false;
            if (type == exportType.ExportCBR)
            {
                exportWindow.ExportCBR.Click();
            }
            else
            {
                exportWindow.ExportKeys.Click();
            }
            Thread.Sleep(1000);
            exportWindow.NextButton.Click();

            //Set value
            exportWindow.Tab.SelectItem(0);
            if (exportWindow.DataGridByQuantity.GridPattern.Current.RowCount > 0)
            {
                TextLog.LogMessage("There are [" + exportWindow.DataGridByQuantity.RowCount.ToString() + "] keys in the DataGridByQuantity.");
                string expectCBRNum = ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Quantity"];
                exportWindow.DataGridByQuantity.SetValue(0, expectCBRNum);
                Thread.Sleep(1000);
                exportWindow.Tab.SelectItem(1);
                if (exportWindow.DataGridByID.GridPattern.Current.RowCount > 0)
                {
                    int CBRNum = Convert.ToInt32(expectCBRNum);
                    if (CBRNum > exportWindow.DataGridByID.RowCount)
                    {
                        CBRNum = exportWindow.DataGridByID.RowCount;
                        expectCBRNum = CBRNum.ToString();
                    }
                    for (int i = 1; i < CBRNum + 1; i++)
                    {
                        exportWindow.DataGridByID.CheckItem(i);
                    }

                    Thread.Sleep(1000);
                    TextLog.LogMessage("IsEncrypted the Export file.");
                    //Non-Encrypetd
                    bool IsChect = exportWindow.Encrypted.GetStatus() == "On" ? true : false;
                    if (!IsChect == isEncrypt)
                    {
                        exportWindow.Encrypted.Click();
                    }

                    string ExpectCell = exportWindow.DataGridByID.GetValue(0, 2);
                    string ExpectPath = exportWindow.Path.Text;
                    TextLog.LogMessage("Get Expect Value from DataGrid : [" + ExpectCell + "] \n " + ExpectPath);

                    exportWindow.OKButton.Click();
                    Thread.Sleep(1000);
                    if (!isEncrypt)
                    {
                        exportWindow.MessageboxWarning.ClickOK("1");
                        Thread.Sleep(1000);
                        exportWindow.OKButton.Click();
                    }
                    Thread.Sleep(500);
                    ProgressBarisFinish(exportWindow.ProgressBar, 3);
                    Thread.Sleep(500);
                    string ActualCell = exportWindow.DataGridSummary.GetValue(0, 1);
                    string ActualPath = exportWindow.TextBoxFileName.Text;
                    TextLog.LogMessage("Get Actual Value from DataGrid : [" + ActualCell + "] \n " + ActualPath);

                    ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Path"] = ActualPath;
                    ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Key"] = ActualCell;
                    resultCell = Helper.CompareTwoStr(ExpectCell, ActualCell);
                    resultPath = Helper.CompareTwoStr(ExpectPath, ActualPath);
                    Thread.Sleep(1000);
                    exportWindow.CloseButton.Click();
                }
                else
                {
                    TextLog.LogMessage("There not available key in the DataGridByID!");
                    Helper.CloseApp(exportWindow.MainElement);
                }

            }
            else
            {
                TextLog.LogMessage("There not available key in the DataGridByQuantity!");
                Helper.CloseApp(exportWindow.MainElement);
            }
            bool result = resultCell && resultPath == true ? true : false;
            Verification.AssertKMTResponse(result, ReaderXML.CurrentCase + "Test case ");
        }