Serenity/JS should allow for uploading files #2129
Labels
enhancement
A good idea that should be implemented
@serenity-js/playwright
@serenity-js/protractor
Adapter and interactions for Angular Protractor
@serenity-js/web
Screenplay Pattern APIs for interacting with the Web
@serenity-js/webdriverio
Adapter for WebdriverIO
What's the problem you're trying to solve?
Serenity/JS should make it easy to upload local files using
<input type="file" />
How would you like to solve it?
Serenity/JS Web should offer an interaction like
UploadFile.from(path | path[]).to(pageElement)
It's worth noting that Playwright allows for multiple files to be uploaded to one input.
We should check if similar capability is available with WebDriver-based tools.
Playwright
Playwright has good support for handling file uploads.
We'd need to wrap
locator.setInputFiles
:Note: Support for drag and drop file uploads with Playwright
WebdriverIO
WebdriverIO uses a 2-step upload process to handle uploading files to remote browsers:
browser.uploadFile
element.setValue
For local browsers, or those that don't support
browser.file
API we could limit this feature to wrappingelement.setValue
Protractor
Protractor is limited by what Selenium 3 can do.
For local browsers, we can set the
value
attribute of theinput
element,but Protractor doesn't support uploading files to browsers running on remote machines.
For remote browsers, we could mimic what WebdriverIO is doing, or limit support to local browsers only.
Are there any alternatives?
Developers could implement a custom interaction that uses the native APIs of their chosen web integration tool.
For example, for Playwright we'd have something like this:
How can we make it happen?
The text was updated successfully, but these errors were encountered: