forked from microsoft/EasyRepro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Multi-Factor Authentication (Using Otp.NET)
- Loading branch information
1 parent
a08fb39
commit 4a6d996
Showing
12 changed files
with
234 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
265 changes: 162 additions & 103 deletions
265
Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
Microsoft.Dynamics365.UIAutomation.Sample/UCI/Login/Login.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Security; | ||
using Microsoft.Dynamics365.UIAutomation.Api.UCI.Extensions; | ||
using Microsoft.Dynamics365.UIAutomation.Api.UCI; | ||
using Microsoft.Dynamics365.UIAutomation.Browser; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Support.Extensions; | ||
using Guid = System.Guid; | ||
|
||
namespace Microsoft.Dynamics365.UIAutomation.Sample.UCI.Login | ||
{ | ||
[TestClass] | ||
public class Login | ||
{ | ||
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"]); | ||
private readonly SecureString _mfaSecrectKey = System.Configuration.ConfigurationManager.AppSettings["MfaSecrectKey"].ToSecureString(); | ||
|
||
// Allow trigger to complete the set value action | ||
private string _enter(string value) => value + Keys.Enter; | ||
private string _timed(string value) => $"{value} {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}"; | ||
|
||
[TestMethod] | ||
public void MultiFactorLogin() | ||
{ | ||
var options = TestSettings.Options; | ||
options.TimeFactor = 0.5f; | ||
var client = new WebClient(options); | ||
using (var xrmApp = new XrmApp(client)) | ||
{ | ||
xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecrectKey); | ||
|
||
xrmApp.Navigation.OpenApp(UCIAppName.Sales); | ||
|
||
xrmApp.Navigation.OpenSubArea("Sales", "Accounts"); | ||
|
||
xrmApp.Grid.SwitchView("All Accounts"); | ||
|
||
xrmApp.CommandBar.ClickCommand("New"); | ||
|
||
xrmApp.Entity.SetValue("name", _timed("Test API Account")); | ||
xrmApp.Entity.SetValue("telephone1", "555-555-5555"); | ||
//xrmApp.Entity.SetValue(new BooleanItem { Name = "creditonhold", Value = true }); | ||
} | ||
} | ||
} | ||
} |