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

NativeAutomation: File upload doesn't work with a required attribute #8079

Closed
schneider-technology opened this issue Nov 13, 2023 · 3 comments · Fixed by #8092
Closed

NativeAutomation: File upload doesn't work with a required attribute #8079

schneider-technology opened this issue Nov 13, 2023 · 3 comments · Fixed by #8092
Assignees
Labels
FREQUENCY: level 1 TYPE: bug The described behavior is considered as wrong (bug).

Comments

@schneider-technology
Copy link

What is your Scenario?

This seems like to be the same issue that was previously fixed for the hammerhead proxy, but it occurs now in native Automation

#2509

as soon as i run my code with
"disableNativeAutomation: true"

it works

What is the Current behavior?

Forms with the file upload fields that have a required attribute do not pass HTML5 built-in validation on submit after the upload field has been populated using setFilesToUpload method. If i remove the required part (t.debug before t.setfilestoupload or client function) it works out. The other option is to disable native automation

What is the Expected behavior?

The form with a required filed upload field should be able to be submitted

What is the public URL of the test page? (attach your complete example)

https://fldw8f.csb.app/

was the easiest way to setup up an public example, in case this link doesn't work in the future:
https://codesandbox.io/s/awesome-javascript-file-uploader-forked-fldw8f
create a new line after 18 with "required" (no quotations obviously) and use the new URL for testing

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture('File upload')
.page('https://fldw8f.csb.app/');

test('it uploads a file', async (t) => {
const fileUpload = Selector('input');
const button = Selector('button').withText('Upload');
const file = "file.png"
await t
.wait(5000)
.setFilesToUpload(fileUpload, file)
.wait(1000)
.click(button);
await t.debug();

});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

TestCafe version

3.4.0

Node.js version

No response

Command-line arguments

testcafe chrome --debug-on-fail test.js

Browser name(s) and version(s)

No response

Platform(s) and version(s)

No response

Other

No response

@schneider-technology schneider-technology added the TYPE: bug The described behavior is considered as wrong (bug). label Nov 13, 2023
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 13, 2023
@PavelMor25 PavelMor25 added STATE: Issue accepted An issue has been reproduced. and removed STATE: Need response An issue that requires a response or attention from the team. labels Nov 14, 2023
Copy link

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

@github-actions github-actions bot removed the STATE: Issue accepted An issue has been reproduced. label Nov 14, 2023
@Bayheck Bayheck self-assigned this Nov 21, 2023
Bayheck added a commit that referenced this issue Nov 29, 2023
<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->

## Purpose
UploadAutomation is fixed in order to upload required inputs in Native
Automation mode.

## Approach
Remove the required attribute from the file input before uploading. 
Initialize the addInternalEventAfterListener on inputs form 'submit'
event for returning the required attributes back.

## References
closes #8079

## Pre-Merge TODO
- [x] Write tests for your proposed changes
- [x] Make sure that existing tests do not fail

---------

Co-authored-by: aleks-pro <alexander.prokhorov@hotmail.com>
Copy link

Release v3.5.0-rc.1 addresses this.

1 similar comment
Copy link

Release v3.5.0-rc.1 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants