public void TestViewPostedBatchTransactionsAndAddBatch() { //This test adds a new batch, saves and posts it, then views it and then tries to add a new batch TFrmGLBatch frmBatch = new TFrmGLBatch(null); frmBatch.LedgerNumber = FLedgerNumber; frmBatch.Show(); // create a new batch and save ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); btnNewBatch.Click(); TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription"); txtDetailBatchDescription.Properties.Text = "Created by test TestExportGLBatch"; TabControlTester tabGLBatch = new TabControlTester("tabGLBatch"); // go to Journal tab tabGLBatch.SelectTab(1); ButtonTester btnNewJournal = new ButtonTester("ucoJournals.btnAdd"); btnNewJournal.Click(); // go to transaction tab tabGLBatch.SelectTab(2); ButtonTester btnNewTransaction = new ButtonTester("ucoTransactions.btnNew"); btnNewTransaction.Click(); TextBoxTester txtDetailNarrative = new TextBoxTester("txtDetailNarrative"); txtDetailNarrative.Properties.Text = "test"; TextBoxTester txtDetailReference = new TextBoxTester("txtDetailReference"); txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtDebitAmount = new TTxtCurrencyTextBoxTester("txtDebitAmount"); decimal Amount = 1111.44M; txtDebitAmount.Properties.NumberValueDecimal = Amount; TCmbAutoPopulatedTester cmbDetailAccountCode = new TCmbAutoPopulatedTester("cmbDetailAccountCode"); cmbDetailAccountCode.Properties.SetSelectedString("6000"); TCmbAutoPopulatedTester cmbDetailCostCentreCode = new TCmbAutoPopulatedTester("cmbDetailCostCentreCode"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); btnNewTransaction.Click(); txtDetailNarrative.Properties.Text = "test"; txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtCreditAmount = new TTxtCurrencyTextBoxTester("txtCreditAmount"); txtDebitAmount.Properties.NumberValueDecimal = 0; txtCreditAmount.Properties.Focus(); txtCreditAmount.Properties.NumberValueDecimal = Amount; cmbDetailAccountCode.Properties.SetSelectedString("0200"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); //ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave"); //btnSave.Click(); // post this batch ModalFormHandler = delegate(string name, IntPtr hWnd, Form form) { MessageBoxTester tester = new MessageBoxTester(hWnd); Assert.IsTrue(tester.Text.StartsWith( "Are you sure you want to post GL batch"), "Should start with 'are you sure you want to post GL batch', but is '" + tester.Text + "'"); // there is a second message box after posting, telling the user about success. // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler. ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2) { MessageBoxTester tester2 = new MessageBoxTester(hWnd2); Assert.AreEqual("Success", tester2.Title); tester2.SendCommand(MessageBoxTester.Command.Yes); }; tester.SendCommand(MessageBoxTester.Command.Yes); }; // and now try to create a new batch, bug https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=1058 // go to Batch tab tabGLBatch.SelectTab(0); ButtonTester btnPostBatch = new ButtonTester("ucoBatches.btnPostBatch"); btnPostBatch.Click(); //Make sure the grid is clear // TODO NUnit.Extensions.Forms.NoSuchControlException : rbtPosting RadioButtonTester rbtPosting = new RadioButtonTester("rbtPosting"); rbtPosting.Properties.Checked = true; //This will then select the first batch in the grid which needs to be posted RadioButtonTester rbtAll = new RadioButtonTester("rbtAll"); rbtAll.Properties.Checked = true; //TabControlTester tabGLBatch = new TabControlTester("tabGLBatch"); // go to Journal tab tabGLBatch.SelectTab(1); // go to Transaction Tab tabGLBatch.SelectTab(2); // go to Batch Tab tabGLBatch.SelectTab(0); //ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); btnNewBatch.Click(); }
public void TestCreateBatchAndPost() { TFrmGLBatch frmBatch = new TFrmGLBatch(null); frmBatch.LedgerNumber = FLedgerNumber; frmBatch.Show(); // create a new batch and save ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); btnNewBatch.Click(); TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription"); txtDetailBatchDescription.Properties.Text = "Created by test TestExportGLBatch"; TabControlTester tabGLBatch = new TabControlTester("tabGLBatch"); // go to Journal tab tabGLBatch.SelectTab(1); ButtonTester btnNewJournal = new ButtonTester("ucoJournals.btnAdd"); btnNewJournal.Click(); // go to transaction tab tabGLBatch.SelectTab(2); ButtonTester btnNewTransaction = new ButtonTester("ucoTransactions.btnNew"); btnNewTransaction.Click(); TextBoxTester txtDetailNarrative = new TextBoxTester("txtDetailNarrative"); txtDetailNarrative.Properties.Text = "test"; TextBoxTester txtDetailReference = new TextBoxTester("txtDetailReference"); txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtDebitAmount = new TTxtCurrencyTextBoxTester("txtDebitAmount"); txtDebitAmount.Properties.Focus(); decimal Amount = 1111.44M; txtDebitAmount.Properties.NumberValueDecimal = Amount; TCmbAutoPopulatedTester cmbDetailAccountCode = new TCmbAutoPopulatedTester("cmbDetailAccountCode"); cmbDetailAccountCode.Properties.SetSelectedString("6000"); TCmbAutoPopulatedTester cmbDetailCostCentreCode = new TCmbAutoPopulatedTester("cmbDetailCostCentreCode"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); btnNewTransaction.Click(); txtDetailNarrative.Properties.Text = "test"; txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtCreditAmount = new TTxtCurrencyTextBoxTester("txtCreditAmount"); txtDebitAmount.Properties.NumberValueDecimal = 0; txtCreditAmount.Properties.Focus(); txtCreditAmount.Properties.NumberValueDecimal = Amount; cmbDetailAccountCode.Properties.Focus(); // This will update the totals cmbDetailAccountCode.Properties.SetSelectedString("0200"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave"); btnSave.Click(); // go to Batch tab tabGLBatch.SelectTab(0); // post this batch ModalFormHandler = delegate(string name, IntPtr hWnd, Form form) { MessageBoxTester tester = new MessageBoxTester(hWnd); Assert.IsTrue(tester.Text.StartsWith( "Are you sure you want to post GL batch"), "Should start with 'are you sure you want to post GL batch', but is '" + tester.Text + "'"); // there is a second message box after posting, telling the user about success. // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler. ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2) { MessageBoxTester tester2 = new MessageBoxTester(hWnd2); Assert.AreEqual("Progress Dialog", tester2.Title); //Wait for it to close Thread.Sleep(1000); // there is a second message box after posting, telling the user about success. // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler. ModalFormHandler = delegate(string name3, IntPtr hWnd3, Form form3) { MessageBoxTester tester3 = new MessageBoxTester(hWnd3); Assert.AreEqual("Success", tester3.Title); tester3.SendCommand(MessageBoxTester.Command.Yes); }; }; tester.SendCommand(MessageBoxTester.Command.Yes); }; frmBatch.EnablePostingReport = false; ButtonTester btnPost = new ButtonTester("ucoBatches.btnPostBatch"); btnPost.Click(); // and now try to create a new batch, bug https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=1058 btnNewBatch.Click(); btnSave.Click(); frmBatch.Close(); }
// public ToolStripMenuItemTester mniFile; // public System.Windows.Forms.ToolStripMenuItem mniFileSave; // public System.Windows.Forms.ToolStripSeparator mniSeparator0; // public System.Windows.Forms.ToolStripMenuItem mniFilePrint; // public System.Windows.Forms.ToolStripSeparator mniSeparator1; // public System.Windows.Forms.ToolStripMenuItem mniClose; // public System.Windows.Forms.ToolStripMenuItem mniEdit; // public System.Windows.Forms.ToolStripMenuItem mniEditUndoCurrentField; // public System.Windows.Forms.ToolStripMenuItem mniEditUndoScreen; // public System.Windows.Forms.ToolStripSeparator mniSeparator2; // public System.Windows.Forms.ToolStripMenuItem mniEditFind; // public System.Windows.Forms.ToolStripMenuItem mniAccounts; // public System.Windows.Forms.ToolStripMenuItem mniAddNewAccount; // public System.Windows.Forms.ToolStripMenuItem mniDeleteUnusedAccount; // public System.Windows.Forms.ToolStripSeparator mniSeparator3; // public System.Windows.Forms.ToolStripMenuItem mniExportHierarchy; // public System.Windows.Forms.ToolStripMenuItem mniImportHierarchy; // public System.Windows.Forms.ToolStripMenuItem mniHelp; // public System.Windows.Forms.ToolStripMenuItem mniHelpPetraHelp; // public System.Windows.Forms.ToolStripSeparator mniSeparator4; // public System.Windows.Forms.ToolStripMenuItem mniHelpBugReport; // public System.Windows.Forms.ToolStripSeparator mniSeparator5; // public System.Windows.Forms.ToolStripMenuItem mniHelpAboutPetra; // public System.Windows.Forms.ToolStripMenuItem mniHelpDevelopmentTeam; // Contructor which initializes the acces to all the controls on the // Dialog /// <summary> /// ... /// </summary> public TFrmGLAccountHierarchyTester() { mainForm = new TFrmGLAccountHierarchy(null); trvAccounts = new TTrvTreeViewTester("trvAccounts", mainForm); txtDetailAccountCode = new TextBoxTester("txtDetailAccountCode", mainForm); cmbDetailAccountType = new TCmbAutoCompleteTester("cmbDetailAccountType", mainForm); txtDetailEngAccountCodeLongDesc = new TextBoxTester("txtDetailEngAccountCodeLongDesc", mainForm); txtDetailEngAccountCodeShortDesc = new TextBoxTester("txtDetailEngAccountCodeShortDesc", mainForm); txtDetailAccountCodeLongDesc = new TextBoxTester("txtDetailAccountCodeLongDesc", mainForm); txtDetailAccountCodeShortDesc = new TextBoxTester("txtDetailAccountCodeShortDesc", mainForm); cmbDetailValidCcCombo = new TCmbAutoCompleteTester("cmbDetailValidCcCombo", mainForm); chkDetailBankAccountFlag = new CheckBoxTester("chkDetailBankAccountFlag", mainForm); chkDetailAccountActiveFlag = new CheckBoxTester("chkDetailAccountActiveFlag", mainForm); tbbSave = new ToolStripButtonTester("tbbSave", mainForm); tbbAddNewAccount = new ToolStripButtonTester("tbbAddNewAccount", mainForm); tbbDeleteUnusedAccount = new ToolStripButtonTester("tbbDeleteUnusedAccount", mainForm); tbbExportHierarchy = new ToolStripButtonTester("tbbExportHierarchy", mainForm); tbbImportHierarchy = new ToolStripButtonTester("tbbImportHierarchy", mainForm); chkDetailForeignCurrencyFlag = new CheckBoxTester("chkDetailForeignCurrencyFlag", mainForm); cmbDetailForeignCurrencyCode = new TCmbAutoPopulatedTester("cmbDetailForeignCurrencyCode", mainForm); mniClose = new ToolStripMenuItemTester("mniClose", mainForm); }
public void TestViewPostedBatchTransactionsAndAddBatch() { //This test adds a new batch, saves and posts it, then views it and then tries to add a new batch TFrmGLBatch frmBatch = new TFrmGLBatch(null); frmBatch.LedgerNumber = FLedgerNumber; frmBatch.Show(); // create a new batch and save ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); btnNewBatch.Click(); TextBoxTester txtDetailBatchDescription = new TextBoxTester("txtDetailBatchDescription"); txtDetailBatchDescription.Properties.Text = "Created by test TestExportGLBatch"; TabControlTester tabGLBatch = new TabControlTester("tabGLBatch"); // go to Journal tab tabGLBatch.SelectTab(1); ButtonTester btnNewJournal = new ButtonTester("ucoJournals.btnAdd"); btnNewJournal.Click(); // go to transaction tab tabGLBatch.SelectTab(2); ButtonTester btnNewTransaction = new ButtonTester("ucoTransactions.btnNew"); btnNewTransaction.Click(); TextBoxTester txtDetailNarrative = new TextBoxTester("txtDetailNarrative"); txtDetailNarrative.Properties.Text = "test"; TextBoxTester txtDetailReference = new TextBoxTester("txtDetailReference"); txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtDebitAmount = new TTxtCurrencyTextBoxTester("txtDebitAmount"); decimal Amount = 1111.44M; txtDebitAmount.Properties.NumberValueDecimal = Amount; TCmbAutoPopulatedTester cmbDetailAccountCode = new TCmbAutoPopulatedTester("cmbDetailAccountCode"); cmbDetailAccountCode.Properties.SetSelectedString("6000"); TCmbAutoPopulatedTester cmbDetailCostCentreCode = new TCmbAutoPopulatedTester("cmbDetailCostCentreCode"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); btnNewTransaction.Click(); txtDetailNarrative.Properties.Text = "test"; txtDetailReference.Properties.Text = "test"; TTxtCurrencyTextBoxTester txtCreditAmount = new TTxtCurrencyTextBoxTester("txtCreditAmount"); txtDebitAmount.Properties.NumberValueDecimal = 0; txtCreditAmount.Properties.Focus(); txtCreditAmount.Properties.NumberValueDecimal = Amount; cmbDetailAccountCode.Properties.SetSelectedString("0200"); cmbDetailCostCentreCode.Properties.SetSelectedString(FLedgerNumber.ToString("00") + "00"); //ToolStripButtonTester btnSave = new ToolStripButtonTester("tbbSave"); //btnSave.Click(); // post this batch ModalFormHandler = delegate(string name, IntPtr hWnd, Form form) { MessageBoxTester tester = new MessageBoxTester(hWnd); Assert.IsTrue(tester.Text.StartsWith( "Are you sure you want to post batch"), "Should start with 'are you sure you want to post batch', but is '" + tester.Text + "'"); // there is a second message box after posting, telling the user about success. // because the ModalFormHandler is reset after handling the first message box, we need to set up a new handler. ModalFormHandler = delegate(string name2, IntPtr hWnd2, Form form2) { MessageBoxTester tester2 = new MessageBoxTester(hWnd2); Assert.AreEqual("Success", tester2.Title); tester2.SendCommand(MessageBoxTester.Command.Yes); }; tester.SendCommand(MessageBoxTester.Command.Yes); }; // and now try to create a new batch, bug https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=1058 // go to Batch tab tabGLBatch.SelectTab(0); ButtonTester btnPostBatch = new ButtonTester("ucoBatches.btnPostBatch"); btnPostBatch.Click(); //Make sure the grid is clear RadioButtonTester rbtPosting = new RadioButtonTester("rbtPosting"); rbtPosting.Properties.Checked = true; //This will then select the first batch in the grid which needs to be posted RadioButtonTester rbtAll = new RadioButtonTester("rbtAll"); rbtAll.Properties.Checked = true; //TabControlTester tabGLBatch = new TabControlTester("tabGLBatch"); // go to Journal tab tabGLBatch.SelectTab(1); // go to Transaction Tab tabGLBatch.SelectTab(2); // go to Batch Tab tabGLBatch.SelectTab(0); //ButtonTester btnNewBatch = new ButtonTester("ucoBatches.btnNew"); btnNewBatch.Click(); }
private TFrmGLCreateLedgerTester() { TFrmGLCreateLedgerDialog = new TFrmGLCreateLedgerDialog(null); nudLedgerNumber = new NumericUpDownTester("nudLedgerNumber", TFrmGLCreateLedgerDialog); txtLedgerName = new TextBoxTester("txtLedgerName", TFrmGLCreateLedgerDialog); cmbCountryCode = new TCmbAutoPopulatedTester("cmbCountryCode", TFrmGLCreateLedgerDialog); cmbBaseCurrency = new TCmbAutoPopulatedTester("cmbBaseCurrency", TFrmGLCreateLedgerDialog); cmbIntlCurrency = new TCmbAutoPopulatedTester("cmbIntlCurrency", TFrmGLCreateLedgerDialog); // TextBoxTester dtpCalendarStartDate = new TextBoxTester("dtpCalendarStartDate", TFrmGLCreateLedgerDialog); nudNumberOfPeriods = new NumericUpDownTester("nudNumberOfPeriods", TFrmGLCreateLedgerDialog); nudCurrentPeriod = new NumericUpDownTester("nudCurrentPeriod", TFrmGLCreateLedgerDialog); nudNumberOfFwdPostingPeriods = new NumericUpDownTester("nudNumberOfFwdPostingPeriods", TFrmGLCreateLedgerDialog); tbbCreate = new ToolStripButtonTester("tbbCreate", TFrmGLCreateLedgerDialog); }