This is a migrated thread and some comments may be shown as answers.

Dynamically change directory for RadAsyncUpload

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Al asked on 20 Apr 2015, 02:53 PM

We were having trouble in a test, getting RadAsyncUpload to open the control in the same directory (where the test is located) across different machines.

It seems that the browser remembers where the open dialog was the last time it was opened.  All a tester had to do to cause the test to fail was a) move the test to a machine where the directories were slightly different or b) open any save as or upload dialog on the machine  before running the test. Either way, the OpenFile dialog from RadAsyncUpload would be in the wrong location and not be able to open the file expected.

The solution, though it took a while to discover, is easy to implement.

1. Edit the RadAsyncUpload step in code - creating a coded step.

2. Create a full-path by combining the built-in Deployment directory with the sub-directory (if not in the project directory) and the expected file to upload

3. Open the control programmatically with the full-path

Sample Code: 

Dim targetFile as String = "Spreadsheet Import Test File.xlsx"
Dim targetDir as String = "Ver_x\Group Test"                            ' path beyond the project directory
Dim ssFile as String = System.IO.Path.Combine(Me.ExecutionContext.DeploymentDirectory, targetDir & "\" & targetFile) 

Console.WriteLine("ssFile=" & ssFile)

' RadAsyncUpload('ctrlGroupUploadWindow_RadAsyncUpload1'): upload file 0
Pages.GroupTestForm.FrameCtl00.CtrlGroupTestWindowRadAsyncUpload1Div.Upload(0, ssFile)

' We use this in the 15 tests that need the same file - and it works without fail no matter which machine or which directory was last opened.

1 Answer, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 23 Apr 2015, 07:33 AM
Hello Al,

Thank you for posting this discovery in the public forums.

I've rewarded your account with telerik pints.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Al
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Share this question
or