-
Notifications
You must be signed in to change notification settings - Fork 71
fix: interrupt all uploads (CP: 23.6) #7619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* @return The generated temp file handle with the provided extension | ||
* @throws IOException | ||
*/ | ||
File createTempFile(String extension) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an overload to allow passing a file extension
private void waitForUploads(int maxSeconds) { | ||
Timeouts timeouts = getDriver().manage().timeouts(); | ||
timeouts.scriptTimeout(Duration.of(15, ChronoUnit.SECONDS)); | ||
|
||
String script = "var callback = arguments[arguments.length - 1];" | ||
+ "var upload = arguments[0];" | ||
+ "window.setTimeout(function() {" | ||
+ " var inProgress = upload.files.filter(function(file) { return file.uploading;}).length >0;" | ||
+ " if (!inProgress) callback();" // | ||
+ "}, 500);"; | ||
getCommandExecutor().getDriver().executeAsyncScript(script, this); | ||
String script = "return arguments[0].files.every((file) => !file.uploading);"; | ||
|
||
waitUntil(driver -> (Boolean) executeScript(script, UploadElement.this), | ||
maxSeconds); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't working reliably, replaced it with the logic we have in newer versions
|
This ticket/PR has been released with Vaadin 23.6.1. |
Cherry-pick of #7616