diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj index b926662b..92846677 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj @@ -106,15 +106,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/BusinessProcessFlowNextStage.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/BusinessProcessFlowNextStage.cs index 2b84670e..77ecc3c9 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/BusinessProcessFlowNextStage.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/BusinessProcessFlowNextStage.cs @@ -2,25 +2,39 @@ // Licensed under the MIT license. using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class BusinessProcessFlowNextStage : TestsBase + public class BusinessProcessFlowNextStageUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Leads"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestBusinessProcessFlowNextStage() { - _xrmApp.Grid.OpenRecord(0); - _xrmApp.BusinessProcessFlow.NextStage("Qualify"); + 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", "Leads"); + + xrmApp.Grid.SwitchView("Open Leads"); + + xrmApp.Grid.OpenRecord(0); + + xrmApp.BusinessProcessFlow.NextStage("Qualify"); + } } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/SwitchBusinessProcessFlow.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/SwitchBusinessProcessFlow.cs index 39f07143..d85f14eb 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/SwitchBusinessProcessFlow.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/BusinessProcessFlow/SwitchBusinessProcessFlow.cs @@ -2,28 +2,38 @@ // Licensed under the MIT license. using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class SwitchBusinessProcessFlow : TestsBase + public class SwitchBusinessProcessFlowUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Leads"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestSwitchBusinessProcessFlow() { - _xrmApp.Grid.OpenRecord(0); + 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", "Leads"); - //xrmApp.Entity.SwitchProcess("AccountEventingProcess"); - _xrmApp.Entity.SwitchProcess("Lead to Opportunity Sales Process"); + xrmApp.Grid.OpenRecord(0); + //xrmApp.Entity.SwitchProcess("AccountEventingProcess"); + xrmApp.Entity.SwitchProcess("Lead to Opportunity Sales Process"); + } } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/AssignAccount.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/AssignAccount.cs index b33adbd9..351e4eea 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/AssignAccount.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/AssignAccount.cs @@ -4,44 +4,43 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class AssignAccount : TestsBase + public class AssignAccountUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Accounts"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestCategory("Fail - DynamicData")] [TestMethod] public void UCITestAssignAccount() { - _xrmApp.Grid.OpenRecord(0); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _xrmApp.ThinkTime(2000); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - string name = _xrmApp.Entity.GetHeaderValue(new LookupItem{ Name = "ownerid" }); - Assert.IsNotNull(name); - - _xrmApp.CommandBar.ClickCommand("Assign"); - _xrmApp.Dialogs.Assign(Dialogs.AssignTo.User, name); - } + xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); - [TestMethod] - public void UCITestAssignAccount_ToMe() - { - _xrmApp.Grid.OpenRecord(0); + xrmApp.Grid.OpenRecord(0); + + xrmApp.ThinkTime(2000); + + xrmApp.CommandBar.ClickCommand("Assign"); + + // Fail - DynamicData: Need to set an actual user here + xrmApp.Dialogs.Assign(Dialogs.AssignTo.User, "Grant"); - _xrmApp.ThinkTime(2000); - - _xrmApp.CommandBar.ClickCommand("Assign"); - _xrmApp.Dialogs.Assign(Dialogs.AssignTo.Me); + } } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/CloseOpportunity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/CloseOpportunity.cs index b406038e..842872aa 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/CloseOpportunity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/CloseOpportunity.cs @@ -2,38 +2,43 @@ // Licensed under the MIT license. using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CloseOpportunity : TestsBase + public class CloseOpportunityUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Opportunities"); - - public override void SetOptions(BrowserOptions options) - { - options.PrivateMode = false; - options.UCIPerformanceMode = true; - } + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestCloseOpportunity() { - _xrmApp.Grid.SwitchView("Open Opportunities"); - - _xrmApp.Grid.OpenRecord(0); + 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"); + + // Need to be careful here as this is destructive practice if we are not creating a record first. + xrmApp.Grid.OpenRecord(0); + + xrmApp.CommandBar.ClickCommand("Close as Won"); - _xrmApp.CommandBar.ClickCommand("Close as Won"); + xrmApp.Dialogs.CloseOpportunity(123.45, DateTime.Now, "test"); - _xrmApp.Dialogs.CloseOpportunity(123.45, DateTime.Now, "test"); + } } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/DuplicateDetection.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/DuplicateDetection.cs index 640c4e29..f75c7fe2 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/DuplicateDetection.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/DuplicateDetection.cs @@ -2,30 +2,43 @@ // Licensed under the MIT license. using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DuplicateDetection : TestsBase + public class DuplicateDetectionUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Contacts"); [TestMethod] public void UCITestDuplicateDetection() { - _xrmApp.CommandBar.ClickCommand("New"); + 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.CommandBar.ClickCommand("New"); + + xrmApp.Entity.SetValue("firstname", "EasyRepro"); + xrmApp.Entity.SetValue("lastname", "Duplicate"); + xrmApp.Entity.SetValue("emailaddress1", "jz3@jztest.com"); - _xrmApp.Entity.SetValue("firstname", "EasyRepro"); - _xrmApp.Entity.SetValue("lastname", "Duplicate"); - _xrmApp.Entity.SetValue("emailaddress1", "jz3@jztest.com"); + xrmApp.Entity.Save(); - _xrmApp.Entity.Save(); + } } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/SelectDashboard.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/SelectDashboard.cs index 7689cda8..8a155d3c 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/SelectDashboard.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/CommandBar/SelectDashboard.cs @@ -1,37 +1,36 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using Microsoft.Dynamics365.UIAutomation.Api.UCI; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class SelectDashboard : TestsBase + public class SelectDashboardUCI { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestSelectDashboard() { - using (var xrmApp = CreateApp()) + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) { - NavigateTo(UCIAppName.Sales); + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - xrmApp.Navigation.ClickQuickLaunchButton("Dashboards"); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - xrmApp.Dashboard.SelectDashboard("My Knowledge Dashboard"); - } - } + xrmApp.Navigation.OpenSubArea("My Work", "Dashboards"); - [TestMethod] - public void UCITestSelectDashboard_SalesDashboard() - { - using (var xrmApp = CreateApp()) - { - NavigateTo(UCIAppName.Sales, "Sales", "Dashboards"); - xrmApp.Dashboard.SelectDashboard("Sales Dashboard"); - - xrmApp.ThinkTime(5000); + } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Controls/Grid.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Controls/Grid.cs index 136d1e10..a83d3113 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Controls/Grid.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Controls/Grid.cs @@ -21,6 +21,8 @@ public void UCIGridSort() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.Sort("Main Phone"); } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateAccount.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateAccount.cs index 8af0f474..6c0867ec 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateAccount.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateAccount.cs @@ -1,30 +1,43 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CreateAccount : TestsBase + public class CreateAccountUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Accounts"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestCreateAccount() { - _xrmApp.CommandBar.ClickCommand("New"); + 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.CommandBar.ClickCommand("New"); - _xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5, 15)); + xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5,15)); - _xrmApp.Entity.Save(); + xrmApp.Entity.Save(); + + } + } } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateCase.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateCase.cs index bc871d44..ec094569 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateCase.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateCase.cs @@ -3,12 +3,22 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CreateCaseUCI : TestsBase + public class CreateCaseUCI { + + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestCreateCase() { @@ -23,22 +33,21 @@ public void UCITestCreateCase() xrmApp.CommandBar.ClickCommand("New Case"); - xrmApp.ThinkTime(2500); - - xrmApp.Entity.SetValue("title", "Test Case "+ TestSettings.GetRandomString(5,10)); - - xrmApp.ThinkTime(2500); + xrmApp.ThinkTime(4000); - LookupItem customer = new LookupItem { Name = "customerid", Value = "David", Index = 0}; - xrmApp.Entity.SetValue(customer); + xrmApp.Entity.SetValue("title", TestSettings.GetRandomString(5,10)); - var customerName = xrmApp.Entity.GetValue(customer); - Assert.IsNotNull(customerName); - Assert.IsTrue(customerName.Contains("David")); + // To work around the bug below, clearvalue first to initalize the field and then set it + xrmApp.Entity.ClearValue(new LookupItem { Name = "customerid"}); + + // Bug - System.InvalidOperationException: No Results Matching maria campbell Were Found. #769 + xrmApp.Entity.SetValue(new LookupItem { Name = "customerid", Value = "maria campbell", Index = 0 }); + + xrmApp.ThinkTime(5000); xrmApp.Entity.Save(); - xrmApp.ThinkTime(2500); } + } } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateContact.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateContact.cs index 7588ee62..48fc06c9 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateContact.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateContact.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CreateContactUCI : TestsBase + public class CreateContactUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestCreateContact() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateLead.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateLead.cs index bcff21f3..ae08aef9 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateLead.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateLead.cs @@ -3,48 +3,45 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CreateLeadUCI : TestsBase + public class CreateLeadUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Leads"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestCreateLead() { - _xrmApp.CommandBar.ClickCommand("New"); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _xrmApp.ThinkTime(5000); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - _xrmApp.Entity.SetValue("subject", TestSettings.GetRandomString(5, 15)); - _xrmApp.Entity.SetValue("firstname", TestSettings.GetRandomString(5, 10)); - _xrmApp.Entity.SetValue("lastname", TestSettings.GetRandomString(5, 10)); - } + xrmApp.Navigation.OpenSubArea("Sales", "Leads"); - [TestMethod] - public void UCITestCreateLead_SetHeaderStatus() - { - _xrmApp.CommandBar.ClickCommand("New"); + xrmApp.CommandBar.ClickCommand("New"); - _xrmApp.ThinkTime(5000); + xrmApp.ThinkTime(5000); - _xrmApp.Entity.SetValue("subject", TestSettings.GetRandomString(5, 15)); - _xrmApp.Entity.SetValue("firstname", TestSettings.GetRandomString(5, 10)); - _xrmApp.Entity.SetValue("lastname", TestSettings.GetRandomString(5, 10)); + xrmApp.Entity.SetValue("subject", TestSettings.GetRandomString(5,15)); + xrmApp.Entity.SetValue("firstname", TestSettings.GetRandomString(5,10)); + xrmApp.Entity.SetValue("lastname", TestSettings.GetRandomString(5,10)); - var status = new OptionSet { Name = "statuscode", Value = "Contacted" }; - _xrmApp.Entity.SetHeaderValue(status); + xrmApp.Entity.Save(); - string value = _xrmApp.Entity.GetHeaderValue(status); - Assert.AreEqual(status.Value, value); + } + } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateOpportunity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateOpportunity.cs index e1db60ac..f0bea1e5 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateOpportunity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Create/CreateOpportunity.cs @@ -1,15 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class CreateOpportunityUCI : TestsBase + public class CreateOpportunityUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestCreateOpportunity() { @@ -28,7 +36,9 @@ public void UCITestCreateOpportunity() xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5,10)); xrmApp.Entity.Save(); + } + } [TestMethod] @@ -46,10 +56,10 @@ public void UCITestCreateOpportunity_SetHeaderDate() xrmApp.CommandBar.ClickCommand("New"); xrmApp.ThinkTime(5000); - xrmApp.Entity.SetValue("name", "Opporunity " + TestSettings.GetRandomString(5,10)); + xrmApp.Entity.SetValue("name", "Opportunity " + TestSettings.GetRandomString(5, 10)); DateTime expectedDate = DateTime.Today.AddDays(10); - + xrmApp.Entity.SetHeaderValue("estimatedclosedate", expectedDate); var commandResult = xrmApp.Entity.GetHeaderValue(new DateTimeControl("estimatedclosedate")); @@ -73,21 +83,21 @@ public void UCITestCreateOpportunity_ClearHeaderDate() xrmApp.CommandBar.ClickCommand("New"); xrmApp.ThinkTime(5000); - xrmApp.Entity.SetValue("name", "Opporunity " + TestSettings.GetRandomString(5,10)); + 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); } } + } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteAccount.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteAccount.cs index 029b7ea2..a320e413 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteAccount.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteAccount.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DeleteAccountUCI : TestsBase + public class DeleteAccountUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestDeleteAccount() { @@ -21,12 +30,15 @@ public void UCITestDeleteAccount() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); //Click the Delete button from the command bar xrmApp.CommandBar.ClickCommand("Delete", "", false); //Set to true if command is a part of the More Commands menu - xrmApp.Dialogs.ConfirmationDialog(true); //Click OK on the Delete confirmation dialog (false to cancel) + // 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); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteCase.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteCase.cs index ed260277..4150a35e 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteCase.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteCase.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DeleteCaseUCI : TestsBase + public class DeleteCaseUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestDeleteCase() { @@ -20,18 +29,21 @@ public void UCITestDeleteCase() 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", "", false); //Set to true if command is a part of the More Commands menu + // Click the Delete button from the command bar + xrmApp.CommandBar.ClickCommand("Delete", "", false); // Set to true if command is a part of the More Commands menu - xrmApp.Dialogs.ConfirmationDialog(false); //Click OK on the Delete confirmation dialog (false to cancel) + // 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); + } + } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteContact.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteContact.cs index 2c8ddd90..d553fb64 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteContact.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteContact.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DeleteContactUCI : TestsBase + public class DeleteContactUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestDeleteContact() { @@ -21,12 +30,15 @@ public void UCITestDeleteContact() xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); + xrmApp.Grid.SwitchView("Active Contacts"); + xrmApp.Grid.OpenRecord(0); - //Click the Delete button from the command bar - xrmApp.CommandBar.ClickCommand("Delete", "", false); //Set to true if command is a part of the More Commands menu + // Click the Delete button from the command bar + xrmApp.CommandBar.ClickCommand("Delete", "", false); // Set to true if command is a part of the More Commands menu - xrmApp.Dialogs.ConfirmationDialog(true); //Click OK on the Delete confirmation dialog (false to cancel) + // 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); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteLead.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteLead.cs index 2ce97044..c1556b0f 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteLead.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteLead.cs @@ -3,13 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DeleteLeadUCI : TestsBase + public class DeleteLeadUCI { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestDeleteLead() { @@ -22,12 +30,15 @@ public void UCITestDeleteLead() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); + xrmApp.Grid.SwitchView("Open Leads"); + xrmApp.Grid.OpenRecord(0); - //Click the Delete button from the command bar - xrmApp.CommandBar.ClickCommand("Delete", "", false); //Set to true if command is a part of the More Commands menu + // Click the Delete button from the command bar + xrmApp.CommandBar.ClickCommand("Delete", "", false); // Set to true if command is a part of the More Commands menu - xrmApp.Dialogs.ConfirmationDialog(true); //Click OK on the Delete confirmation dialog (false to cancel) + // 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); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteOpportunity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteOpportunity.cs index d0a248da..d12b6e3e 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteOpportunity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Delete/DeleteOpportunity.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class DeleteOpportunityUCI : TestsBase + public class DeleteOpportunityUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestDeleteOpportunity() { @@ -20,18 +29,21 @@ public void UCITestDeleteOpportunity() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Opportunities"); - + xrmApp.Grid.SwitchView("Open Opportunities"); xrmApp.Grid.OpenRecord(0); - //Click the Delete button from the command bar - xrmApp.CommandBar.ClickCommand("Delete", "", false); //Set to true if command is a part of the More Commands menu + // Click the Delete button from the command bar + xrmApp.CommandBar.ClickCommand("Delete", "", false); // Set to true if command is a part of the More Commands menu - xrmApp.Dialogs.ConfirmationDialog(false); //Click OK on the Delete confirmation dialog (false to cancel) + // 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); + } + } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/FormNotifications/ReadFormNotifications.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/FormNotifications/ReadFormNotifications.cs index 9b822765..66f1ebea 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/FormNotifications/ReadFormNotifications.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/FormNotifications/ReadFormNotifications.cs @@ -20,13 +20,13 @@ public class ReadFormNotifications : TestsBase public override void NavigateToHomePage() => _xrmApp.Navigation.OpenSubArea("Sales", "Leads"); - + [TestCategory("Fail - Bug")] [TestMethod] public void UCITestReadFormNotifications() { _xrmApp.CommandBar.ClickCommand("New"); - _xrmApp.Entity.SetValue("lastname", "Test"); + _xrmApp.Entity.SetValue("lastname", "Vong (sample)"); _xrmApp.ThinkTime(5000); _xrmApp.Entity.Save(); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GetValue.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GetValue.cs index d6284834..09737dad 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GetValue.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GetValue.cs @@ -3,105 +3,145 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using System; +using System.Security; using System.Diagnostics; using System.Linq; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { - [TestClass] - public class GetValueUci : TestsBase + [TestClass] + public class GetValueUci { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestGetValueFromOptionSet() { - _xrmApp.Navigation.OpenSubArea("Contacts"); + 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.Grid.SwitchView("Active Contacts"); - _xrmApp.Grid.OpenRecord(0); + var options = xrmApp.Entity.GetValue(new OptionSet { Name = "preferredcontactmethodcode" }); + } - string option = _xrmApp.Entity.GetValue(new OptionSet {Name = "preferredcontactmethodcode"}); - Assert.IsNotNull(option); } [TestMethod] - public void UCITestGetSingleValueFromLookup() + public void UCITestGetValueFromLookup() { - _xrmApp.Navigation.OpenSubArea("Accounts"); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - _xrmApp.Grid.OpenRecord(0); + xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); - _xrmApp.ThinkTime(2000); - string lookupValue = _xrmApp.Entity.GetValue(new LookupItem {Name = "primarycontactid"}); - Assert.IsNotNull(lookupValue); + xrmApp.Grid.SwitchView("Active Accounts"); + + xrmApp.Grid.OpenRecord(0); + + xrmApp.ThinkTime(2000); + string lookupValue = xrmApp.Entity.GetValue(new LookupItem { Name = "primarycontactid" }); + } } [TestMethod] public void UCITestGetValueFromLookup_MultiAndSingle_ReturnsTheSameResult() { - _xrmApp.Navigation.OpenSubArea("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"}"); + 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"}"); + } } - + [TestMethod] public void UCITestActivityPartyGetValue() { - _xrmApp.Navigation.OpenSubArea("Activities"); + 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.SwitchView("All Phone Calls"); + xrmApp.ThinkTime(500); - _xrmApp.Grid.OpenRecord(0); - _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); + var to = xrmApp.Entity.GetValue(new[] { new LookupItem { Name = "to" } }); + Assert.IsNotNull(to); + xrmApp.ThinkTime(500); + } } [TestMethod] public void UCITestGetValueFromDateTime() { - _xrmApp.Navigation.OpenSubArea("Opportunities"); - _xrmApp.ThinkTime(500); + 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.CommandBar.ClickCommand("New"); - _xrmApp.Entity.SetValue("name", "Test EasyRepro Opportunity"); + xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5, 10)); - var dateTime = DateTime.Today.AddHours(10).AddMinutes(15); - _xrmApp.Entity.SetHeaderValue("estimatedclosedate", dateTime); - _xrmApp.ThinkTime(500); + 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); + var estimatedclosedate = xrmApp.Entity.GetHeaderValue(new DateTimeControl("estimatedclosedate")); + Assert.AreEqual(dateTime, estimatedclosedate); + xrmApp.ThinkTime(500); + } } } -} \ No newline at end of file +} diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalRelevanceSearch.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalRelevanceSearch.cs index 4cbfa0cd..e97e30c8 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalRelevanceSearch.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalRelevanceSearch.cs @@ -4,6 +4,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +/* + * This requires Relevance Search to be enabled. To enable Relevance Search review the following article: + * https://docs.microsoft.com/en-us/power-platform/admin/configure-relevance-search-organization#enable-relevance-search + */ + namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] @@ -23,11 +28,11 @@ public void UCITestGlobalRelevanceSearch() xrmApp.GlobalSearch.ChangeSearchType("Relevance Search"); - xrmApp.GlobalSearch.Search("Test"); + xrmApp.GlobalSearch.Search("Adventure"); xrmApp.GlobalSearch.Filter("Record Type", "Accounts"); - xrmApp.GlobalSearch.OpenRecord("account", 0); + xrmApp.GlobalSearch.OpenRecord("account", 0); } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalSearch.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalSearch.cs new file mode 100644 index 00000000..c61de96c --- /dev/null +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/GlobalSearch/GlobalSearch.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; + +namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI +{ + [TestClass] + public class GlobalSearchUci + { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"]); + + [TestMethod] + public void UCITestGlobalSearch() + { + 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.OpenGlobalSearch(); + + xrmApp.GlobalSearch.Search("Test"); + + xrmApp.GlobalSearch.FilterWith("Account"); + + xrmApp.GlobalSearch.OpenRecord("account", 0); + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/QuickStart.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/0_Lab_TestsBase_QuickStart.cs similarity index 90% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/QuickStart.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/0_Lab_TestsBase_QuickStart.cs index 75d1ba1f..5f7d2cb1 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/QuickStart.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/0_Lab_TestsBase_QuickStart.cs @@ -4,7 +4,7 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] // NUnit => [TestFixture] - public class Demo_QuickStart : TestsBase + public class Lab_TestsBase_QuickStart : TestsBase { [TestInitialize] public override void InitTest() => base.InitTest(); // here is _xrmApp initialized before each tests @@ -17,6 +17,7 @@ public class Demo_QuickStart : TestsBase // Optional: this will override the default parameters values & from this app.config public override void SetOptions(BrowserOptions options) => options.UCIPerformanceMode = false; // => set options for all tests in this class + [TestCategory("Labs - TestsBase")] [TestMethod] public void TestCreateAccount() { @@ -26,6 +27,7 @@ public void TestCreateAccount() Assert.IsNotNull("Replace this line with your test code"); } + [TestCategory("Labs - TestsBase")] [TestMethod] public void TestOpenAccount() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/1_Demo_TestsClass.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs similarity index 91% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/1_Demo_TestsClass.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs index 9a123516..8e382a6c 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/1_Demo_TestsClass.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/1_Lab_TestsClass.cs @@ -8,15 +8,16 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_TestsClass { + public class Lab_TestsClass { readonly Uri _xrmUri = new Uri(ConfigurationManager.AppSettings["OnlineCrmUrl"]); readonly SecureString _username = ConfigurationManager.AppSettings["OnlineUsername"]?.ToSecureString(); readonly SecureString _password = ConfigurationManager.AppSettings["OnlinePassword"]?.ToSecureString(); readonly SecureString _mfaSecretKey = ConfigurationManager.AppSettings["MfaSecretKey"]?.ToSecureString(); + [TestCategory("Labs - TestsBase")] [TestMethod] - public void I_Hate_TheBaseClass() + public void NotUsing_TheBaseClass() { var options = TestSettings.Options; options.PrivateMode = true; @@ -35,9 +36,10 @@ public void I_Hate_TheBaseClass() } // Note: that here get the Browser closed, xrmApp get disposed } - + + [TestCategory("Labs - TestsBase")] [TestMethod, ExpectedException(typeof(Exception), AllowDerivedTypes = true)] - public void I_Hate_TheBaseClass_GoToCases_InCustomerServicesApp() + public void NotUsing_TheBaseClass_GoToCases_InCustomerServicesApp() { var options = TestSettings.Options; options.PrivateMode = false; // <= this test is not in private mode, ignore config diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/2_Demo_Let_TestsBase_WorkForYou_ReadConfigParameters.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/2_Lab_TestsBase_ReadConfigParameters.cs similarity index 93% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/2_Demo_Let_TestsBase_WorkForYou_ReadConfigParameters.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/2_Lab_TestsBase_ReadConfigParameters.cs index 4f804648..2308f51c 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/2_Demo_Let_TestsBase_WorkForYou_ReadConfigParameters.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/2_Lab_TestsBase_ReadConfigParameters.cs @@ -6,10 +6,10 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_ReadConfigParameters : TestsBase { + public class Lab_TestsBase_ReadConfigParameters : TestsBase { // Read Config Parameters are now defined in TestsBase everything else still the same - + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass() { @@ -29,7 +29,8 @@ public void UseTheBaseClass() } // Note: that here get the Browser closed, xrmApp get disposed } - + + [TestCategory("Labs - TestsBase")] [TestMethod, ExpectedException(typeof(Exception), AllowDerivedTypes = true)] public void UseTheBaseClass_GoToCases_InCustomerServicesApp() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/3_Demo_Let_TestsBase_WorkForYou_CreateApp.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/3_Lab_TestsBase_CreateApp.cs similarity index 90% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/3_Demo_Let_TestsBase_WorkForYou_CreateApp.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/3_Lab_TestsBase_CreateApp.cs index 7ef9e30c..cfc0e9de 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/3_Demo_Let_TestsBase_WorkForYou_CreateApp.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/3_Lab_TestsBase_CreateApp.cs @@ -3,8 +3,9 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_CreateApp : TestsBase { - + public class Lab_TestsBase_WorkForYou_CreateApp : TestsBase { + + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass() { @@ -21,7 +22,8 @@ public void UseTheBaseClass() } // Note: that here get the Browser closed, xrmApp get disposed } - + + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass_GoToCases_InCustomerServicesApp() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/4_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesDefaultOptions.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/4_Lab_TestsBase_CreateApp_AllTestsUsesDefaultOptions.cs similarity index 89% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/4_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesDefaultOptions.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/4_Lab_TestsBase_CreateApp_AllTestsUsesDefaultOptions.cs index d93d0d72..d8346291 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/4_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesDefaultOptions.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/4_Lab_TestsBase_CreateApp_AllTestsUsesDefaultOptions.cs @@ -3,8 +3,9 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesDefaultOptions : TestsBase { - + public class Lab_TestsBase_CreateApp_AllTestsUsesDefaultOptions : TestsBase { + + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass() { @@ -18,7 +19,8 @@ public void UseTheBaseClass() } // Note: that here get the Browser closed, CreateApp } - + + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass_GoToCases_InCustomerServicesApp() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/5_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesMyCustomOptions.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/5_Lab_TestsBase_CreateApp_AllTestsUsesMyCustomOptions.cs similarity index 89% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/5_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesMyCustomOptions.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/5_Lab_TestsBase_CreateApp_AllTestsUsesMyCustomOptions.cs index 8ab969a0..8767d4be 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/5_Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesMyCustomOptions.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/5_Lab_TestsBase_CreateApp_AllTestsUsesMyCustomOptions.cs @@ -4,7 +4,7 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_CreateApp_AllTestsUsesMyCustomOptions : TestsBase + public class Lab_TestsBase_CreateApp_AllTestsUsesMyCustomOptions : TestsBase { public override void SetOptions(BrowserOptions options) { @@ -13,6 +13,7 @@ public override void SetOptions(BrowserOptions options) options.UCIPerformanceMode = false; } + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass() { @@ -26,7 +27,8 @@ public void UseTheBaseClass() } // Note: that here get the Browser closed, CreateApp } - + + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass_GoToCases_InCustomerServicesApp() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/6_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameApp_InAllTests.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/6_Lab_TestsBase_CreateApp_NavigateToSameApp_InAllTests.cs similarity index 87% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/6_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameApp_InAllTests.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/6_Lab_TestsBase_CreateApp_NavigateToSameApp_InAllTests.cs index 1e21f88e..b6ffe589 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/6_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameApp_InAllTests.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/6_Lab_TestsBase_CreateApp_NavigateToSameApp_InAllTests.cs @@ -3,7 +3,7 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameApp_InAllTests : TestsBase + public class Lab_TestsBase_CreateApp_NavigateToSameApp_InAllTests : TestsBase { [TestInitialize] public override void InitTest() => base.InitTest(); // here is xrmApp initialized before each tests @@ -13,6 +13,7 @@ public class Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameApp_InAllTest public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales); // => going to Sale Hub App + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass() { @@ -23,6 +24,7 @@ public void UseTheBaseClass() Assert.IsNotNull("Replace this line with your test code"); } + [TestCategory("Labs - TestsBase")] [TestMethod] public void UseTheBaseClass_GoToCases_InCustomerServicesApp() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/7_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameArea_InAllTests.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/7_Lab_TestsBase_CreateApp_NavigateToSameArea_InAllTests.cs similarity index 86% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/7_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameArea_InAllTests.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/7_Lab_TestsBase_CreateApp_NavigateToSameArea_InAllTests.cs index 1cd66381..580fd97e 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickStart/7_Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameArea_InAllTests.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/7_Lab_TestsBase_CreateApp_NavigateToSameArea_InAllTests.cs @@ -3,7 +3,7 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameArea_InAllTests : TestsBase + public class Lab_TestsBase_CreateApp_NavigateToSameArea_InAllTests : TestsBase { [TestInitialize] public override void InitTest() => base.InitTest(); // <= here is xrmApp initialized before each tests, Login inclusive @@ -13,6 +13,7 @@ public class Demo_Let_TestsBase_WorkForYou_CreateApp_NavigateToSameArea_InAllTes public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Accounts"); // => going to Sale Hub App, Sales Area, Accounts Sub Area + [TestCategory("Labs - TestsBase")] [TestMethod] public void TestCreateAccount() { @@ -22,6 +23,7 @@ public void TestCreateAccount() Assert.IsNotNull("Replace this line with your test code"); } + [TestCategory("Labs - TestsBase")] [TestMethod] public void TestOpenAccount() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/TestsBase.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/TestsBase.cs similarity index 100% rename from Microsoft.Dynamics365.UIAutomation.Sample/UCI/TestsBase.cs rename to Microsoft.Dynamics365.UIAutomation.Sample/UCI/Labs/TestsBase/TestsBase.cs diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/AreasAndSubAreas.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/AreasAndSubAreas.cs index 47cb10b7..a5ed3bdc 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/AreasAndSubAreas.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/AreasAndSubAreas.cs @@ -14,8 +14,9 @@ namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI public class AreasAndSubAreasUci : TestsBase { /// - /// Test that only those areas that are expected apear on the are menu + /// Test that only those areas that are expected appear on the are menu /// + [TestCategory("Fail - ExpectedAssertion")] [TestMethod] public void TestExpectedAreasArePresent() { @@ -23,8 +24,10 @@ public void TestExpectedAreasArePresent() using (var xrmApp = new XrmApp(client)) { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); + + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - List expectedAreas = new List { "case management", "training" }; + List expectedAreas = new List { "Accounts", "Contacts" }; Dictionary areas = client.OpenMenu(); @@ -42,6 +45,7 @@ public void TestExpectedAreasArePresent() /// /// Test that only expected subareas are visible to the user /// + [TestCategory("Fail - ExpectedAssertion")] [TestMethod] public void TestExpectedSubAreasArePresent() { @@ -50,7 +54,9 @@ public void TestExpectedSubAreasArePresent() { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - List expectedSubAreas = new List { "home","recent","pinned","cases","contacts","accounts","queues","knowledge articles","dashboards","activities","social profiles"}; + xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); + + List expectedSubAreas = new List { "Home","Recent","Pinned","Dashboards","Activities","Accounts","Contacts","Social Profiles","Cases","Queues","Knowledge Articles"}; Dictionary subAreaMenuItems = WebClient.GetSubAreaMenuItems(client.Browser.Driver); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/FormSelector.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/FormSelector.cs index 48a70744..14644d5a 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/FormSelector.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/FormSelector.cs @@ -21,13 +21,15 @@ public void UCITestOpenGlobalSearchSelectForm() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); - xrmApp.Entity.SelectForm("Account"); + xrmApp.Entity.SelectForm("Account for Interactive experience"); xrmApp.ThinkTime(3000); - xrmApp.Entity.SelectForm("Sales Insights"); + xrmApp.Entity.SelectForm("Account"); xrmApp.ThinkTime(3000); } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/GlobalSearch.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/GlobalSearch.cs index 1a83c743..f88251b2 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/GlobalSearch.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/GlobalSearch.cs @@ -3,12 +3,20 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenGlobalSearchUci: TestsBase + public class OpenGlobalSearchUci { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"]); + [TestMethod] public void UCITestOpenGlobalSearch() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/OpenNavigation.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/OpenNavigation.cs index ad7c7aec..d1edfa06 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/OpenNavigation.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/OpenNavigation.cs @@ -1,76 +1,125 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenNavigationUci: TestsBase + public class OpenNavigationUci { - public void ExecuteNavegationCommand(Action command) + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"]); + + [TestMethod] + public void UCITestOpenOptions() { - var options = TestSettings.Options; - options.UCIPerformanceMode = false; - - using (var xrmApp = CreateApp(options)) + var client = new WebClient(TestSettings.Options); + + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; + + using (var xrmApp = new XrmApp(client)) { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); - command(xrmApp.Navigation); - xrmApp.ThinkTime(3.Seconds()); + xrmApp.Navigation.OpenOptions(); + // xrmApp.Navigation.OpenOptInForLearningPath(); + // xrmApp.Navigation.OpenPrivacy(); + // xrmApp.Navigation.SignOut(); } } - [TestMethod] public void UCITestOpenOptions() => ExecuteNavegationCommand(n => n.OpenOptions()); - [TestMethod] public void UCITestOpenPrivacy() => ExecuteNavegationCommand(n => n.OpenPrivacy()); - [TestMethod] public void UCITestSignOut() => ExecuteNavegationCommand(n => n.SignOut()); - [TestMethod] public void UCITestOptInForLearningPath() => ExecuteNavegationCommand(n => n.OpenOptInForLearningPath()); - [TestMethod] public void UCITestOpenGuidedHelp () => ExecuteNavegationCommand(n => n.OpenGuidedHelp()); - [TestMethod] public void UCITestOpenSoftwareLicensing () => ExecuteNavegationCommand(n => n.OpenSoftwareLicensing()); - [TestMethod] public void UCITestOpenToastNotifications () => ExecuteNavegationCommand(n => n.OpenToastNotifications()); - [TestMethod] public void UCITestOpenAbout () => ExecuteNavegationCommand(n => n.OpenAbout()); - [TestMethod] public void UCITest_AppSettings_PDFgeneration () => ExecuteNavegationCommand(n => n.OpenSubArea("App Settings", "PDF generation")); - + [TestMethod] - public void UCITestOpenHelp() + public void UCITestOpenGuidedHelp() { - using (var xrmApp = CreateApp()) + var client = new WebClient(TestSettings.Options); + + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; + + using (var xrmApp = new XrmApp(client)) { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); - xrmApp.Navigation.OpenArea("Help and Support"); - xrmApp.Navigation.OpenSubArea("Help Center"); + xrmApp.Navigation.OpenGuidedHelp(); } } [TestMethod] - public void UCITestOpenRelatedCommonActivities() + public void UCITestOpenSoftwareLicensing() { - using (var xrmApp = CreateApp()) + var client = new WebClient(TestSettings.Options); + + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; + + using (var xrmApp = new XrmApp(client)) { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); + xrmApp.Navigation.OpenSoftwareLicensing(); + } + } - xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + [TestMethod] + public void UCITestOpenToastNotifications() + { + var client = new WebClient(TestSettings.Options); - xrmApp.Grid.OpenRecord(0); + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; - xrmApp.Navigation.OpenMenu(Reference.MenuRelated.Related, Reference.MenuRelated.CommonActivities); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); + xrmApp.Navigation.OpenToastNotifications(); } } [TestMethod] - public void UCITestOpenGroupSubArea() + public void UCITestOpenAbout() { - using (var xrmApp = CreateApp()) + var client = new WebClient(TestSettings.Options); + + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; + + using (var xrmApp = new XrmApp(client)) { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); + xrmApp.Navigation.OpenAbout(); + } + } - xrmApp.Navigation.OpenGroupSubArea("Customers", "Accounts"); + [TestMethod] + public void UCITestOpenRelatedCommonActivities() + { + 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.ThinkTime(3000); + xrmApp.Navigation.OpenMenu(Reference.MenuRelated.Related, Reference.MenuRelated.CommonActivities); } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/PortalAdmin.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/PortalAdmin.cs index 37df9cf0..ed137465 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/PortalAdmin.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Navigation/PortalAdmin.cs @@ -3,16 +3,29 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class PortalAdminUci: TestsBase + public class PortalAdminUci { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"]); + [TestMethod] public void UCITestOpenPortalAdmin() { var client = new WebClient(TestSettings.Options); + + // The performance widget overlays on top of these settings. In order for them to be clickable, you have to disable PerformanceMode on these tests. + // Otherwise, you get the following error: OpenQA.Selenium.ElementClickInterceptedException: element click intercepted + client.Browser.Options.UCIPerformanceMode = false; + using (var xrmApp = new XrmApp(client)) { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickCreate/QuickCreate.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickCreate/QuickCreate.cs index 46e5414b..46dd2afc 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickCreate/QuickCreate.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/QuickCreate/QuickCreate.cs @@ -2,14 +2,20 @@ // Licensed under the MIT license. using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; -using System; using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class QuickCreateContactUCI: TestsBase + public class QuickCreateContactUCI { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestQuickCreateContact() { @@ -19,75 +25,17 @@ public void UCITestQuickCreateContact() xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); - + xrmApp.Navigation.QuickCreate("contact"); - - xrmApp.QuickCreate.SetValue("firstname", TestSettings.GetRandomString(5, 10)); - - xrmApp.QuickCreate.SetValue("lastname", TestSettings.GetRandomString(5, 10)); - - xrmApp.QuickCreate.SetValue(new LookupItem() { Name = "parentcustomerid", Value = "Test" }); - - xrmApp.QuickCreate.Save(); - - } - } - - [TestMethod] - public void UCITestQuickCreateCase() - { - using (var xrmApp = CreateApp()) - { - xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); - - xrmApp.Navigation.QuickCreate("case"); - - xrmApp.QuickCreate.SetValue(new LookupItem { Name = "customerid", Value = "Adventure" }); - - xrmApp.QuickCreate.SetValue("title", TestSettings.GetRandomString(5, 10)); - - xrmApp.QuickCreate.SetValue(new OptionSet { Name = "casetypecode", Value = "Problem" }); - - xrmApp.QuickCreate.Save(); - xrmApp.ThinkTime(5.Seconds()); - } - } - - [TestMethod] - public void UCITestQuickCreateOpportunity() - { - 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.QuickCreate("opportunity"); - - xrmApp.QuickCreate.Cancel(); - - xrmApp.Navigation.QuickCreate("opportunity"); - - xrmApp.QuickCreate.SetValue(new LookupItem { Name = "parentcontactid", Value = "Test" }); - - xrmApp.QuickCreate.SetValue("name", TestSettings.GetRandomString(5, 10)); - - xrmApp.QuickCreate.SetValue(new OptionSet() { Name = "msdyn_ordertype", Value = "Work based" }); - - xrmApp.QuickCreate.SetValue("estimatedclosedate", DateTime.Now.AddDays(45), "MM/dd/yyyy"); - - string name = xrmApp.QuickCreate.GetValue("name"); - - string orderType = xrmApp.QuickCreate.GetValue(new OptionSet() { Name = "msdyn_ordertype" }); - - string estimatedCloseDate = xrmApp.QuickCreate.GetValue("estimatedclosedate"); - - string parentContact = xrmApp.QuickCreate.GetValue(new LookupItem() { Name = "parentcontactid" }); + xrmApp.QuickCreate.SetValue("firstname", TestSettings.GetRandomString(5,10)); + + xrmApp.QuickCreate.SetValue("lastname", TestSettings.GetRandomString(5,10)); + xrmApp.QuickCreate.SetValue(new LookupItem() { Name = "parentcustomerid", Value="Adventure" }); + xrmApp.QuickCreate.Save(); - + } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenAccount.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenAccount.cs index 1729ddc1..f7ad007e 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenAccount.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenAccount.cs @@ -3,78 +3,138 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenAccountUCI : TestsBase + public class OpenAccountUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.Sales, "Sales", "Accounts"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestOpenActiveAccount() { - _xrmApp.Grid.Search("Adventure"); + 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.Search("A. Datum"); + + xrmApp.Grid.OpenRecord(0); - _xrmApp.Grid.OpenRecord(0); - - _xrmApp.ThinkTime(1000); + xrmApp.ThinkTime(3000); - string value = _xrmApp.Entity.GetValue("name"); - Assert.IsTrue(value.StartsWith("Adventure")); + } } [TestMethod] public void UCITestGetActiveGridItems() { - _xrmApp.Grid.GetGridItems(); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _xrmApp.Grid.Sort("Account Name"); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - _xrmApp.ThinkTime(3000); + xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + + xrmApp.Grid.SwitchView("Active Accounts"); + + xrmApp.Grid.GetGridItems(); + + xrmApp.Grid.Sort("Account Name"); + + xrmApp.ThinkTime(3000); + } } [TestMethod] public void UCITestOpenTabDetails() { - _xrmApp.Grid.SwitchView("All Accounts"); + 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.Grid.SwitchView("All Accounts"); - _xrmApp.ThinkTime(3000); + xrmApp.Grid.OpenRecord(0); - _xrmApp.Entity.SelectTab("Details"); + xrmApp.ThinkTime(3000); - _xrmApp.Entity.SelectTab("Related", "Contacts"); - - _xrmApp.ThinkTime(3000); + xrmApp.Entity.SelectTab("Details"); + + xrmApp.Entity.SelectTab("Related","Contacts"); + + xrmApp.ThinkTime(3000); + } } [TestMethod] public void UCITestGetObjectId() { - _xrmApp.Grid.OpenRecord(0); + 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"); - Guid objectId = _xrmApp.Entity.GetObjectId(); - Assert.AreNotEqual(Guid.Empty, objectId); - _xrmApp.ThinkTime(3000); + xrmApp.Grid.OpenRecord(0); + + Guid objectId = xrmApp.Entity.GetObjectId(); + + xrmApp.ThinkTime(3000); + } } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestOpenSubGridRecord() { - _xrmApp.Grid.OpenRecord(0); + 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.Entity.GetSubGridItems("CONTACTS"); + // 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.GetSubGridItems("CONTACTS"); - _xrmApp.ThinkTime(3000); + xrmApp.ThinkTime(3000); + } } } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenCase.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenCase.cs index c26fce9b..39160dfe 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenCase.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenCase.cs @@ -3,175 +3,84 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; -using System; using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenCaseUCI : TestsBase + public class OpenCaseUCI { - [TestInitialize] - public override void InitTest() => base.InitTest(); - - [TestCleanup] - public override void FinishTest() => base.FinishTest(); - - public override void NavigateToHomePage() => NavigateTo(UCIAppName.CustomerService, "Service", "Cases"); + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); [TestMethod] public void UCITestOpenActiveCase() { - _xrmApp.Grid.Search("*Service"); - - _xrmApp.Grid.OpenRecord(0); - } - - [TestMethod] - public void UCITestOpenCase() - { - _xrmApp.Grid.SwitchView("Active Cases"); - _xrmApp.Grid.OpenRecord(0); - - Field ticketNumber = _xrmApp.Entity.GetField("ticketnumber"); - Assert.IsNotNull(ticketNumber); - - Field subject = _xrmApp.Entity.GetField("subjectid"); - Assert.IsNotNull(subject); - - Field description = _xrmApp.Entity.GetField("description"); - Assert.IsNotNull(description); - - Field mobilePhone = _xrmApp.Entity.GetField("mobilephone"); - Assert.IsNotNull(mobilePhone); - } - - [TestMethod] - public void UCITestOpenCaseById() - { - _xrmApp.Grid.SwitchView("Active Cases"); - _xrmApp.Grid.OpenRecord(0); - string number = _xrmApp.Entity.GetValue("ticketnumber"); - Assert.IsNotNull(number); - - // For proper test usage, please update the recordId below to a valid Case recordId - Guid recordId = _xrmApp.Entity.GetObjectId(); - - _xrmApp.Navigation.OpenSubArea("Service", "Cases"); - - string firstCaseNumber = number; - _xrmApp.Entity.OpenEntity("incident", recordId); - number = _xrmApp.Entity.GetValue("ticketnumber"); - Assert.IsNotNull(number); - Assert.AreEqual(firstCaseNumber, number); - } - - [TestMethod] - public void UCITestOpenCaseRetrieveHeaderValues() - { - _xrmApp.Grid.SwitchView("Active Cases"); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _xrmApp.Grid.OpenRecord(0); + xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); - LookupItem ownerId = new LookupItem {Name = "ownerid"}; - string ownerIdValue = _xrmApp.Entity.GetHeaderValue(ownerId); + xrmApp.Navigation.OpenSubArea("Service", "Cases"); - OptionSet priorityCode = new OptionSet {Name = "prioritycode"}; - string priorityCodeValue = _xrmApp.Entity.GetHeaderValue(priorityCode); + xrmApp.Grid.Search("Service Requested"); - _xrmApp.ThinkTime(2000); + xrmApp.Grid.OpenRecord(0); + } } [TestMethod] - public void UCITestOpenCaseRetrieveHeaderValues_SetLookup() + public void UCITestOpenCase() { - _xrmApp.Grid.SwitchView("Active Cases"); - - _xrmApp.Grid.OpenRecord(0); - - LookupItem ownerId = new LookupItem {Name = "ownerid"}; - string ownerIdValue = _xrmApp.Entity.GetHeaderValue(ownerId); + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) + { + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - _client.Browser.Driver.ClearFocus(); + xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); - ownerId.Value = "Angel Rodriguez"; - _xrmApp.Entity.SetHeaderValue(ownerId); + xrmApp.Navigation.OpenSubArea("Service", "Cases"); - ownerIdValue = _xrmApp.Entity.GetHeaderValue(ownerId); - Assert.AreEqual(ownerId.Value, ownerIdValue); + xrmApp.Grid.SwitchView("Active Cases"); - _xrmApp.ThinkTime(2000); + xrmApp.Grid.OpenRecord(0); + } } - [TestMethod] - public void UCITestOpenCaseRetrieveHeaderValues_SetOptionSet() + [TestCategory("Fail - Bug")] + public void UCITestOpenCaseRetrieveHeaderValues() { - _xrmApp.Grid.SwitchView("Active Cases"); - - _xrmApp.Grid.OpenRecord(0); - - OptionSet priorityCode = new OptionSet + var client = new WebClient(TestSettings.Options); + using (var xrmApp = new XrmApp(client)) { - Name = "prioritycode", - Value = "High" - }; - - _xrmApp.Entity.SetHeaderValue(priorityCode); + xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - string priorityCodeValue = _xrmApp.Entity.GetHeaderValue(priorityCode); - Assert.AreEqual(priorityCode.Value, priorityCodeValue); + xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); - _xrmApp.ThinkTime(2000); - } + xrmApp.Navigation.OpenSubArea("Service", "Cases"); - [TestMethod] - public void UCITestOpenCase_SetOptionSet() - { - _xrmApp.Grid.SwitchView("Active Cases"); + xrmApp.Grid.SwitchView("Active Cases"); - _xrmApp.Grid.OpenRecord(0); + xrmApp.Grid.OpenRecord(0); - OptionSet priorityCode = new OptionSet - { - Name = "prioritycode", - Value = "High" - }; - _xrmApp.Entity.SetValue(priorityCode); + OptionSet priorityCode = new OptionSet() { Name = "prioritycode" }; + string priorityCodeValue = xrmApp.Entity.GetHeaderValue(priorityCode); - string priorityCodeValue = _xrmApp.Entity.GetValue(priorityCode); - Assert.AreEqual(priorityCode.Value, priorityCodeValue); + // 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); - _xrmApp.ThinkTime(2000); - } + xrmApp.ThinkTime(2000); - [TestMethod] - public void UCITestOpenCase_SetHeaderValues() - { - _xrmApp.Grid.SwitchView("Active Cases"); - - _xrmApp.Grid.OpenRecord(0); - - LookupItem ownerId = new LookupItem {Name = "ownerid"}; - ownerId.Value = _xrmApp.Entity.GetHeaderValue(ownerId); - - _client.Browser.Driver.ClearFocus(); - - _xrmApp.Entity.SetHeaderValue(ownerId); - - var ownerIdValue = _xrmApp.Entity.GetHeaderValue(ownerId); - Assert.AreEqual(ownerId.Value, ownerIdValue); - - OptionSet priorityCode = new OptionSet - { - Name = "prioritycode", - Value = "High" - }; - _xrmApp.Entity.SetHeaderValue(priorityCode); - string priorityCodeValue = _xrmApp.Entity.GetHeaderValue(priorityCode); - Assert.AreEqual(priorityCode.Value, priorityCodeValue); - - _xrmApp.ThinkTime(2000); + } } } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenContact.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenContact.cs index 89dccbc9..2adbf0cf 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenContact.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenContact.cs @@ -3,13 +3,22 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; using System.Collections.Generic; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenContactUCI: TestsBase + public class OpenContactUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestOpenActiveContact() { @@ -21,10 +30,11 @@ public void UCITestOpenActiveContact() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); - - xrmApp.Grid.Search("David"); + + xrmApp.Grid.Search("Patrick"); xrmApp.Grid.OpenRecord(0); + } } @@ -40,7 +50,7 @@ public void UCITestOpenRecordSetNavigator() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); - + xrmApp.Grid.SwitchView("Active Contacts"); xrmApp.Grid.OpenRecord(0); @@ -61,6 +71,7 @@ public void UCITestOpenRecordSetNavigator() } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestOpenSubGridRecord() { var client = new WebClient(TestSettings.Options); @@ -72,23 +83,30 @@ public void UCITestOpenSubGridRecord() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); - - xrmApp.Grid.SwitchView("Active Contacts"); xrmApp.Grid.OpenRecord(0); - List rows = xrmApp.Entity.GetSubGridItems("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 + List rows = xrmApp.Entity.GetSubGridItems("RECENT OPPORTUNITIES"); - int rowCount = xrmApp.Entity.GetSubGridItemsCount("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 + int rowCount = xrmApp.Entity.GetSubGridItemsCount("RECENT CASES"); - if (rows.Count > 0) - xrmApp.Entity.OpenSubGridRecord("Opportunities", 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 + xrmApp.Entity.OpenSubGridRecord("RECENT OPPORTUNITIES", 0); xrmApp.ThinkTime(500); } } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestLookupSearch() { var client = new WebClient(TestSettings.Options); @@ -106,6 +124,7 @@ public void UCITestLookupSearch() LookupItem parentCustomerId = new LookupItem { Name = "parentcustomerid" }; xrmApp.Entity.SelectLookup(parentCustomerId); + // Bug: OpenQA.Selenium.NotFoundException: Lookup Entity Accounts not found xrmApp.Lookup.SelectRelatedEntity("Accounts"); xrmApp.Lookup.SwitchView("My Active Accounts"); @@ -117,6 +136,7 @@ public void UCITestLookupSearch() } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestLookupNew() { var client = new WebClient(TestSettings.Options); @@ -134,6 +154,7 @@ public void UCITestLookupNew() LookupItem parentCustomerId = new LookupItem { Name = "parentcustomerid" }; xrmApp.Entity.SelectLookup(parentCustomerId); + // Bug: OpenQA.Selenium.NotFoundException: Lookup Entity Accounts not found xrmApp.Lookup.SelectRelatedEntity("Accounts"); xrmApp.Lookup.New(); @@ -145,6 +166,7 @@ public void UCITestLookupNew() } } + [TestCategory("Fail - Bug")] [TestMethod] public void UCITestOpenContactRetrieveHeaderValues() { @@ -159,6 +181,8 @@ public void UCITestOpenContactRetrieveHeaderValues() 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); @@ -169,6 +193,7 @@ public void UCITestOpenContactRetrieveHeaderValues() } } + [TestCategory("Fail - Bug")] [TestMethod] public void UCITestOpenContactRelatedEntity() { @@ -185,37 +210,12 @@ public void UCITestOpenContactRelatedEntity() xrmApp.Entity.SelectTab("Related", "Leads"); + // Bug: OpenQA.Selenium.NotFoundException: Excel Templates button not found. Button names are case sensitive. Please check for proper casing of button name. xrmApp.RelatedGrid.ClickCommand("Excel Templates", "View All My Templates"); xrmApp.ThinkTime(2000); } } - - [TestMethod] - 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); - } - } } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenLead.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenLead.cs index 045fa3fe..52437aa7 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenLead.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenLead.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenLeadUCI: TestsBase + public class OpenLeadUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestOpenActiveLead() { @@ -21,7 +30,9 @@ public void UCITestOpenActiveLead() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); - xrmApp.Grid.Search("David"); + xrmApp.Grid.SwitchView("Open Leads"); + + xrmApp.Grid.Search("Debra"); xrmApp.Grid.OpenRecord(0); @@ -30,6 +41,7 @@ public void UCITestOpenActiveLead() } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestRetrieveBPFFields() { var client = new WebClient(TestSettings.Options); @@ -41,6 +53,8 @@ public void UCITestRetrieveBPFFields() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); + xrmApp.Grid.SwitchView("Open Leads"); + xrmApp.Grid.OpenRecord(0); LookupItem contact = new LookupItem() { Name = "parentcontactid" }; @@ -48,6 +62,7 @@ public void UCITestRetrieveBPFFields() xrmApp.BusinessProcessFlow.SelectStage("Qualify"); + // Bug: Lookups fail to resolve: System.NullReferenceException: Object reference not set to an instance of an object. string contactName = xrmApp.BusinessProcessFlow.GetValue(contact); string acctName = xrmApp.BusinessProcessFlow.GetValue(account); string budgetAmt = xrmApp.BusinessProcessFlow.GetValue("budgetamount"); @@ -70,6 +85,8 @@ public void UCITestPinBPFStage() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); + xrmApp.Grid.SwitchView("Open Leads"); + xrmApp.Grid.OpenRecord(0); xrmApp.BusinessProcessFlow.SelectStage("Qualify"); @@ -92,6 +109,8 @@ public void UCITestCloseBPFStage() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); + xrmApp.Grid.SwitchView("Open Leads"); + xrmApp.Grid.OpenRecord(0); xrmApp.BusinessProcessFlow.SelectStage("Qualify"); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenOpportunity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenOpportunity.cs index a7c5bc05..a50448d3 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenOpportunity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenOpportunity.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class OpenOpportunityUCI: TestsBase + public class OpenOpportunityUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestOpenActiveOpportunity() { @@ -21,10 +30,12 @@ public void UCITestOpenActiveOpportunity() xrmApp.Navigation.OpenSubArea("Sales", "Opportunities"); - xrmApp.Grid.Search("*Upgrade"); + xrmApp.Grid.Search("Will be ordering"); xrmApp.Grid.OpenRecord(0); + } + } [TestMethod] @@ -38,7 +49,7 @@ public void UCITestOpenOpportunityLookupAccount() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Opportunities"); - + xrmApp.Grid.SwitchView("Open Opportunities"); xrmApp.Grid.OpenRecord(0); @@ -63,13 +74,13 @@ public void UCITestOpenOpportunitySearchLookupAccount() 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.Lookup.Search(parentAccountId, "Test"); + xrmApp.Lookup.Search(parentAccountId, "Adventure"); xrmApp.ThinkTime(1000); } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SetValue.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SetValue.cs index e0ac989a..7e9ce47f 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SetValue.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SetValue.cs @@ -3,13 +3,20 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class SetValueUci : TestsBase + public class SetValueUci { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestSetValue() { @@ -21,10 +28,9 @@ public void UCITestSetValue() xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); - - xrmApp.Grid.SwitchView("My Active Accounts"); + xrmApp.Grid.OpenRecord(0); //xrmApp.Entity.SetValue("name", "Margaret"); } @@ -42,6 +48,8 @@ public void UCITestSelectOptionSetValue() xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); + xrmApp.Grid.SwitchView("Active Contacts"); + xrmApp.Grid.OpenRecord(0); xrmApp.ThinkTime(3000); @@ -50,6 +58,7 @@ public void UCITestSelectOptionSetValue() } } + [TestCategory("Fail - Bug")] [TestMethod] public void UCITestOpenLookupSetValue() { @@ -67,178 +76,18 @@ public void UCITestOpenLookupSetValue() xrmApp.Grid.OpenRecord(0); xrmApp.ThinkTime(500); - xrmApp.Entity.SetValue(new LookupItem { Name = "primarycontactid", Value = "Nancy Anderson (sample)" }); - xrmApp.ThinkTime(500); - } - } - - [TestMethod] - public void UCITestActivityPartySetValue() - { - 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", "Activities"); - - xrmApp.Grid.SwitchView("All Phone Calls"); - xrmApp.ThinkTime(500); - - xrmApp.Grid.OpenRecord(0); - xrmApp.ThinkTime(500); - - xrmApp.Entity.SetValue(new LookupItem[] { - new LookupItem { Name = "to", Value = "Adventure Works", Index = 0 }, - new LookupItem { Name = "to", Value = "", Index = 0 } }); - xrmApp.ThinkTime(500); - - xrmApp.Entity.SetValue(new LookupItem[] { - new LookupItem { Name = "from", Value = "Rene Valdes (sample)", Index = 0 } }); - xrmApp.ThinkTime(500); - - xrmApp.Entity.Save(); - } - } - - [TestMethod] - public void UCITestActivityPartySetValue_CaseSensitive() - { - 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", "Activities"); - - xrmApp.Grid.SwitchView("All Phone Calls"); - xrmApp.ThinkTime(500); - - xrmApp.Grid.OpenRecord(0); - xrmApp.ThinkTime(500); - - xrmApp.Entity.SetValue(new [] { - new LookupItem { Name = "to", Value = "Adventure Works", Index = 0 }, - new LookupItem { Name = "to", Value = "Nana Bule", Index = 0 } }); - xrmApp.ThinkTime(500); - - string toValue = xrmApp.Entity.GetValue(new LookupItem { Name = "to" }); - Assert.IsTrue(toValue.Contains("Adventure Works")); - Assert.IsFalse(toValue.Contains("adventure works")); - - Assert.IsTrue(toValue.Contains("Nana Bule")); - Assert.IsFalse(toValue.Contains("nana bule")); - } - } - - [TestMethod] - public void UCITestActivityPartyAddValues() - { - 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", "Activities"); - - xrmApp.Grid.SwitchView("All Phone Calls"); - xrmApp.ThinkTime(500); - - xrmApp.Grid.OpenRecord(0); - xrmApp.ThinkTime(500); - - xrmApp.Entity.AddValues(new LookupItem[] { - new LookupItem { Name = "to", Value = "Adventure Works", Index = 0 }, - new LookupItem { Name = "to", Value = "", Index = 1 } }); - xrmApp.ThinkTime(500); - - xrmApp.Entity.Save(); - } - } - - [TestMethod] - public void UCITestActivityPartyRemoveValues() - { - 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", "Activities"); + // In order to set the Primary Contact, that contact must be listed as an Account contact + xrmApp.RelatedGrid.ClickCommand("Add Existing Contact",null, true, "Contacts"); - xrmApp.Grid.SwitchView("All Phone Calls"); - xrmApp.ThinkTime(500); + // Need to handle the Lookup Records window and select a record + // Feature Request #854 - xrmApp.Grid.OpenRecord(0); - xrmApp.ThinkTime(500); + // To work around the bug below, clearvalue first to initalize the field and then set it + xrmApp.Entity.ClearValue(new LookupItem { Name = "primarycontactid" }); - xrmApp.Entity.RemoveValues(new LookupItem[] { - new LookupItem { Name = "to", Value = "Adventure Works", Index = 0 }, - new LookupItem { Name = "to", Value = "", Index = 0 } }); + // Bug - System.InvalidOperationException: No Results Matching Jim Were Found. #769 + xrmApp.Entity.SetValue(new LookupItem { Name = "primarycontactid", Value = "Jim" }); xrmApp.ThinkTime(500); - - xrmApp.Entity.Save(); - } - } - - [TestMethod] - public void UCITestActivityClearValues() - { - 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", "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); - } - } - - [TestMethod] - public void UCITestDateTimeSetValue() - { - 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.ThinkTime(500); - - xrmApp.Entity.SetValue("name", "Test EasyRepro Opportunity"); - - xrmApp.Entity.SetHeaderValue("estimatedclosedate", DateTime.Now); - xrmApp.ThinkTime(500); - - xrmApp.Entity.Save(); - - xrmApp.ThinkTime(2000); } } } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SpecialConfigurationTests/RandomAccountTest.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SpecialConfigurationTests/RandomAccountTest.cs index 73f0d04a..b2e2cc86 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SpecialConfigurationTests/RandomAccountTest.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/SpecialConfigurationTests/RandomAccountTest.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; +using System.Text; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class RandomAccountTest: TestsBase + public class RandomAccountTest { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCIRandomAccountTest() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddActivity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddActivity.cs index a8591f9c..e9f0e6e3 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddActivity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddActivity.cs @@ -1,11 +1,19 @@ using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class AddActivity: TestsBase + public class AddActivity { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestAccountAddAppointment() { @@ -18,6 +26,8 @@ public void UCITestAccountAddAppointment() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.AddAppointment("Entry into Zoo", "Microsoft", "45 minutes", "Entertainment"); @@ -40,6 +50,8 @@ public void UCITestAccountAddEmail() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.ClickEmailMenuItem(); @@ -49,18 +61,19 @@ public void UCITestAccountAddEmail() xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() { Name = Reference.Timeline.EmailBcc, - Values = new string[] { "Test Contact", "Jay Zee3" }, + Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" }, }); xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() { Name = Reference.Timeline.EmailCC, - Values = new string[] { "Test Contact", "Jay Zee3" }, - }); - xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() - { - Name = Reference.Timeline.EmailTo, - Values = new string[] { "Test Contact", "Jay Zee3" }, + Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" }, }); + // This fails as it already has a value. + //xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() + //{ + // Name = Reference.Timeline.EmailTo, + // Values = new string[] { "Test Contact", "Jay Zee3" }, + //}); xrmApp.Timeline.SaveAndCloseEmail(); @@ -80,6 +93,8 @@ public void UCITestAccountGetMultiSelectEmail() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.ClickEmailMenuItem(); @@ -89,18 +104,19 @@ public void UCITestAccountGetMultiSelectEmail() xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() { Name = Reference.Timeline.EmailBcc, - Values = new string[] { "Test Contact", "Jay Zee3" }, + Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" }, }); xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() { Name = Reference.Timeline.EmailCC, - Values = new string[] { "Test Contact", "Jay Zee3" }, - }); - xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() - { - Name = Reference.Timeline.EmailTo, - Values = new string[] { "Test Contact", "Jay Zee3" }, + Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" }, }); + // This fails as it already has a value. + //xrmApp.Timeline.AddEmailContacts(new MultiValueOptionSet() + //{ + // Name = Reference.Timeline.EmailTo, + // Values = new string[] { "Test Contact", "Jay Zee3" }, + //}); var multiselectedItems = xrmApp.Timeline.GetEmail( new MultiValueOptionSet() @@ -113,6 +129,7 @@ public void UCITestAccountGetMultiSelectEmail() } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestAccountRemoveMultiSelectEmail() { var client = new WebClient(TestSettings.Options); @@ -124,6 +141,8 @@ public void UCITestAccountRemoveMultiSelectEmail() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.ClickEmailMenuItem(); @@ -132,15 +151,16 @@ public void UCITestAccountRemoveMultiSelectEmail() 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" }, + Name = Reference.Timeline.EmailCC, + Values = new string[] { "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 = Reference.Timeline.EmailTo, - Values = new string[] { "Test Contact", "Jay Zee3" }, + Name = Reference.Timeline.EmailCC, + Values = new string[] { "Jim Glynn (sample)", "Nancy Anderson (sample)" }, }); xrmApp.ThinkTime(3000); @@ -160,6 +180,8 @@ public void UCITestAccountAddPhoneCall() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.AddPhoneCall("Call Zoo primates section", "425-425-1235", "Specifically call the primate that can handle a phone !", "15 minutes"); @@ -182,6 +204,8 @@ public void UCITestAccountAddTask() xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); + xrmApp.Grid.SwitchView("Active Accounts"); + xrmApp.Grid.OpenRecord(0); xrmApp.Timeline.AddTask("Feed the Animals", "Make sure no one is looking while feeding", "5 minutes"); diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddNote.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddNote.cs index c750e5ea..dcc79ee1 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddNote.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddNote.cs @@ -1,11 +1,19 @@ using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class AddNote: TestsBase + public class AddNote { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestAccountAddNote() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddPost.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddPost.cs index d8ca291d..2338cfcd 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddPost.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Timeline/AddPost.cs @@ -1,11 +1,19 @@ using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class AddPostUCI: TestsBase + public class AddPostUCI { + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestAccountAddPost() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/UnifiedInterface.orderedtest b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/UnifiedInterface.orderedtest index 9635b9ad..60329209 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/UnifiedInterface.orderedtest +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/UnifiedInterface.orderedtest @@ -1,7 +1,7 @@  - + - + @@ -14,15 +14,17 @@ - - - - + + + + - + + + @@ -38,10 +40,10 @@ - + - + diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateAccount.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateAccount.cs index f431229c..ce887634 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateAccount.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateAccount.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class UpdateAccountUCI: TestsBase + public class UpdateAccountUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestUpdateActiveAccount() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateCase.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateCase.cs index 043e1aa2..bef2250d 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateCase.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateCase.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class UpdateCaseUCI : TestsBase + public class UpdateCaseUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestUpdateActiveCase() { diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateContact.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateContact.cs index b991a14d..8bac4dfc 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateContact.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateContact.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class UpdateContactUCI: TestsBase + public class UpdateContactUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestUpdateActiveContact() { @@ -21,11 +30,14 @@ public void UCITestUpdateActiveContact() 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(); @@ -46,7 +58,9 @@ public void UCITestUpdateActiveContactSetHeaderValues() xrmApp.Navigation.OpenSubArea("Service", "Contacts"); - xrmApp.RelatedGrid.OpenGridRow(0); + xrmApp.Grid.SwitchView("Active Contacts"); + + xrmApp.Grid.OpenRecord(0); //xrmApp.Entity.SetHeaderValue("emailaddress1", String.Format("{0}@{1}.com", TestSettings.GetRandomString(8, 8), TestSettings.GetRandomString(5, 7))); xrmApp.Entity.SetHeaderValue("telephone1", "555-555-5555"); @@ -59,6 +73,7 @@ public void UCITestUpdateActiveContactSetHeaderValues() } [TestMethod] + [TestCategory("Fail - Bug")] public void UCITestUpdateClearFields() { var client = new WebClient(TestSettings.Options); @@ -66,20 +81,23 @@ public void UCITestUpdateClearFields() { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); - xrmApp.Navigation.OpenApp(UCIAppName.CustomerService); + xrmApp.Navigation.OpenApp(UCIAppName.Sales); - xrmApp.Navigation.OpenSubArea("Service", "Contacts"); + xrmApp.Navigation.OpenSubArea("Sales", "Contacts"); - xrmApp.RelatedGrid.OpenGridRow(0); + xrmApp.Grid.SwitchView("Active Contacts"); + + xrmApp.Grid.OpenRecord(0); xrmApp.Entity.ClearValue("telephone1"); + // Bug: When LookupItem account = new LookupItem() { Name = "parentcustomerid" }; xrmApp.Entity.ClearValue(account); OptionSet preferredContact = new OptionSet() { Name = "preferredcontactmethodcode" }; xrmApp.Entity.ClearValue(preferredContact); - + xrmApp.Entity.SetValue("telephone1", "555-555-5555"); preferredContact.Value = "Email"; diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateLead.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateLead.cs index 81380f95..90087022 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateLead.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateLead.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class UpdateLeadUCI: TestsBase + public class UpdateLeadUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestUpdateActiveLead() { @@ -21,6 +30,8 @@ public void UCITestUpdateActiveLead() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); + xrmApp.Grid.SwitchView("Open Leads"); + xrmApp.Grid.OpenRecord(0); xrmApp.ThinkTime(3000); @@ -45,21 +56,13 @@ public void UCITestOpenActiveLeadBPF() xrmApp.Navigation.OpenSubArea("Sales", "Leads"); - xrmApp.Grid.OpenRecord(0); - - LookupItem acct = new LookupItem(); - acct.Name = "parentaccountid"; - acct.Value = "Adventure Works"; + xrmApp.Grid.SwitchView("Open Leads"); - LookupItem contact = new LookupItem(); - contact.Name = "parentcontactid"; - contact.Value = "Nancy Anderson (sample)"; + xrmApp.Grid.OpenRecord(0); xrmApp.BusinessProcessFlow.SelectStage("Qualify"); - xrmApp.BusinessProcessFlow.SetValue(acct); - xrmApp.BusinessProcessFlow.SetValue(contact); - xrmApp.BusinessProcessFlow.SetValue("budgetamount", "100.00"); + xrmApp.BusinessProcessFlow.SetValue("budgetamount", "1000"); xrmApp.ThinkTime(3000); } diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateOpportunity.cs b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateOpportunity.cs index 088695be..e5bde4b1 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateOpportunity.cs +++ b/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Update/UpdateOpportunity.cs @@ -3,12 +3,21 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Dynamics365.UIAutomation.Api.UCI; +using Microsoft.Dynamics365.UIAutomation.Browser; +using System; +using System.Security; namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI { [TestClass] - public class UpdateOpportunityUCI: TestsBase + public class UpdateOpportunityUCI { + + private readonly SecureString _username = System.Configuration.ConfigurationManager.AppSettings["OnlineUsername"].ToSecureString(); + private readonly SecureString _password = System.Configuration.ConfigurationManager.AppSettings["OnlinePassword"].ToSecureString(); + private readonly SecureString _mfaSecretKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecretKey"].ToSecureString(); + private readonly Uri _xrmUri = new Uri(System.Configuration.ConfigurationManager.AppSettings["OnlineCrmUrl"].ToString()); + [TestMethod] public void UCITestUpdateActiveOpportunity() { @@ -21,6 +30,8 @@ public void UCITestUpdateActiveOpportunity() xrmApp.Navigation.OpenSubArea("Sales", "Opportunities"); + xrmApp.Grid.SwitchView("Open Opportunities"); + xrmApp.Grid.OpenRecord(0); xrmApp.ThinkTime(3000);