Exemplo n.º 1
0
        public void WhenISearchForTheTransaction(Table table)
        {
            #region data setup
            //setup date field.  StepHelper for date must come before dynamic objects
            StepHelper.SetTodayDateInTableRow("Date", table);
            dynamic objectData      = table.CreateDynamicInstance();
            var     dialogId        = "TransactionSearch";
            string  groupCaption    = "Transactions";
            string  taskCaption     = "Transaction search";
            string  transactionType = objectData.TransactionType;
            objectData.LastName += uniqueStamp;
            //sorts out date format due to datetime adding 00:00:00
            DateTime findDate = objectData.Date;
            //set fields for Transaction search fields on form
            IDictionary <string, CrmField> SupportedFields = new Dictionary <string, CrmField>
            {
                { "Last/Org/Group name", new CrmField("_KEYNAME_value", FieldType.TextInput) },
                { "Transaction type", new CrmField("_TRANSACTIONTYPE_value", FieldType.Dropdown) }
            };
            #endregion
            //search for pledge transaction
            BBCRMHomePage.OpenRevenueFA();
            RevenueFunctionalArea.OpenLink(groupCaption, taskCaption);
            BaseComponent.GetEnabledElement("//div[contains(@id,'searchdialog') and contains(@style,'visible')]//span[text()='Transaction Search']", 30);
            //Set search fields
            Dialog.SetField(dialogId, "Last/Org/Group name", objectData.LastName, SupportedFields);
            Dialog.SetField(dialogId, "Transaction type", transactionType, SupportedFields);
            //Click Search and select first result
            SearchDialog.Search();
            SearchDialog.SelectFirstResult();
            switch (transactionType.ToLower())
            {
            case "payment":
                string paymentName = string.Format("{0} Payment: {1}", findDate.ToShortDateString(), objectData.Amount);
                BaseComponent.GetEnabledElement(XpathHelper.xPath.VisiblePanel + string.Format("//span[./text()='{0}']", paymentName), 15);
                break;

            case "pledge":
                string pledgeName = string.Format("{0} Pledge: {1}", findDate.ToShortDateString(), objectData.Amount);
                BaseComponent.GetEnabledElement(XpathHelper.xPath.VisiblePanel + string.Format("//span[./text()='{0}']", pledgeName), 15);
                break;

            case "recurring gift":
                string RecurringGiftName = string.Empty;
                if (objectData.SpecificType == "Sponsorship")
                {
                    RecurringGiftName = string.Format("{0} Sponsorship recurring gift: {1}", findDate.ToShortDateString(), objectData.Amount);
                }
                else
                {
                    RecurringGiftName = string.Format("{0} Recurring gift: {1}", findDate.ToShortDateString(), objectData.Amount);
                }
                BaseComponent.GetEnabledElement(XpathHelper.xPath.VisiblePanel + string.Format("//span[./text()='{0}']", RecurringGiftName), 15);
                break;

            default:
                FailTest(string.Format("Test failed checking transaction {0}.", transactionType));
                break;
            }
        }