microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
513 stars 285 forks source link

[HOW-TO] CREATE USER FROM THIRD PARTY URL THEN VERIFYING IN D365 ENVI #1337

Open brianb23 opened 1 year ago

brianb23 commented 1 year ago

1337

I want to create an Account record from our third-party URL. The question is where do I put my code? 'coz the one below does not work. Hope someone can help me. Thanks!

[TestMethod] public void CreateSampleAccout(LoginRedirectEventArgs args) { var client = new WebClient(TestSettings.Options); using (var xrmApp = new XrmApp(client)) {

            var d = args.Driver;

            d.Navigate().GoToUrl("THIRD-PARTY URL");
            d.FindElement(By.XPath(AppReference.Accounts.ReqInfo)).Click();
           d.FindElement(By.XPath(AppReference.Accounts.FirstName)).SendKeys("FBryOne");
           d.FindElement(By.XPath(AppReference.Accounts.LastName)).SendKeys("LBryOne");
           d.FindElement(By.XPath(AppReference.Accounts.EmailAdd)).SendKeys("bry1@test.com");
           d.FindElement(By.XPath(AppReference.Accounts.ZipCode)).SendKeys("30231");
           d.FindElement(By.XPath(AppReference.Accounts.SubmitBtn)).Click();

}

Shakevg commented 1 year ago

@brianb23 Could you explain what issue you have? What error did you get?

brianb23 commented 1 year ago

@brianb23 Could you explain what issue you have? What error did you get?

The code works, I just needed to do some tweaks on my codes. My question right now is how I open the newly created Account/Contact in D365? Please see below for the process.

  1. Create Account/Contact using our third-party URL
  2. Verifying that created Account/Contact record in D365

I just wanted to do those 2 steps in one run of the script. Thanks!

Shakevg commented 1 year ago

@brianb23 You can use something like this to check accoun\contact (where "name" - account name attribute) https://github.com/microsoft/EasyRepro/blob/develop/Microsoft.Dynamics365.UIAutomation.Sample/UCI/Read/OpenAccount.cs

var accountName = "Account";

xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

xrmApp.Navigation.OpenApp(UCIAppName.Sales);

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

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

var gridItems = xrmApp.Grid.GetGridItems();

var accountFound = gridItems.FirstOrDefault(x => x.GetAttribute<string>("name") == accountName) != null;
brianb23 commented 1 year ago

I would like to try this one, but our environment has set up as the View for "My Account" for an instance is hidden. The only way you can open the created Account record is via the Advance Find. And if I create an Account from third-party URL, the account creator is not set as endUser, it's different User. So the way that I think of is using query "created on = today". If you can help me with this.

Shakevg commented 1 year ago

Advanced search is not covered, for now, you can just implement this method yourself

brianb23 commented 1 year ago

I will try this one. Thanks. So we don't have yet covered the Advance Find functionality for now?

Shakevg commented 1 year ago

I will try this one. Thanks. So we don't have yet covered the Advance Find functionality for now?

Microsoft.Bcl.AsyncInterfaces

brianb23 commented 1 year ago

Hi! I noticed that the GlobalSearch is not working. Is it because of the Release Wave 2 update?

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

        using (var xrmApp = new XrmApp(client))
        {
            xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);
            xrmApp.Navigation.OpenApp(UCIAppName.Sales);
            xrmApp.ThinkTime(2000);
            xrmApp.Navigation.OpenGlobalSearch();
            xrmApp.GlobalSearch.FilterWith("Contact");
            xrmApp.GlobalSearch.Search("bry4@test.com");  //not working, it's not searching the record
            xrmApp.ThinkTime(2000);

        }
    }
Shakevg commented 1 year ago

Hi! I noticed that the GlobalSearch is not working. Is it because of the Release Wave 2 update?

public void UCIOpeningContactRecord()

brianb23 Create separate issue