Class UploadFileListLocator
- All Implemented Interfaces:
Clickable<UploadFileList>,HasThemeFilter<UploadFileList,UploadFileListLocator>
UploadFileList, derived from
UploadFileListTester. Filter steps are inherited from
Locator; action methods delegate to a fresh tester
around the resolved component, so behavioral changes belong on the
tester, not here.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures the component is in a usable state before interaction.Gets the component being tested.getFiles()Gets the files the file list shows, in the order the browser shows them: the most recently added file first.Returns what happened to each file the user last picked with anUploadButton, dropped on anUploadDropZoneor started from this list, in the order the files were given.voidremoveFile(int index) Simulates the user clicking the remove button of the file at the given position of the list, which reaches one entry when several share a name.voidremoveFile(File file) Simulates the user clicking the remove button of a file in the list.voidremoveFile(String fileName) Simulates the user clicking the remove button of a file in the list.voidstartUpload(int index) Simulates the user clicking the start button of the file at the given position of the list, which waits becauseauto uploadis turned off, uploading it.voidstartUpload(File file) Simulates the user clicking the start button of a file that waits in the list becauseauto uploadis turned off, uploading it.voidstartUpload(String fileName) Simulates the user clicking the start button of a file that waits in the list becauseauto uploadis turned off, uploading it.Methods inherited from class com.vaadin.browserless.locator.Locator
atIndex, component, components, exists, inside, inside, invalidate, self, with, withAttribute, withAttribute, withClassName, withCondition, withCondition, withId, withinSlot, withoutAttribute, withoutAttribute, withoutClassName, withTestIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClickMethods inherited from interface com.vaadin.browserless.locator.HasThemeFilter
withoutTheme, withoutTheme, withTheme, withTheme
-
Constructor Details
-
UploadFileListLocator
public UploadFileListLocator() -
UploadFileListLocator
-
-
Method Details
-
getComponent
Description copied from interface:ClickableGets the component being tested.- Specified by:
getComponentin interfaceClickable<UploadFileList>- Returns:
- the component under test
-
ensureComponentIsUsable
public void ensureComponentIsUsable()Description copied from interface:ClickableEnsures the component is in a usable state before interaction.- Specified by:
ensureComponentIsUsablein interfaceClickable<UploadFileList>
-
getFiles
Gets the files the file list shows, in the order the browser shows them: the most recently added file first.A file is
UploadTester.UploadStatus.UPLOADEDonce the upload handler has consumed it,UploadTester.UploadStatus.FAILEDorUploadTester.UploadStatus.REJECTEDwhen its transfer failed or the server refused it, andUploadTester.UploadStatus.PENDINGwhile it waits to be started because auto upload is turned off. Javadoc copied fromUploadFileListTester.getFiles().- Returns:
- the files in the file list, or an empty list if the file list is not linked to an upload manager
-
getLastUploadStatus
Returns what happened to each file the user last picked with anUploadButton, dropped on anUploadDropZoneor started from this list, in the order the files were given.A file is
UploadTester.UploadStatus.UPLOADEDonce the upload handler has consumed it,UploadTester.UploadStatus.FAILEDwhen the handler threw, andUploadTester.UploadStatus.PENDINGwhile it waits forstartUpload(String)because auto upload is turned off.Unlike
getFiles(), this also reports the files the manager refused, which never enter the list: they areUploadTester.UploadStatus.REJECTEDwith the client-side error code as the error message:tooManyFiles,fileIsTooBigorincorrectFileType. A file Flow's server-side accepted type validation refused isREJECTEDas well. Javadoc copied fromUploadFileListTester.getLastUploadStatus().- Returns:
- the outcome of the last upload, one entry per file, or an empty list if nothing has been uploaded yet or the file list is not linked to a manager
-
removeFile
Simulates the user clicking the remove button of a file in the list.A
UploadManager.FileRemovedEventis fired and the file stops counting towardsUploadManager.setMaxFiles(int).When several entries have the given name, the most recently added one is removed. Javadoc copied from
UploadFileListTester.removeFile(java.lang.String).- Parameters:
fileName- name of the file to remove, as given when it was uploaded- Throws:
IllegalArgumentException- if the file is not in the file listIllegalStateException- if the component is not usable
-
removeFile
Simulates the user clicking the remove button of a file in the list.A
UploadManager.FileRemovedEventis fired and the file stops counting towardsUploadManager.setMaxFiles(int).When several entries have the name of the given file, the most recently added one is removed. Javadoc copied from
UploadFileListTester.removeFile(java.io.File).- Parameters:
file- the file to remove- Throws:
IllegalArgumentException- if the file is not in the file listIllegalStateException- if the component is not usable
-
removeFile
public void removeFile(int index) Simulates the user clicking the remove button of the file at the given position of the list, which reaches one entry when several share a name.A
UploadManager.FileRemovedEventis fired and the file stops counting towardsUploadManager.setMaxFiles(int). Javadoc copied fromUploadFileListTester.removeFile(int).- Parameters:
index- the position of the file in the list, in the ordergetFiles()returns them: the most recently added file first- Throws:
IllegalArgumentException- if there is no file at the positionIllegalStateException- if the component is not usable
-
startUpload
Simulates the user clicking the start button of a file that waits in the list becauseauto uploadis turned off, uploading it.When several waiting entries have the given name, the most recently added one is started. Javadoc copied from
UploadFileListTester.startUpload(java.lang.String).- Parameters:
fileName- name of the file to start, as given when it was added
-
startUpload
Simulates the user clicking the start button of a file that waits in the list becauseauto uploadis turned off, uploading it.When several waiting entries have the name of the given file, the most recently added one is started. Javadoc copied from
UploadFileListTester.startUpload(java.io.File).- Parameters:
file- the file to start
-
startUpload
public void startUpload(int index) Simulates the user clicking the start button of the file at the given position of the list, which waits becauseauto uploadis turned off, uploading it. This reaches one entry when several share a name. Javadoc copied fromUploadFileListTester.startUpload(int).- Parameters:
index- the position of the file in the list, in the ordergetFiles()returns them: the most recently added file first
-