Coded UI is identifying the control but not performing any action - coded-ui-tests

I have written the below code,
WinWindow w = new WinWindow();
w.SearchProperties[WinWindow.PropertyNames.Name] = "Card Action";
w.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
w.SearchProperties[WinButton.PropertyNames.ControlType] = "Window";
WinWindow w2 = new WinWindow(w);
w2.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
w2.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
w2.SearchProperties[WinWindow.PropertyNames.ControlType]="Window";
w2.SearchProperties[WinWindow.PropertyNames.Name] = "Insert Card";
w2.SearchProperties[WinWindow.PropertyNames.ControlId] = "2032";
WinButton b1 = new WinButton(w2);
b1.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
b1.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
b1.SearchProperties[WinButton.PropertyNames.ControlType] = "Button";
b1.SearchProperties[WinButton.PropertyNames.ClassName] = "Button";
b1.SearchProperties[WinButton.PropertyNames.Name] = "Insert Card";
b1.DrawHighlight();
Mouse.Click(b1);
It has identified the control but unable to perform click action.
Error:
Test method CodedUITestMethod1 threw exception:
Another control is blocking the control. Please make the blocked control visible and retry the action. Additional Details: TechnologyName: 'MSAA' Name: 'Insert Card' ClassName: 'Button' ControlType: 'Window'
Output Screenshot
https://i.stack.imgur.com/mhbgj.png
Please help me to sort out this problem.
Thanks in advance!

Related

Change Item Price when Creating Purchase Order via PHP in Netsuite

I am attempting to create open purchase orders in Netsuite during a system migration using Netsuite's PHP Toolkit for 2019_2. I am able to create the purchase order and line items without a problem, but I cannot figure out how to change the item cost on the line item. Setting the line item extended total works, but setting the rate field does not. Can anyone shed any light on why the price is not being set?
I've tried both $poi->item->rate = "5.00"; and $poi->item->rate = 5.00; with no success. The documentation says that this field is a string.
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/schema/other/purchaseorderitem.html
$service = new NetSuiteService();
$po = new PurchaseOrder();
$po->tranId = 'PO111111';
$po->tranDate = '2019-03-27T00:00:00';
$po->approvalStatus = new RecordRef();
$po->approvalStatus->internalId = 2;
$po->entity = new RecordRef();
$po->entity->externalId = 'VENDORNAME';
// Create PO Item
$poi = new PurchaseOrderItem();
$poi->item = new RecordRef();
$poi->item->externalId = 'ITEMNUMBER';
$poi->item->rate = "5.00";
$poi->quantity = 10;
$po->itemList = new PurchaseOrderItemList();
$po->itemList->item = array($poi);
$request = new AddRequest();
$request->record = $po;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
print_r($addResponse);
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
Set the rate on the purchase order line instead of trying to do it on the item record.
$poi->rate = "5.00";

How to give data dynamically in a dialog box using visual c++

How can I send data to a dialog box dynamically?
In a previous project I used edit boxes (e.g for 3 conductors) and gave those data separately for each conductor. Now I have to give them dynamically and I don't have standard number of conductors and I can't use edit box again.
Could you please give me an idea or a good link describing step by step how to create a table in a dialog box dynamically?
I have created a dialog box in which I insert data about conductors (resistivity, permeability, diameter etc (electric power systems Smile | :) )) in edit boxes but I have done it only for 3 conductors. I have to insert-edit the number of conductors and then edit their characteristics. But I can't use again edit boxes because this is static. I want something like a dynamic table which will have rows=number of conductors and columns about is characteristic (resistivity, permeability, diameter)and edit them in dialog box. I don't know how to upload my executable to male clear what I have done but here is a part of my code for the static case of three conductors Smile | :) I want another dynamic way to edit data :/
void CInputView::OnLinefeaturesFeatures()
{
// TODO: Add your command handler code here
CInputDoc* pDoc = GetDocument();
CFeaturesDialog DialogWindow;
DialogWindow.m_DialogCon = m_NumCond;
DialogWindow.m_DialogLayers = m_Layers;
DialogWindow.m_DialogPermeability = m_AirPermeability;
DialogWindow.m_DialogAirConductivity = m_AirConductivity;
DialogWindow.m_DialogAirPermittivity = m_AirPermittivity;
DialogWindow.m_DialogEarthPermeability1 = m_EarthPermeability1;
DialogWindow.m_DialogEarthConductivity1 = m_EarthConductivity1;
DialogWindow.m_DialogEarthPermittivity1 = m_EarthPermittivity;
DialogWindow.m_DialogDepth = m_depth;
DialogWindow.m_DialogEarthPermeability2 = m_EarthPermeability2;
DialogWindow.m_DialogEarthConductivity2 = m_EarthConductivity2;
DialogWindow.m_DialogEarthPermittivity2 = m_EarthPermittivity2;
DialogWindow.m_Dialogfrequency = m_frequency;
if (DialogWindow.DoModal() == IDOK)
{
m_NumCond = DialogWindow.m_DialogCon;
m_Layers = DialogWindow.m_DialogLayers;
m_AirPermeability = DialogWindow.m_DialogPermeability;
m_AirConductivity = DialogWindow.m_DialogAirConductivity;
m_AirPermittivity = DialogWindow.m_DialogAirPermittivity;
m_EarthPermeability1 = DialogWindow.m_DialogEarthPermeability1;
m_EarthConductivity1 = DialogWindow.m_DialogEarthConductivity1;
m_EarthPermittivity = DialogWindow.m_DialogEarthPermittivity1;
m_depth = DialogWindow.m_DialogDepth;
m_EarthPermeability2 = DialogWindow.m_DialogEarthPermeability2;
m_EarthConductivity2 = DialogWindow.m_DialogEarthConductivity2;
m_EarthPermittivity2 = DialogWindow.m_DialogEarthPermittivity2;
m_frequency = DialogWindow.m_Dialogfrequency;
}
}

Disable/enable an input field

Using this sample code, I am trying to enable/disable the field "arrdatfrom". However, once this text field has been DISABLED, i cannot get it to be re-ENABLED. The function below gets executed when the user clicks a "Refresh" button. I have built this little demo just to prove that I have tried many ways to do this. Any ideas?
function showBooking() {
var d = new Date()
formvals.arrdatefrom = document.getElementById("arrdatfrom").value
formvals.arrdatethru = document.getElementById("arrdatthru").value
formvals.depdatefrom = document.getElementById("depdatfrom").value
formvals.depdatethru = document.getElementById("depdatthru").value
formvals.bookname = document.getElementById("bookname").value
formvals.peakroomfrom = document.getElementById("peakroomfrom").value
formvals.peakroomthru = document.getElementById("peakroomthru").value
formvals.peakattendfrom = document.getElementById("peakattendfrom").value
formvals.peakattendthru = document.getElementById("peakattendthru").value
alert (' ngs.hta ready to enable')
document.getElementById("arrdatfrom").enabled = 'true'
alert ('ngs.hta in showBooking!! disable. ')
document.getElementById("arrdatfrom").disabled = 'true'
...
There is no property .enabled. To re-enable a disabled element, set .disabled = false.

Two Web Parts connection doesn't work when set programmatically

I've a SharePoint 2010 page with a list. The list has several items and a field named "Department" and must filter items based on user's department value retrieved from user profile.
To do this I've created a feature which upon activation adds UserContextFilterWebPart to the page and makes connection between UserContextFilterWebPart and XsltListViewWebPart. After the feature is activated I can see in the page design mode that connection is established but the list gets empty. Then I open web part's menu, choose "Connections" then "Send Filter Values To" and click "List1". When dialog appears I do nothing but only click "Finish" button and it begins to work fine. Can anybody please explain me why the connection begins to work only if I do that manual extra action? What must be done to fix?
I tried different way when List.Views[0].Query property is set to appropriate CAML query and it also works fine. But I'm told that it's not a good approach because of performance and parallel tasks issues. Is it really bad course of action?
Below is the code for 2 different approaches.
Thanks in advance!
1-s variant with UserContextFilterWebPart:
SPSite Site = new SPSite(URL);
SPWeb Web = Site.OpenWeb();
SPLimitedWebPartManager WPM = Web.GetLimitedWebPartManager(URL, PersonalizationScope.Shared);
XsltListViewWebPart List = WPM.WebParts[0] as XsltListViewWebPart;
UserContextFilterWebPart UCFWP = new UserContextFilterWebPart();
UCFWP.Title = "Current User Filter";
UCFWP.AllowEdit = true;
UCFWP.FilterName = "Current User";
UCFWP.SendEmptyWhenNoValues = true;
UCFWP.AllowClose = true;
UCFWP.ExportMode = WebPartExportMode.All;
UCFWP.AllowConnect = true;
UCFWP.AllowHide = true;
UCFWP.ProfilePropertyName = "Department";
UCFWP.ValueKind = UserContextFilterValueKind.ProfileValue;
UCFWP.ZoneID = "Main";
WPM.AddWebPart(UCFWP, UCFWP.ZoneID, 1);
WPM.SaveChanges(UCFWP);
ConsumerConnectionPointCollection consumerConnections = WPM.GetConsumerConnectionPoints(List);
ConsumerConnectionPoint addConsumerConnPoint = consumerConnections["DFWP Filter Consumer ID"];
ProviderConnectionPointCollection providerConnections = WPM.GetProviderConnectionPoints(UCFWP);
ProviderConnectionPoint addProviderConnPoint = providerConnections["ITransformableFilterValues"];
TransformableFilterValuesToParametersTransformer trans = new TransformableFilterValuesToParametersTransformer();
trans.ConsumerFieldNames = new string[] { "Department" };
trans.ProviderFieldNames = new string[] { "Department" };
SPWebPartConnection newConnection = WPM.SPConnectWebParts(UCFWP, addProviderConnPoint, List, addConsumerConnPoint, trans);
WPM.SPWebPartConnections.Add(newConnection);
2-nd variant with CAML query (intended to be used not in a feature but in a web part):
SPSite Site = new SPSite(URL);
SPWeb Web = Site.OpenWeb();
SPLimitedWebPartManager WPM = Web.GetLimitedWebPartManager(URL, PersonalizationScope.Shared);
XsltListViewWebPart List = WPM.WebParts[0] as XsltListViewWebPart;
SPUser CurrentUser = Web.CurrentUser;
SPServiceContext context = SPServiceContext.GetContext(Site);
UserProfileManager upm = new UserProfileManager(context, false);
UserProfile up = upm.GetUserProfile(CurrentUser.RawSid);
String UserDepartment = up["Department"].Value.ToString();
SPView ListView = Web.Lists["List1"].Views[0];
ListView.Query = "<Where><Eq><FieldRef Name='Department' /><Value Type='Text'>" + UserDepartment + "</Value></Eq></Where>";
ListView.Update();
I had a similar problem of connecting two web parts. I found the answer here: http://kvdlinden.blogspot.dk/2011/02/programmatically-connect-two.html
Note that that post describes how to do it with two XsltListViewWebParts. In order to use it in your case I suggest that you:
Create the connection manually,
Use PowerShell to get a SPLimitedWebPartManager for the page,
Use the manager to iterate through the manager.SPWebPartConnections,
And find the ProviderConnectionPointID for your connection,
Use that ID in the code shown in the post.
Also remember to setup the transformer - you can find this also from the SPWebPartConnections.
Next time you activate your feature you should have a connection equal to the one you made by hand.

core data giving merge conflict with single MOC and main thread used for core data

I'm using core data with a single NSManagedObjectContext and am doing all operation for core data on the main thread. The new and old row given in error description are identical and am at hoping that someone can explain why am getting a merge conflict. Setting merge policy to overwrite is causing the app to run into high CPU in simulator and become unresponsive.
However, when I try to update managed objects in one entity, the app crashes with following error,
NSMergeConflict (0x7144390) for NSManagedObject (0x7225db0) with objectID '0x721c0a0 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Locations/p1>' with oldVersion = 2 and newVersion = 3 and
old cached row = {\n AccountInfo = \"0x721bae0 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Account/p1>\";\n City = \"<null>\";\n Country = \"Russian Federation\";\n EntryStatusId = \"<null>\";\n ExitStatusId = \"<null>\";\n IsCorporateLocation = 1;\n IsVisible = 1;\n Latitude = 50;\n LocationId = 10003;\n Longitude = 40;\n Name = \"Test Location\";\n Radius = 304;\n State = \"Province of Voronezh\";\n Street = \"<null>\";\n Units = METER;\n Zip = \"<null>\";\n} and
new database row = {\n AccountInfo = \"0x7144560 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Account/p1>\";\n City = \"<null>\";\n Country = \"Russian Federation\";\n EntryStatusId = \"<null>\";\n ExitStatusId = \"<null>\";\n IsCorporateLocation = 1;\n IsVisible = 1;\n Latitude = 50;\n LocationId = 10003;\n Longitude = 40;\n Name = \"Test Location\";\n Radius = 304;\n State = \"Province of Voronezh\";\n Street = \"<null>\";\n Units = METER;\n Zip = \"<null>\";\n}
Update: The error doesn't happen if I save the MOC after updating every object but happens if I update all the objects and then save MOC. Anyone knows why this is happening?
The error suggest that you do actually have two separate contexts. You only get a merge when you have two or more context writing to the same store.
I would suggest logging the context before every save, everywhere you perform a save to make certain you only have one active context.
It is posible to let the Core Data deals with this conflicts automatically instead of throw an Exception. See this post: http://pauloliveira.net/tech/core-data-merging-conflicts

Resources