public void UCITestUpdateActiveContact()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.SwitchView("Active Contacts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.ThinkTime(3000);

                xrmApp.Entity.SetValue("firstname", TestSettings.GetRandomString(5, 10));

                xrmApp.Entity.SetValue("lastname", TestSettings.GetRandomString(5, 10));

                xrmApp.Entity.Save();
            }
        }
Example #2
0
        public void UCITestOpenCaseRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                OptionSet priorityCode = new OptionSet()
                {
                    Name = "prioritycode"
                };
                string priorityCodeValue = xrmApp.Entity.GetHeaderValue(priorityCode);

                xrmApp.ThinkTime(2000);
            }
        }
Example #3
0
        public void UCITestGetValueFromDateTime()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Opportunities");

                xrmApp.ThinkTime(500);

                xrmApp.CommandBar.ClickCommand("New");

                xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5, 10));

                var dateTime = DateTime.Today;
                xrmApp.Entity.SetHeaderValue("estimatedclosedate", dateTime);
                xrmApp.ThinkTime(500);

                var estimatedclosedate = xrmApp.Entity.GetHeaderValue(new DateTimeControl("estimatedclosedate"));
                Assert.AreEqual(dateTime, estimatedclosedate);
                xrmApp.ThinkTime(500);
            }
        }
Example #4
0
        public void UCITestOpenRecordSetNavigator()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.SwitchView("Active Contacts");

                xrmApp.Grid.OpenRecord(0);

                // open record set navigator and go to 3rd record
                xrmApp.Entity.OpenRecordSetNavigator(2);

                xrmApp.Entity.CloseRecordSetNavigator();

                // open record set navigator and go to 1st record
                xrmApp.Entity.OpenRecordSetNavigator();

                // without closing the record set navigator go to 2nd record
                xrmApp.Entity.OpenRecordSetNavigator(1);

                //xrmApp.Entity.CloseRecordSetNavigator();
            }
        }
Example #5
0
        public void UCITestLookupSearch()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.OpenRecord(0);

                LookupItem parentCustomerId = new LookupItem {
                    Name = "parentcustomerid"
                };
                xrmApp.Entity.SelectLookup(parentCustomerId);

                xrmApp.Lookup.SelectRelatedEntity("Accounts");

                xrmApp.Lookup.SwitchView("My Active Accounts");

                xrmApp.Lookup.OpenRecord(0);

                xrmApp.ThinkTime(3000);
            }
        }
Example #6
0
        public void UCITestOpenCase_SetOptionSet()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                OptionSet priorityCode = new OptionSet {
                    Name = "prioritycode"
                };
                string priorityCodeValue = xrmApp.Entity.GetValue(priorityCode);

                priorityCode.Value = "High";
                xrmApp.Entity.SetValue(priorityCode);

                priorityCodeValue = xrmApp.Entity.GetValue(priorityCode);
                Assert.AreEqual(priorityCode.Value, priorityCodeValue);

                xrmApp.ThinkTime(2000);
            }
        }
Example #7
0
        public void UCITestOpenContactRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Contacts");

                xrmApp.RelatedGrid.OpenGridRow(0);

                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                string emailAddress = xrmApp.Entity.GetHeaderValue("emailaddress1");

                xrmApp.ThinkTime(2000);
            }
        }
Example #8
0
        public void UCITestCreateOpportunity_ClearHeaderDate()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Opportunities");

                xrmApp.CommandBar.ClickCommand("New");

                xrmApp.ThinkTime(5000);
                xrmApp.Entity.SetValue("name", "Opportunity " + TestSettings.GetRandomString(5, 10));

                DateTime expectedDate = DateTime.Today.AddDays(10);

                xrmApp.Entity.SetHeaderValue("estimatedclosedate", expectedDate);

                var      control = new DateTimeControl("estimatedclosedate");
                DateTime?date    = xrmApp.Entity.GetHeaderValue(control);
                Assert.AreEqual(expectedDate, date);

                xrmApp.Entity.ClearHeaderValue(control);
                date = xrmApp.Entity.GetHeaderValue(control);
                Assert.AreEqual(null, date);
            }
        }
Example #9
0
        /// <summary>
        /// Performs any cleanup necessary when quitting the WebBrowser.
        /// </summary>
        protected static void Quit()
        {
            var driver = client?.Browser?.Driver;

            xrmApp?.Dispose();

            // Ensuring that the driver gets disposed. Previously we were left with orphan processes and were unable to clean up profile folders.
            driver?.Dispose();

            xrmApp     = null;
            client     = null;
            testDriver = null;
            testConfig?.Flush();

            if (!string.IsNullOrEmpty(currentProfileDirectory) && Directory.Exists(currentProfileDirectory))
            {
                var directoryToDelete = currentProfileDirectory;
                currentProfileDirectory = null;

                // CrashpadMetrics-active.pma file can continue to be locked even after quitting Chrome. Requires retries.
                Policy
                .Handle <UnauthorizedAccessException>()
                .WaitAndRetry(3, retry => (retry * 5).Seconds())
                .ExecuteAndCapture(() =>
                {
                    Directory.Delete(directoryToDelete, true);
                });
            }
        }
Example #10
0
        public void CreateAccount_Error()
        {
            try
            {
                var client = new WebClient(TestSettings.Options);
                using (var xrmApp = new XrmApp(client))
                {
                    xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);
                    AddScreenShot(client, "After login");

                    xrmApp.Navigation.OpenApp(UCIAppName.Sales);
                    AddScreenShot(client, $"After OpenApp: {UCIAppName.Sales}");

                    xrmApp.Navigation.OpenSubArea("Sales", "Accounts");
                    AddScreenShot(client, "After OpenSubArea: Sales/Accounts");

                    xrmApp.CommandBar.ClickCommand("New");
                    AddScreenShot(client, "After ClickCommand: New");

                    // Field name is incorrect which will cause an exception
                    xrmApp.Entity.SetValue("name344543", TestSettings.GetRandomString(5, 15));
                    AddScreenShot(client, "After SetValue: name");

                    xrmApp.Entity.Save();
                    AddScreenShot(client, "After Save");

                    Assert.IsTrue(true);
                }
            }
            catch (Exception e)
            {
                LogExceptionAndFail(e);
            }
        }
Example #11
0
        public void UCITestOpenOpportunityLookupAccount()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Opportunities");

                xrmApp.Grid.SwitchView("Open Opportunities");

                xrmApp.Grid.OpenRecord(0);

                LookupItem parentAccountId = new LookupItem {
                    Name = "parentaccountid"
                };
                xrmApp.Entity.SelectLookup(parentAccountId);

                xrmApp.ThinkTime(1000);
                xrmApp.Lookup.OpenRecord(0);
            }
        }
Example #12
0
        public void UCITestDateTimeSetValue()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Opportunities");
                xrmApp.ThinkTime(500);

                xrmApp.CommandBar.ClickCommand("New");
                xrmApp.ThinkTime(500);

                xrmApp.Entity.SetValue("name", "Test EasyRepro Opportunity");

                xrmApp.Entity.SetValue("estimatedclosedate", DateTime.Now, "M/d/yyyy h:mm tt");
                xrmApp.ThinkTime(500);

                xrmApp.Entity.Save();

                xrmApp.ThinkTime(2000);
            }
        }
Example #13
0
        public void UCITestActivityClearValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Activities");

                xrmApp.Grid.SwitchView("All Phone Calls");
                xrmApp.ThinkTime(500);

                xrmApp.Grid.OpenRecord(0);
                xrmApp.ThinkTime(500);

                xrmApp.Entity.ClearValue(new LookupItem {
                    Name = "to"
                });
                xrmApp.ThinkTime(500);

                xrmApp.Entity.ClearValue(new LookupItem {
                    Name = "from"
                });
                xrmApp.ThinkTime(500);
            }
        }
Example #14
0
        public void UCITestActivityPartyRemoveValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Activities");

                xrmApp.Grid.SwitchView("All Phone Calls");
                xrmApp.ThinkTime(500);

                xrmApp.Grid.OpenRecord(0);
                xrmApp.ThinkTime(500);

                xrmApp.Entity.RemoveValues(new LookupItem[] {
                    new LookupItem {
                        Name = "to", Value = "Adventure Works (sample)", Index = 0
                    },
                    new LookupItem {
                        Name = "to", Value = "", Index = 0
                    }
                });
                xrmApp.ThinkTime(500);

                xrmApp.Entity.Save();
            }
        }
Example #15
0
        public void UCITestAccountRemoveMultiSelectEmail()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.SwitchView("Active Accounts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.Timeline.ClickEmailMenuItem();
                xrmApp.ThinkTime(4000);

                xrmApp.Timeline.AddEmailSubject("Request admission to butterfly section in zoo");

                xrmApp.Timeline.AddEmailContacts(CreateCcLooupItemsFor("Jim Glynn (sample)", "Nancy Anderson (sample)"));

                // This fails with the exception of OpenQA.Selenium.ElementNotInteractableException: element not interactable
                var success = xrmApp.Timeline.RemoveEmail(
                    new MultiValueOptionSet()
                {
                    Name   = Elements.ElementId[Reference.Timeline.EmailCC],
                    Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" },
                });

                xrmApp.ThinkTime(3000);
            }
        }
Example #16
0
        public void UCITestQuickCreateCase()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecrectKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.QuickCreate("case");

                xrmApp.QuickCreate.SetValue(new LookupItem {
                    Name = "customerid", Value = ""
                });

                xrmApp.QuickCreate.SetValue("title", TestSettings.GetRandomString(5, 10));

                xrmApp.QuickCreate.SetValue(new OptionSet()
                {
                    Name = "casetypecode", Value = "Problem"
                });

                xrmApp.QuickCreate.Save();
            }
        }
Example #17
0
        public void UCITestOpenCaseRetrieveHeaderValues_SetLookup()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                LookupItem ownerId = new LookupItem {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                client.Browser.Driver.ClearFocus();

                ownerId.Value = "Angel Rodriguez";
                xrmApp.Entity.SetHeaderValue(ownerId);

                ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);
                Assert.AreEqual(ownerId.Value, ownerIdValue);

                xrmApp.ThinkTime(2000);
            }
        }
Example #18
0
        public void UCITestOpenContactRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Contacts");

                xrmApp.RelatedGrid.OpenGridRow(0);

                // Bug: Fails to resolve ownerid
                // OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@data-id='header_ownerId.fieldControl-Lookup_ownerId']"}
                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                string emailAddress = xrmApp.Entity.GetHeaderValue("emailaddress1");

                xrmApp.ThinkTime(2000);
            }
        }
Example #19
0
        public void UCITestUpdateActiveCaseSetHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecrectKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.RelatedGrid.OpenGridRow(0);

                OptionSet priorityCode = new OptionSet()
                {
                    Name = "prioritycode", Value = "Low"
                };
                xrmApp.Entity.SetHeaderValue(priorityCode);

                xrmApp.Entity.Save();

                xrmApp.ThinkTime(2000);
            }
        }
Example #20
0
        public void UCITestOpenSubGridRecord()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.OpenRecord(0);

                // This experience is broken if one of the following is true:
                // 1. The subgrid label is hidden: Issue #818
                // 2. If the subgrid shows as a card rather than a table: Issue #843
                List <GridItem> rows = xrmApp.Entity.GetSubGridItems("RECENT OPPORTUNITIES");

                // This experience is broken if one of the following is true:
                // 1. The subgrid label is hidden: Issue #818
                // 2. If the subgrid shows as a card rather than a table: Issue #843
                int rowCount = xrmApp.Entity.GetSubGridItemsCount("RECENT CASES");

                // This experience is broken if one of the following is true:
                // 1. The subgrid label is hidden: Issue #818
                // 2. If the subgrid shows as a card rather than a table: Issue #843
                xrmApp.Entity.OpenSubGridRecord("RECENT OPPORTUNITIES", 0);

                xrmApp.ThinkTime(500);
            }
        }
Example #21
0
        public void UCITestOpenContactRelatedEntity_SwitchView()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Service", "Contacts");

                xrmApp.ThinkTime(2000);

                xrmApp.Grid.SwitchView("Active Contacts");

                xrmApp.ThinkTime(2000);

                xrmApp.Grid.SwitchView("My Active Contacts");

                xrmApp.ThinkTime(2000);

                xrmApp.Grid.OpenRecord(1);
            }
        }
        public void UCITestCreateAccount()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.ThinkTime(5000);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.CommandBar.ClickCommand("New");

                xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5, 15));
                xrmApp.ThinkTime(5000);



                //client.Browser.Driver.FindElement(By.XPath("//input[@aria-label='Phone']")).SendKeys("1346345");
                //xrmApp.ThinkTime(5000);

                //client.Browser.Driver.FindElement(By.XPath("//*[@title='Details']")).Click();
                //xrmApp.ThinkTime(3000);

                //Select Customer Group Field
                client.Browser.Driver.FindElement(By.XPath("//input[@aria-label='Primo SKU']")).Click();
                xrmApp.ThinkTime(5000);

                client.Browser.Driver.FindElement(By.XPath("//input[@aria-label='Group Code, Lookup']")).Click();
                xrmApp.ThinkTime(5000);

                client.Browser.Driver.FindElement(By.XPath("//*[@aria-label='PG01']")).Click();
                xrmApp.ThinkTime(5000);

                //Select Ranking field
                client.Browser.Driver.FindElement(By.XPath("//*[@aria-label='Ranking']")).Click();
                client.Browser.Driver.FindElement(By.XPath("//select[@aria-label='Ranking']/option[text() =  'Platinum']")).Click();
                xrmApp.ThinkTime(10000);

                //Select Price Group field
                client.Browser.Driver.FindElement(By.XPath("//*[@aria-label='Price Group, Lookup']")).Click();
                client.Browser.Driver.FindElement(By.XPath("//*[@class='symbolFont SearchButton-symbol ck cf dk ']")).Click();
                xrmApp.ThinkTime(5000);
                client.Browser.Driver.FindElement(By.XPath("//*[@aria-label='Test Price 1']")).Click();
                xrmApp.ThinkTime(10000);

                //Fill up ABN field
                client.Browser.Driver.FindElement(By.XPath("//input[@aria-label='ABN']")).SendKeys("53 004 085 616");
                xrmApp.ThinkTime(5000);

                xrmApp.Entity.Save();

                xrmApp.ThinkTime(15000);

                xrmApp.Navigation.SignOut();
            }
        }
Example #23
0
        public void UCITestOpenSubGridRecord()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.SwitchView("Active Contacts");

                xrmApp.Grid.OpenRecord(0);

                List <GridItem> rows = xrmApp.Entity.GetSubGridItems("Opportunities");

                int rowCount = xrmApp.Entity.GetSubGridItemsCount("Cases");

                if (rows.Count > 0)
                {
                    xrmApp.Entity.OpenSubGridRecord("Opportunities", 0);
                }

                xrmApp.ThinkTime(500);
            }
        }
Example #24
0
        public void UCITestOpenTabDetails()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.SwitchView("All Accounts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.ThinkTime(3000);

                xrmApp.Entity.SelectTab("Details");

                xrmApp.Entity.SelectTab("Related", "Contacts");

                xrmApp.ThinkTime(3000);
            }
        }
Example #25
0
        public void UCITestAccountRemoveMultiSelectEmail()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.Timeline.ClickEmailMenuItem();
                xrmApp.ThinkTime(4000);

                xrmApp.Timeline.AddEmailSubject("Request admission to butterfly section in zoo");
                xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet()
                {
                    Name   = Reference.Timeline.EmailTo,
                    Values = new string[] { "Test Contact", "Jay Zee3" },
                });

                var success = xrmApp.Timeline.RemoveEmail(
                    new MultiValueOptionSet()
                {
                    Name   = Reference.Timeline.EmailTo,
                    Values = new string[] { "Test Contact", "Jay Zee3" },
                });

                xrmApp.ThinkTime(3000);
            }
        }
Example #26
0
        public void UCITestOpenLookupSetValue()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.SwitchView("Active Accounts");

                xrmApp.Grid.OpenRecord(0);
                xrmApp.ThinkTime(500);

                // Need to handle the Lookup Records window and select a record
                // Feature Request #854

                // To work around the bug below, clearvalue first to initalize the field and then set it
                xrmApp.Entity.ClearValue(new LookupItem {
                    Name = "primarycontactid"
                });

                // Bug - System.InvalidOperationException: No Results Matching Jim Were Found. #769
                xrmApp.Entity.SetValue(new LookupItem {
                    Name = "primarycontactid", Value = "Jim"
                });
                xrmApp.ThinkTime(500);
            }
        }
Example #27
0
        public void UCITestActivityPartyGetValue()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("My Work", "Activities");

                xrmApp.Grid.SwitchView("All Phone Calls");
                xrmApp.ThinkTime(500);

                xrmApp.Grid.OpenRecord(0);
                xrmApp.ThinkTime(500);

                var to = xrmApp.Entity.GetValue(new[] { new LookupItem {
                                                            Name = "to"
                                                        } });
                Assert.IsNotNull(to);
                xrmApp.ThinkTime(500);
            }
        }
        public void UCITestDeleteCase()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                // Click the Delete button from the command bar
                xrmApp.CommandBar.ClickCommand("Delete");

                // Need to be careful here as setting this value to true can be a destructive practice if we are not creating a record first.
                xrmApp.Dialogs.ConfirmationDialog(false); // Click OK on the Delete confirmation dialog (false to cancel)

                xrmApp.ThinkTime(3000);
            }
        }
Example #29
0
        public void UCITestGetValueFromLookup_MultiAndSingle_ReturnsTheSameResult()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.SwitchView("Active Accounts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.ThinkTime(2000);

                var primaryContactLookupItem = new LookupItem {
                    Name = "primarycontactid"
                };

                string lookupValue = xrmApp.Entity.GetValue(primaryContactLookupItem);
                Debug.WriteLine($"Single-Value: {lookupValue ?? "null"}");

                string[] lookupValues = xrmApp.Entity.GetValue(new[] { primaryContactLookupItem });
                Assert.IsNotNull(lookupValues);
                Assert.IsTrue(lookupValues.Length == 0 && lookupValue == string.Empty || string.Equals(lookupValue, lookupValues[0]));

                Debug.WriteLine($"Multi-Value: {lookupValues.FirstOrDefault() ?? "null"}");
            }
        }
Example #30
0
        public void UCITestCreateActivity_SetDateTimes()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("My Work", "Activities");

                xrmApp.CommandBar.ClickCommand("Appointment");

                xrmApp.ThinkTime(5000);
                xrmApp.Entity.SetValue("subject", "Appointment " + TestSettings.GetRandomString(5, 10));

                DateTime expectedDate    = DateTime.Today.AddDays(1).AddHours(10);
                DateTime expectedEndDate = expectedDate.AddHours(2);

                xrmApp.Entity.SetValue("scheduledstart", expectedDate);
                xrmApp.Entity.SetValue("scheduledend", expectedEndDate);

                DateTime date = xrmApp.Entity.GetValue(new DateTimeControl("scheduledstart"));
                Assert.AreEqual(expectedDate, date);

                date = xrmApp.Entity.GetValue(new DateTimeControl("scheduledend"));
                Assert.AreEqual(expectedEndDate, date);
            }
        }