Skip to content
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

Add a step to validate if the files which a client tries to set with input.setFiles command exist #677

Closed
lutien opened this issue Mar 5, 2024 · 4 comments · Fixed by #689
Labels
bug Something isn't working module-input Input module needs-discussion Issues to be discussed by the working group

Comments

@lutien
Copy link
Contributor

lutien commented Mar 5, 2024

Similar to WebDriver Classic actions (see here point 8.5), for input.setFiles command we could add a step to validate if paths specified in files argument point to existing files.

@lutien lutien added the module-input Input module label Mar 5, 2024
@whimboo whimboo added the bug Something isn't working label Mar 5, 2024
@OrKoN
Copy link
Contributor

OrKoN commented Mar 5, 2024

The file can also be deleted before it is actually used but after it is set via automation but before it is used. I think allowing to test scenarios when the file does not exist at upload time is also interesting, so perhaps an optional validation?

@whimboo
Copy link
Contributor

whimboo commented Mar 5, 2024

Isn't this a distinct scenario? When discussing input.setFiles, the primary focus is on file selection. In this context, each browser exclusively permits users to choose existing files through the file selection dialog. Selecting a non-existent file is not an option at this stage.

@OrKoN
Copy link
Contributor

OrKoN commented Mar 5, 2024

The HTML spec says that "Files can be from the filesystem or created on the fly, e.g., a picture taken from a camera connected to the user's device" and it does not look like there is a requirement that the file has to exist on the filesystem.

@whimboo whimboo added the needs-discussion Issues to be discussed by the working group label Mar 6, 2024
@css-meeting-bot
Copy link
Member

The Browser Testing and Tools Working Group just discussed Add a step to validate if the files which a client tries to set with input.setFiles command exist.

The full IRC log of that discussion <AutomatedTester> topic: Add a step to validate if the files which a client tries to set with input.setFiles command exist
<AutomatedTester> github: https://github.com//issues/677
<AutomatedTester> sasha: the question is should we error like webdriver classic if the file doesn't exist
<AutomatedTester> ... on the platform side we snapshot the file and then send it across and this can error
<jrandolf> q+
<AutomatedTester> ... does this make sense for everyone?
<AutomatedTester> ack next
<AutomatedTester> jrandolf: On chromium we don't do validation until the file is read
<AutomatedTester> ... it is probably fine to write a normative note as it is platform specific to say this could throw an error
<AutomatedTester> ... in chromium we take a more relaxed sense since we don't expect people to send fake files and I know this came from wpt that was sending fake files
<jgraham> q+
<AutomatedTester> q?
<AutomatedTester> ack next
<AutomatedTester> jgraham (IRC): I think there are definitely loads of situations where it could throw an error
<AutomatedTester> ... for most people they won't be sending fake files but we need to do it for testing the browser
<AutomatedTester> ... and appreciate it's a bit of a footgun but we can see if we can relax the requirement on our side
<AutomatedTester_> q?
<sasha> q+
<AutomatedTester> ack next
<AutomatedTester> sasha: we have fixed wpt tests to make temporary files and we won't have to create any spec changes?
<AutomatedTester> jgraham (IRC): I think we should have the spec updated to say it's an invalid argument like classic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module-input Input module needs-discussion Issues to be discussed by the working group
Projects
None yet
4 participants