Skip to content

Commit

Permalink
Release for v9.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dtu11 committed Dec 4, 2017
1 parent 963182b commit 18c1e82
Show file tree
Hide file tree
Showing 21 changed files with 364 additions and 180 deletions.
39 changes: 29 additions & 10 deletions Microsoft.Dynamics365.UIAutomation.Api/DTOs/XrmElementReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static class Elements
{ "Dialog_ViewRecords" , "id(\"reportView\")"},
{ "Dialog_AddUserHeader" , "id(\"addUserDescription\")"},
{ "Dialog_AddUser" , "id(\"buttonNext\")"},
{ "Dialog_AddConnectionHeader", "id(\"EntityTemplateTab.connection.NoRelationship.Form.Mscrm.Form.connection.MainTab-title\")" },
{ "Dialog_AddConnectionSave", "id(\"connection|NoRelationship|Form|Mscrm.Form.connection.SaveAndClose-Large\")" },
{ "Dialog_RoleLookupButton", "id(\"record2roleid\")" },
{ "Dialog_RoleLookupTable", "id(\"record2roleid_IMenu\")" },

//GuidedHelp
{ "GuidedHelp_MarsOverlay" , "id(\"marsOverlay\")"},
Expand Down Expand Up @@ -90,7 +94,7 @@ public static class Elements
{ "Grid_FirstPage" , "id(\"fastRewind\")"},
{ "Grid_NextPage" , "id(\"_nextPageImg\")"},
{ "Grid_PreviousPage" , "id(\"_prevPageImg\")" },
{ "Grid_FindCriteriaImg" , "id(\"crmGrid_findCriteriaImg\")"},
{ "Grid_FindCriteriaImg" , "id(\"crmGrid_findCriteriaButton\")"},
{ "Grid_FindCriteria" , "id(\"crmGrid_findCriteria\")"},
{ "Grid_GridBodyTable" , "id(\"gridBodyTable\")" },
{ "Grid_DefaultViewIcon" , "id(\"defaultViewIcon\")" },
Expand All @@ -99,7 +103,6 @@ public static class Elements
{ "Grid_ViewSelectorContainer" , "id(\"viewSelectorContainer\")" },
{ "Grid_FirstRow", "id(\"gridBodyTable\")/tbody/tr[1]"},


//Entity
{ "Entity_Form" , "id(\"tab0\")"},
{ "Entity_Close" , "id(\"closeButton\")"},
Expand Down Expand Up @@ -155,17 +158,20 @@ public static class Elements
{ "Login_OldPassword", "id(\"cred_password_inputtext\")"},
{ "Login_SignIn", "id(\"cred_sign_in_button\")"},
{ "Login_CrmMainPage", "id(\"crmTopBar\")"},
{ "Login_StaySignedIn", "id(\"idSIButton9\")"},

//Notification
{ "Notification_AppMessageBar", "id(\"crmAppMessageBar\")"},
{ "Notification_Close", "id(\"crmAppMessageBarCloseButton\")"},

//Office365Navigation
{ "Office365Navigation_NavMenu", "id(\"O365_MainLink_NavMenu\")"},
{ "Office365Navigation_NavMenu", "id(\"TabAppSwitcherNode\")"},

//QuickCreate
{ "QuickCreate_Cancel", "id(\"globalquickcreate_cancel_button_NavBarGloablQuickCreate\")"},
{ "QuickCreate_Save", "id(\"globalquickcreate_save_button_NavBarGloablQuickCreate\")"},
{ "QuickCreate_Save", "id(\"globalquickcreate_save_button_NavBarGloablQuickCreate\")"},
{ "QuickCreate_EnittyContainer", "id(\"actionGroupControl\")"},


//LookUp
{ "LookUp_SelObjects", "id(\"selObjects\")"},
Expand All @@ -176,7 +182,6 @@ public static class Elements
{ "LookUp_Add", "id(\"btnAdd\")"},
{ "LookUp_Begin", "id(\"butBegin\")"},


//Reports
{ "Report_Close", "id(\"btnCancel\")"},
{ "Report_RunReport", "id(\"btnRun\")"},
Expand All @@ -202,8 +207,7 @@ public static class Elements
{ "O365_UserName", "id(\"username\")"},
{ "O365_License", "id(\"productsinfo\")/div[4]/div[1]/div/div[1]/div[2]/label"},
{ "O365_Add", "id(\"AddUserSubmit\")"},

};
};

public static Dictionary<string, string> ElementId = new Dictionary<string, string>()
{
Expand All @@ -225,6 +229,9 @@ public static class Elements
{ "Dialog_Description" , "description_id"},
{ "Dialog_UserOrTeamLookupId" , "systemuserview_id"},

//Add Connection
{ "Dialog_ConnectionDescription" , "description"},

//Entity
{ "Entity_TabId" , "[NAME]_TAB_header_image_div"},

Expand Down Expand Up @@ -253,7 +260,7 @@ public static class Elements
{ "Process_Category", "WorkflowCategory"},
{ "Process_Entity", "PrimaryEntity"},

};
};

public static Dictionary<string, string> CssClass = new Dictionary<string, string>()
{
Expand All @@ -267,6 +274,7 @@ public static class Elements

//Dialogs
{ "Dialog_SwitchProcessTitleClass" , "ms-crm-ProcessSwitcher-ProcessTitle"},
{ "Dialog_SelectedRadioButton" , "ms-crm-ProcessSwitcher-Process-Selected"},

//SetValue
{ "SetValue_LookupRenderClass" , "Lookup_RenderButton_td"},
Expand All @@ -281,7 +289,7 @@ public static class Elements

//Grid
{ "Grid_ViewContainerClass" , "ms-crm-VS-Menu"},
{ "Grid_OpenChartClass" , "ms-crm-ImageStrip-navLeft"},
{ "Grid_OpenChartClass" , "ms-crm-ImageStrip-navLeft_VisualRefresh"},
{ "Grid_CloseChartClass" , "ms-crm-PaneChevron"},
{ "Grid_SortColumnClass" , "ms-crm-List-Sortable"},
{ "Grid_DataColumnClass" , "ms-crm-List-DataColumn"},
Expand Down Expand Up @@ -328,6 +336,7 @@ public static class Dialogs
public static string DeleteHeader = "Dialog_DeleteHeader";
public static string WorkflowHeader = "Dialog_WorkflowHeader";
public static string ProcessFlowHeader = "Dialog_ProcessFlowHeader";
public static string AddConnectionHeader = "Dialog_AddConnectionHeader";

public static class CloseOpportunity
{
Expand All @@ -336,6 +345,14 @@ public static class CloseOpportunity
public static string DescriptionId = "Dialog_Description";
public static string Ok = "Dialog_CloseOpportunityOk";
}

public static class AddConnection
{
public static string DescriptionId = "Dialog_ConnectionDescription";
public static string Save = "Dialog_AddConnectionSave";
public static string RoleLookupButton = "Dialog_RoleLookupButton";
public static string RoleLookupTable = "Dialog_RoleLookupTable";
}
public static class Assign
{
public static string Ok = "Dialog_AssignOk";
Expand All @@ -348,6 +365,7 @@ public static class Delete
public static class SwitchProcess
{
public static string Process = "Dialog_SwitchProcessTitleClass";
public static string SelectedRadioButton = "Dialog_SelectedRadioButton";
}
public static class DuplicateDetection
{
Expand Down Expand Up @@ -392,6 +410,7 @@ public static class QuickCreate
{
public static string Cancel = "QuickCreate_Cancel";
public static string Save = "QuickCreate_Save";
public static string EntityContainer = "QuickCreate_EnittyContainer";
}
public static class Office365Navigation
{
Expand Down Expand Up @@ -595,7 +614,7 @@ public static class Login
public static string OldSignInPassword = "Login_OldPassword";
public static string SignIn = "Login_SignIn";
public static string CrmMainPage = "Login_CrmMainPage";

public static string StaySignedIn = "Login_StaySignedIn";
}
public static class Report
{
Expand Down
23 changes: 23 additions & 0 deletions Microsoft.Dynamics365.UIAutomation.Api/DTOs/XrmListItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using OpenQA.Selenium;

namespace Microsoft.Dynamics365.UIAutomation.Api
{
/// <summary>
/// Encapsulates the list item in the text search dropdown/list
/// </summary>
public class XrmListItem
{
/// <summary>
/// The title which shows up in the text search dropdown/list
/// </summary>
public string Title { get; set; }

/// <summary>
/// The clickable element underlying the title in the text search dropdown/list
/// </summary>
public IWebElement Element { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="Controls\CrmControls.cs" />
<Compile Include="DTOs\XrmAppNotification.cs" />
<Compile Include="DTOs\XrmElementReference.cs" />
<Compile Include="DTOs\XrmGridItem.cs" />
<Compile Include="DTOs\XrmInstanceInfo.cs" />
<Compile Include="DTOs\XrmLink.cs" />
<Compile Include="DTOs\XrmListItem.cs" />
<Compile Include="DTOs\XrmPerformanceMarker.cs" />
<Compile Include="LoginRedirectEventArgs.cs" />
<Compile Include="Office365Browser.cs" />
Expand Down
19 changes: 12 additions & 7 deletions Microsoft.Dynamics365.UIAutomation.Api/Pages/LoginPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ public BrowserCommandResult<LoginResult> Login()

public BrowserCommandResult<LoginResult> Login(SecureString username, SecureString password)
{
return this.Execute("Login", this.Login, new Uri(Constants.DefaultLoginUri), username, password, default(Action<LoginRedirectEventArgs>));
return this.Execute(GetOptions("Login"), this.Login, new Uri(Constants.DefaultLoginUri), username, password, default(Action<LoginRedirectEventArgs>));
}

public BrowserCommandResult<LoginResult> Login(SecureString username, SecureString password, Action<LoginRedirectEventArgs> redirectAction)
{
return this.Execute("Login", this.Login, new Uri(Constants.DefaultLoginUri), username, password, redirectAction);
return this.Execute(GetOptions("Login"), this.Login, new Uri(Constants.DefaultLoginUri), username, password, redirectAction);
}

public BrowserCommandResult<LoginResult> Login(Uri uri)
{
if (this.Browser.Options.Credentials.IsDefault)
throw new InvalidOperationException("The default login method cannot be invoked without first setting credentials on the Browser object.");

return this.Execute("Login", this.Login, uri, this.Browser.Options.Credentials.Username, this.Browser.Options.Credentials.Password, default(Action<LoginRedirectEventArgs>));
return this.Execute(GetOptions("Login"), this.Login, uri, this.Browser.Options.Credentials.Username, this.Browser.Options.Credentials.Password, default(Action<LoginRedirectEventArgs>));
}
/// <summary>
/// Login Page
Expand All @@ -68,7 +68,7 @@ public BrowserCommandResult<LoginResult> Login(Uri uri)
/// <example>xrmBrowser.LoginPage.Login(_xrmUri, _username, _password);</example>
public BrowserCommandResult<LoginResult> Login(Uri uri, SecureString username, SecureString password)
{
return this.Execute("Login", this.Login, uri, username, password, default(Action<LoginRedirectEventArgs>));
return this.Execute(GetOptions("Login"), this.Login, uri, username, password, default(Action<LoginRedirectEventArgs>));
}

/// <summary>
Expand All @@ -81,7 +81,7 @@ public BrowserCommandResult<LoginResult> Login(Uri uri, SecureString username, S
/// <example>xrmBrowser.LoginPage.Login(_xrmUri, _username, _password, ADFSLogin);</example>
public BrowserCommandResult<LoginResult> Login(Uri uri, SecureString username, SecureString password, Action<LoginRedirectEventArgs> redirectAction)
{
return this.Execute("Login", this.Login, uri, username, password, redirectAction);
return this.Execute(GetOptions("Login"), this.Login, uri, username, password, redirectAction);
}

private LoginResult Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action<LoginRedirectEventArgs> redirectAction)
Expand All @@ -106,7 +106,6 @@ private LoginResult Login(IWebDriver driver, Uri uri, SecureString username, Sec
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.UserId])).SendKeys(Keys.Enter);
redirectToNewPassword = true;
Thread.Sleep(2000);

}
else
{
Expand All @@ -117,7 +116,7 @@ private LoginResult Login(IWebDriver driver, Uri uri, SecureString username, Sec
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.OldSignInUserId])).SendKeys(Keys.Tab);
}

//If expecting redirect then wait for redirect to trigger
//If expecting redirect then wait for redirect to trigger
if (redirectAction != null)
{
//Wait for redirect to occur.
Expand All @@ -134,6 +133,12 @@ private LoginResult Login(IWebDriver driver, Uri uri, SecureString username, Sec
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.Password])).SendKeys(password.ToUnsecureString());
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.Password])).SendKeys(Keys.Tab);
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.Password])).Submit();

if (driver.IsVisible(By.XPath(Elements.Xpath[Reference.Login.StaySignedIn])))
{
driver.ClickWhenAvailable(By.XPath(Elements.Xpath[Reference.Login.StaySignedIn]));
driver.FindElement(By.XPath(Elements.Xpath[Reference.Login.StaySignedIn])).Submit();
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Office365NavigationPage
public Office365NavigationPage(InteractiveBrowser browser)
: base(browser)
{
SwitchToDefaultContent();
}

private static BrowserCommandOptions NavigationRetryOptions
Expand All @@ -31,9 +32,9 @@ private static BrowserCommandOptions NavigationRetryOptions
}
}

public BrowserCommandResult<Dictionary<string, Uri>> OpenWaffleMenu()
public BrowserCommandResult<bool> OpenO365App(string appName)
{
return this.Execute(NavigationRetryOptions, driver =>
var menu = this.Execute(NavigationRetryOptions, driver =>
{
var dictionary = new Dictionary<string, Uri>();
Expand All @@ -52,8 +53,21 @@ private static BrowserCommandOptions NavigationRetryOptions
}
}
return dictionary;
Uri appUri;
if (dictionary.TryGetValue(appName, out appUri))
{
driver.Navigate().GoToUrl(appUri);
return true;
}
else
{
throw new Exception("App Name not found in O365 Menu.");
}
});

return menu;
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ internal BrowserCommandResult<bool> SetCalenderValue(string field, string value)
var fieldElement = driver.ClickWhenAvailable(By.Id(field));
fieldElement.FindElement(By.TagName("input")).Clear();
fieldElement.FindElement(By.TagName("input")).SendKeys(value);
fieldElement.Click();
fieldElement.FindElement(By.TagName("input")).SendKeys(value, true);
}
else
throw new InvalidOperationException($"Field: {field} Does not exist");
Expand Down
Loading

0 comments on commit 18c1e82

Please sign in to comment.