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

.sendKeys doesn't work for sap.ui.unified.FileUploader on 1.108.X+ SAPUI5 version #379

Closed
robertiqkkk opened this issue Mar 12, 2023 · 2 comments

Comments

@robertiqkkk
Copy link

Hello Colleagues,

We have recently updated our SAPUI5 version from 1.102.4 to 1.108.2 version.
With that, most of our E2E specs have stopped working.

That's due to the fact that .sendKeys no more "uploads" a file to the sap.ui.unified.FileUploader.
We've checked several times -> the locator is fine, no error on that step.
But in reality file path is not getting set -> file is not uploaded.

Specs still run fine when we switch to the SAPUI5 version back to 1.102.4.

Are you aware of what might be the reason or any workarounds?

System info:
SAPUI5: 1.108.2
UIVERI5: ^1.45.0
ChromeDriver: 107.0

PS: Same issue as #371

@robertiqkkk robertiqkkk changed the title .sendKeys doesn't work for sap.ui.unified.FileUploader on 1.108.X SAPUI5 version .sendKeys doesn't work for sap.ui.unified.FileUploader on 1.108.X+ SAPUI5 version Mar 12, 2023
@robertiqkkk
Copy link
Author

robertiqkkk commented Mar 13, 2023

Adding to that we've created an incident for the SAPUI5 core team: 2370013067

Because the uiveri5 library wasn't updated for 5 months, therefore it shouldn't be the root cause.
But rather a structural change of sap.ui.unified.FileUploader (I mean how the control is rendered to the DOM tree).

Colleagues did reply to us with:
"
Hello,

If I understand correctly:

  • in code you generate an absolute path, which must corresponds to the machine's file structure and the location of a test file e.g. "C:\Users\I343711\Downloads\dummy.pdf"
  • then you use sendKeys to mimic an end-user typing manually that path in the input of a FileUploader control obtained by ID, hwere uploadOnChange="true so you do not have code that presses a button else UI that calls FileUploader.upload();
  • the you do not see a request being sent in F12 Dev Tools starting SAPUI5 .108

The issues here are:

  • if you do a manual test, there is no option to type the path to a file.
    input[type=file] includes a browse dialog with access to the File System from browser;
  • the access to the file system from an application running in browser without user interaction( but let say that Selenium allows you to break the browser's security limitations to prevent app's running from having access to the OS without user interaction).
  • how you validate which input is obtained via ID, there are at least 4 elements in the DOM for one FileUploader, where you may have also older not removed uploaders;

Can you validate which HTML element is targeted by the test, what string and keys are executed via sendKeys, so we can recreate the test manually here http://snippix.only.sap/snippets/708088

Regards,
Stefania

CA-UI5-CTR
"

Could you assist with their question? I'm not sure how we can check what specific input is used by .sendKeys for sap.ui.unified.FileUploader? Or better to say, when we are locating the FileUploader control, then what DOM part of it is returned for .sendKeys to be called.

@robertiqkkk
Copy link
Author

We were able to fix the issue by adding the idSuffix to the locator.
Seems like the "default HTML node" of FileUploader control was changed in some recent versions.

The final locator looks like that:

	getFileUploaderById: function (id) {
		return element(
			by.control({
				controlType: "sap.ui.unified.FileUploader",
				id: id,
				interaction: {
					idSuffix: "fu"
				}
			})
		);
	},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant