microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
518 stars 288 forks source link

Lookup doesn't work in v9.1 #371

Closed SachchinAnnam closed 5 years ago

SachchinAnnam commented 5 years ago

Hello @ggeiszle and @TYLEROL I tried below snippet for lookup but it didn't worked: xrmApp.Entity.SetValue({ Name = "language", Value = "English"}); Even SelectLookup isn't helping. xrmApp.Entity.SelectLookup("language");

Where language is the field name. Please help with some options.

dnamrgrts commented 5 years ago

Hello, xrmApp.Entity.SelectLookup(string field, int index);
For Example-> xrmApp.Entity.SelectLookup("language", 0); select the first record of your Look up

SachchinAnnam commented 5 years ago

Hello @dnamrgrts
It give error as 'No overload for method 'SelectLookup' takes 2 arguments '

SachchinAnnam commented 5 years ago

I modified my scripts:

            LookupItem language = new LookupItem { Name = "language", Value = "English" };
            xrmApp.Entity.SetValue(language);
          // **Above snippet works**

            LookupItem country = new LookupItem { Name = "im360_countryid", Value = "Brazil" };
            xrmApp.Entity.SetValue(country);
        // **Above snippet works**

            //xrmApp.ThinkTime(2000);
            LookupItem parentID = new LookupItem { Name = "parentcustomerid", Value = "LARSEN & TOUBRO INFOTECH LIMITED" };
            xrmApp.Entity.SetValue(parentID); // as per below exception - it fails on this line
        // **Above snippet doesn't work**

Here is the exception Test Name: UCITestCreateContact Test FullName: Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact Test Source: D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Sample\UCI\Create\CreateContact.cs : line 22 Test Outcome: Failed Test Duration: 0:01:15.7415573

Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.Click() at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.Click(IWebElement element, Boolean ignoreStaleElementException) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\Extensions\SeleniumExtensions.cs:line 41 at Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.<>c__DisplayClass61_0.<SetValue>b__0(IWebDriver driver) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\WebClient.cs:line 1587 at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand1.ExecuteCommand(IWebDriver driver, Object[] params) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\DelegateBrowserCommand.cs:line 28 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 136 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute(IWebDriver driver) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 36 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserPage.cs:line 182 at Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.SetValue(LookupItem control, Int32 index) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\WebClient.cs:line 1567 at Microsoft.Dynamics365.UIAutomation.Api.UCI.Entity.SetValue(LookupItem control, Int32 index) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\Elements\Entity.cs:line 302 at Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact() in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Sample\UCI\Create\CreateContact.cs:line 47 Result Message: Test method Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact threw exception: System.InvalidOperationException: unknown error: Element is not clickable at point (346, 64). Other element would receive the click: New (Session info: chrome=72.0.3626.96) (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.16299 x86_64)

nlipkow commented 5 years ago

I'm running into similar issues here:

LookupItem item = new LookupItem { Name = "pricelevelid", Value = "de_sales_2016"};
xrmBrowser.Entity.SetValue(item);
xrmBrowser.ThinkTime(2000);

LookupItem item = new LookupItem { Name = "customerid", Value = "Nancy Anderson (sample)"};
xrmBrowser.Entity.SetValue(item);

The first instruction to set the value for "pricelevelid" works perfectly fine. The second however fails and I get the following exception: System.InvalidOperationException: List does not contain a record with the name: Nancy Anderson (sample)

The image below though indicates that it does exist. I had for some reason also some undeterministic behaviour while debugging through this error and had the value "Nancy Anderson (sample)" accepted before but could not reproduce it. Maybe this is related to some sort of race condition between the WebClient and the query?

I'm also on the current branch releases/v9.1 image

SachchinAnnam commented 5 years ago

@TYLEROL : Please help us with any workarounds as we are stuck with this lookup.

markcunninghamuk commented 5 years ago

Any updates on this, not working for us either

SachchinAnnam commented 5 years ago

Hello @TYLEROL Any workaround for this bug?

Appreciate your assistance on this.

markcunninghamuk commented 5 years ago

There is a workaround I added called highlight record. You can then use the 'edit command after it is selected.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Sachchin Annam notifications@github.com Sent: Wednesday, April 10, 2019 7:32:05 PM To: Microsoft/EasyRepro Cc: markcunninghamuk; Comment Subject: Re: [Microsoft/EasyRepro] Lookup doesn't work in v9.1 (#371)

Hello @TYLEROLhttps://github.com/TYLEROL Any workaround for this bug?

Appreciate your assistance on this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/EasyRepro/issues/371#issuecomment-481809903, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVS8CB80ndQDbJzrdpsXfL6OzIXDQ1iSks5vfi4lgaJpZM4azrMo.

SachchinAnnam commented 5 years ago

@markcunninghamuk: is your workaround related to selecting Account from lookup field?

BillOwens commented 5 years ago

I am having the same issue. Are there any updates as we are stuck now,

BillOwens commented 5 years ago

I was able to get my test to work. I added a ThinkTime afterwards and it worked. I beleive we are just not giving the control enough time to fully function.

LookupItem contact = new LookupItem { Name = "primarycontactid", Value = "User, UITesting" };
xrmApp.Entity.SetValue(contact);
xrmApp.ThinkTime(3000);
ghost commented 5 years ago

i trying this in the V9.1 but Unified Interface doesn´t work... anyone with the same problem?

markcunninghamuk commented 5 years ago

William Owens is correct. It is much more reliable with a thinktime added.

Get Outlook for Androidhttps://aka.ms/ghei36


From: MMCod notifications@github.com Sent: Tuesday, April 23, 2019 3:11:01 PM To: Microsoft/EasyRepro Cc: markcunninghamuk; Mention Subject: Re: [Microsoft/EasyRepro] Lookup doesn't work in v9.1 (#371)

i trying this in the V9.1 but Unified Interface doesn´t work... anyone with the same problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/EasyRepro/issues/371#issuecomment-485819808, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFKLYCFGIAG7U35GR2ONT5DPR4KHLANCNFSM4GWOWMUA.

SachchinAnnam commented 5 years ago

It works well, when the lookup has relatively small number of items.. Like while selecting Language or Currency. But it fails with the below error when we try to select Account where lookup has large number of items. _List does not contain a record with the name: abc_AccountName_

silverbrewer07 commented 5 years ago

I am also having this issue. I agree with Sachin it works great when you have a small list. The more frustrating issue for me is it was working fine and just stopped working - guess it could be as we have added more records. The more frustrating part is if you debug the test and get the error and continue it ends up setting the value. This has us stopped in automated testing in the UI.

Thanks!!

silverbrewer07 commented 5 years ago

After some additional testing it actually types the field and the option is displayed in the lookup box but it just doesn't get selected. I have as a temporary work around just used javascript to set the field values but it does not support any conditional testing. This issue has gotten much worse since the latest update in UCI

SachchinAnnam commented 5 years ago

Do we have any workaround as we are stuck with lookup selection in almost all the scripts? @TYLEROL : Please help us.

GowriRamanujapu commented 5 years ago

I am having the same issue. Not able to select a value from look up . CRM FS version is 8.6.0.274

SachchinAnnam commented 5 years ago

Do we have any updates, as most of us are facing the same issue and not able to proceed further due to the underline issue.

jlattimer commented 5 years ago

@nlipkow your issue might be because of the way the lookup is set using XrmBrowser. Currently the behavior will open the dialog with the top X results and then attempt to do a case sensitive match on the results. So if Price Level only has a few values, it stands to reason it would be in the list of what is initially displayed before a search. In the case of the Contact lookup, is Nancy Anderson isn't in the initial list of records it will fail with the error you're seeing. Submitted PR 479 for this.

jlattimer commented 5 years ago

Merged into 9.1 branch - closing

sathya-devi commented 5 years ago

@TYLEROL @jlattimer I am facing issues in these type of look up field for Contact and Account, Other Lookups(Country) are working. I tried with Current release v9.1.

image

jlattimer commented 5 years ago

Pull request 515 adds the ability to use activity party fields

ArvindBhat83 commented 5 years ago

I still don't see it working while creating cases in UCI. It doesn't set the lookup but the test case execution says it was successful

rahiltg commented 4 years ago

I still don't see it working while creating cases in UCI. It doesn't set the lookup but the test case execution says it was successful

I agree as i am also facing the same problem. I have created a bug with more details. https://github.com/microsoft/EasyRepro/issues/750