Class UploadManagerTester
java.lang.Object
com.vaadin.flow.component.upload.testbench.UploadManagerTester
A test helper class for interacting with the client-side UploadManager. This
class provides access to the upload manager's state and methods through any
element that is linked to the manager.
Obtain an instance through UploadButtonElement.getUploadManager(),
UploadDropZoneElement.getUploadManager(), or
UploadFileListElement.getUploadManager().
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts all uploads currently in progress.intGets the number of files currently in the upload list.doubleGets the maximum number of files that can be uploaded.booleanChecks whether the maximum number of files has been reached.voidremoveFile(int index) Removes the file at the given index.voidUploads the given local file.voidUploads the given local file and waits for the given number of seconds for the upload to finish.voidStarts uploading all pending files.voiduploadMultiple(List<File> files, int maxSeconds) Uploads the given local files and waits for the given number of seconds for all uploads to finish.voidwaitForUploads(int maxSeconds) Waits for all uploads to complete.
-
Method Details
-
getMaxFiles
public double getMaxFiles()Gets the maximum number of files that can be uploaded.- Returns:
- the maximum number of files, or
Infinityif unlimited
-
isMaxFilesReached
public boolean isMaxFilesReached()Checks whether the maximum number of files has been reached.- Returns:
trueif no more files can be uploaded,falseotherwise
-
getFileCount
public int getFileCount()Gets the number of files currently in the upload list.- Returns:
- the number of files
-
removeFile
public void removeFile(int index) Removes the file at the given index.- Parameters:
index- the index of the file to remove
-
uploadFiles
public void uploadFiles()Starts uploading all pending files. This is useful when auto-upload is disabled. -
abort
public void abort()Aborts all uploads currently in progress. -
waitForUploads
public void waitForUploads(int maxSeconds) Waits for all uploads to complete.- Parameters:
maxSeconds- the maximum number of seconds to wait
-
upload
Uploads the given local file. Waits for 60 seconds for the upload to finish.Note that Safari webdriver does not support file uploads.
- Parameters:
file- a reference to the local file to upload
-
upload
Uploads the given local file and waits for the given number of seconds for the upload to finish.Note that Safari webdriver does not support file uploads.
- Parameters:
file- the local file to uploadmaxSeconds- the number of seconds to wait for the upload to finish or0not to wait
-
uploadMultiple
Uploads the given local files and waits for the given number of seconds for all uploads to finish.Note that Safari webdriver does not support file uploads.
- Parameters:
files- the local files to uploadmaxSeconds- the number of seconds to wait for uploads to finish or0not to wait
-