UI Dialogue popping up in automated testing - automated-tests

As a total newbie to AL, I'm trying to set up some automated tests for an upcoming upgrade to BC19. As a proof-of-concept I'm still working in the Cronus sample database, but it's giving me a problem. I'm trying to test the Item Card; I want to create a new item, give it an unacceptable value for a couple of fields, and have it error at me.
The test seems to work just fine, except for one element - whenever I run it, I get a Confirm dialogue asking if I want to rename the record. Regardless of what I select, the test completes successfully; it doesn't report an Unhandled UI error.
I've tried adding a ConfirmHandler and a MessageHandler; I've already got a ModalPageHandler that works great. When I add the ConfirmHandler or MessageHandler though, it errors out, telling me that the handlers weren't called.
Here's my code:
[Test]
[HandlerFunctions('HandleConfigTemplates')]
Procedure AddBadTypeItem()
var
pgeItem: TestPage "Item Card";
begin
pgeItem.OpenNew();
pgeItem."No.".SetValue('zzzzz');
pgeItem."Description".SetValue('zzzzz');
Asserterror pgeItem."Type".SetValue('zzzz');
end;
[ModalPageHandler]
Procedure HandleConfigTemplates(
var ConfigTemplates: TestPage "Config Templates")
begin
ConfigTemplates.OK.Invoke();
end;
[ConfirmHandler]
Procedure HandleConfirmNo(Question: Text[1024]; var Reply: Boolean)
begin
Reply := False;
end;
Here's the dialogue I see:
And the error I see if I try to include the handlers:
The following UI handlers were not executed: HandleConfirmDialogue,MessageHandler

Related

APEX Collection Loading in Pre-Rendering Process: Error: WWV_FLOW_COLLECTIONS_UK

I am running a delete/creation of an APEX Collection from pre process (code below) and am running into the following error once in a blue moon.
I saw a couple posts on this error, but they seem to be related to a different issue. There were some comments about the error being caused by the user multi clicking a button that runs this process twice, but this is an on load PL/SQL process.
Has anyone been able to fix this error consistently?
ORA-00001: unique constraint (FLOWS_030000.WWV_FLOW_COLLECTIONS_UK)
violated
IF APEX_COLLECTION.COLLECTION_EXISTS('DWLOAD') then
APEX_COLLECTION.DELETE_COLLECTION (
'DWLOAD');
end if;
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
p_collection_name => 'DWLOAD',
p_query => 'select a.seq,
b.PWSID,
b.pws_pop_served_count
from RELATED_PWS a, SYSTEM_INFO b
where a.fk_pwsid = b.pwsid and seq= ' || :P77_SEQ || '');
Execution options for the Pre Process > "Once per page visit"
Thanks,
Update::
So I was able to replicate it by rapid clicking on the link to load the page. So then the page load runs multiple times. I am looking to see if I can show processing on the href link. For button page submissions I added a DA with Show Processing Page submit which seems to block the multi click.
maybe use server-side condition will solve the problem.
plsql -> IF APEX_COLLECTION.COLLECTION_EXISTS('collection_name') then
return false;
ELSE
return true;
END IF;

Ax 2012 X++ Report Controller class caching

Short Version :
If an error is thrown during the execution of an SSRS report after the associated RDP temporary tables have been updated, the next time the report is run for the same parameters, code execution does not insert fresh data into said tables. Any idea why and how to prevent it?
Long Version :
I am trying to modify the run conditions of a standard report (SalesInvoiceReport) so that the original of any invoice can only be printed once. For all reprints, the "Copy preview" option should be used.
For the most part, the customization is working as intended. I used the CustInvoiceJour.PrintedOriginals field and the CustInvoiceJour.updatePrintedOriginals() (both part of Standard Ax) to maintain the number of originals that have been printed and a slight modification to the SalesInvoiceController.outputReport() method throw an error of an original is being re-printed. Below is the code added to achieve this :
...
// <A147> Code to disable reprints if an original is already printed
isOriginalPrintable = CustInvoiceJour::findRecId(custInvoiceJour.RecId).PrintedOriginals == 0;
srsPrintDestinationSettings = formLetterReport.getCurrentPrintSetting().parmPrintJobSettings();
//srsPrintMediumType = srsPrintDestinationSettings.printMediumType();
if ((printCopyOriginal == PrintCopyOriginal::Original || printCopyOriginal == PrintCopyOriginal::OriginalPrint))
{
// If no originals printed, allow prints.
// Need to re-read the CustInvoiceJour record from the table to get updated data
// If the Original is printed but the prin form is not refreshed, the form's recordset does not update to the latest data.
if(isOriginalPrintable)
{
CustInvoiceJour::updatePrinted(custInvoiceJour, (srsPrintDestinationSettings.numberOfCopies() == 0 ? 1 : srsPrintDestinationSettings.numberOfCopies()));
}
// Don't allow the original document to be printed more than once.
else
{
error(strFmt("#GLS223085", custInvoiceJour.InvoiceId, custInvoiceJour.InvoiceDate));
return;
}
}
// </A147>
...
I placed this in the SalesInvoiceContreller.outputReport() because I found similar code present there as part of standard Ax, albeit for use in specific country regions.
When user uses the Original Preview button, the error is thrown and code execution stops but the RDP temporary tables used to hold the report data have already been updated with report data (specifically the field which hold the Report title is set to Invoice).
When the user reruns the report, this time with the Copy Preview button, code execution somehow skips inserting fresh data into the temp tables (which would set the Report Title field to Invoice Copy) and the first copy output still says Invoice, defeating the requirement.

getting 409 error when trying to call table.CreateIfNotExists() for the first time

When starting my program for the first time since the associated table has been deleted I get this error:
An exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code
Additional information: The remote server returned an error: (409) Conflict.
However if I refresh the crashed page the table will successfully create.
Here is the code just in case:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
Microsoft.WindowsAzure.CloudConfigurationManager.
GetSetting("StorageConnectionString"));
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("tableTesting");
table.CreateIfNotExists();
I don't really understand how or why I'd be getting a conflict error if there's nothing there.
These errors appear elsewhere in my code as well when I'm working with blob containers, but I can't reproduce them as easily.
If you look at the status codes here: http://msdn.microsoft.com/en-us/library/azure/dd179438.aspx, you will notice that you get 409 error code in two scenarios:
Table already exists
Table is being deleted
If I understand correctly, table.CreateIfNotExists() only handles the 1st situation but not the 2nd one. Please check if that is not the case in your situation. One way to check this would be to see details of Storage Exception. Somewhere you should get the code which would match with the link I mentioned above.
Also one important thing to understand is that when you delete the table, it is actually marked for deletion and is actually deleted through a background process (much like garbage collection). If you try to create a table between these two steps, you will get the 2nd error.

Not sure why my program seems to be skipping some functions?

Hey there,
I'm a little confused with some Actionscript I'm working on. For my GUI, I have written four functions for times when computing is taking place. These are showMessage("Loading Text..."), disableButtons(), clearMessage(), and enableButtons(). They work great throughout the program. ShowMessage displays a loading message, disableButtons disables buttons so no one can click anything, clearMessage clears the loading message when job is done, and enableButtons turns them all back on.
For some reason, there is one button click handler which is giving me troubles and I'm not sure why. I've set it up just like others similar to it (which all work) but this one doesn't display the message or shut off my buttons. Here is my clickHandler...
private function Buffer_Route_clickHandler():void
{
showMessage("Loading RBE Options");
disableButtons();
if(Buffer_Route.selected && rbeAC.length == 0){
createRbeAC();
}
}
And here is the creatRbeAC function...
private function createRbeAC():void
{
rbeAC.removeAll();
hiddenRBELayers.removeAll();
var rbeIDs:Array = rbeConfigList.getKeySet();
for each (var rbeID:int in rbeIDs)
{
var rbeConfig:Hashtable = rbeConfigList.find(rbeID) as Hashtable;
var rbeData:Object =
{
restURL:rbeConfig.find("rbeRESTURL") as String,
layername:rbeConfig.find("rbeLayerName") as String,
icon: rbeConfig.find("rbeIcon") as String,
titlefield: rbeConfig.find("rbeTitleField") as String,
checked: rbeConfig.find("rbeChecked") as String,
count: "0" as String
};
if(rbeData.checked == "false")
{
hiddenRBELayers.addItem(rbeData.layername);// as String);
}
rbeAC.addItem(rbeData);
}
}
I wasn't getting any loading text, so I took out my clearMessage and enableButtons functions from the code to see if it was adding the message and disabling the buttons to begin with. I am still not getting anything though. Since clearMessage and enableButtons is no where to be found in this button click handler or creatRbeAC function, then I can not understand why the loading message and buttons aren't disabled, even when the computing is finished.
Some things to note. If I comment out the creatRbeAC function, the loading message shows and buttons do disable. Its almost as if those functions are being ignored when the creatRbeAC function is in the code.
Any help? I would greatly appreciate it. Hopefully I have provided enough information.
in my actual app, i have similiar problems.
In my Eventhandler (it doesn't matter, if there is a button handler or a mouse handler), I also wan't to disable the app and use some filter functions for my arrayCollection.
Unfortunately, this action seems to need too much ressources, especialy, when the app run in debug mode. I have to waint for the next screnn refresh. So i try to implement the "applyFilterMethod" in my eventhandler with
callLater(applyFilterMethod)
but it also wo't work.
Finally, the setTimeOut(applyFilterMethod,500)
solved my issue. So, try it with the timeout-method, if you have luck.
BR
Frank

ASP.NET Unexpected and Different Behavior in Different Environments

I have an ASP.NET site (VB.NET) that I'm trying to clean up. When it was originally created it was written with no error handling, and I'm trying to add it in to improve the User Experience.
Try
If Not String.IsNullOrEmpty(strMfgName) And Not String.IsNullOrEmpty(strSortType) Then
If Integer.TryParse(Request.QueryString("CategoryID"), i) And String.IsNullOrEmpty(Request.QueryString("CategoryID"))
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType, i)
Else
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType)
End If
MyDataGrid.DataBind()
If CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows.Count > 0 Then
lblCatName.Text = CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows(0).Item("mfgName")
End If
If MyDataGrid.Items.Count < 2 Then
cboSortTypes.Visible = False
table_search.Visible = False
End If
If MyDataGrid.PageCount < 2 Then
MyDataGrid.PagerStyle.Visible = False
End If
Else
lblCatName.Text &= "<br /><span style=""fontf-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End If
Catch
lblCatName.Text &= "<br /><span style=""font-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End Try
Now, this is trying to avoid generating a 500 error by catching exceptions. There can be three items on the query string, but only two matter here. In my test environment and in Visual Studio when I run this site, it doesn't matter if that item is on the query string. In production, it does matter. If that third item isn't present (SubCategoryID) on the query string, then the "There are no items for this manufacturer" displays instead of the data from the database.
In the two different environments I am seeing two different code execution paths, despite the same URLs and the same code base.
The site is running on Server 2003 with IIS 6.
Thoughts?
EDIT:
In response to the answer below, I doubt it's a connection error (though I see what you're getting to), as when I add the SubCategoryID to the query string, the site works correctly (displaying data from the database).
Also, if please let me know if you have any suggestions for how to test this scenario, without deploying the code back to production (it's been rolled back).
I think you should try to print out the exception details in your catch block to see what the problem is. It could anything for example a connection error to your database.
The error could be anything, and you should definitely consider printing this out or logging it somewhere, rather than making the assumption that there's no data. You're also outputting the same error message to the UI for two different code paths, which makes things harder to debug, especially without knowing if an exception occurred, and if so, what it was.
Generally, it's also better not to have a catch for all exceptions in cases like this, especially without logging the error. Instead, you should catch specific exceptions and handle these appropriately, and any real exceptions can get passed up the stack, ideally to a global error handler which can log it and/or send out some kind of error notification.
I discovered the reason yesterday. In short it was because when I copied my files from my computer into my dev-test environment, I missed a file, which ironically caused it to work, rather than not. So in the end it would have functioned the same in both environments.

Resources