Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
6eb30652
Commit
6eb30652
authored
May 24, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui_test_core: allow choosing the MIME type in setFile
parent
1cbe6e56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/user-extensions.js.js
...Item/portal_skins/erp5_ui_test_core/user-extensions.js.js
+7
-5
No files found.
bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/user-extensions.js.js
View file @
6eb30652
...
@@ -57,17 +57,19 @@ function wrapPromise(promise) {
...
@@ -57,17 +57,19 @@ function wrapPromise(promise) {
* <tr>
* <tr>
* <td>setFile</td>
* <td>setFile</td>
* <td>field_my_file</td>
* <td>field_my_file</td>
* <td>/data.jpg myfilename.jpg</td>
* <td>/data.jpg myfilename.jpg
image/jpg
</td>
* </tr>
* </tr>
*
*
* @param {string} locator the selenium locator
* @param {string} locator the selenium locator
* @param {string} url_and_filename the URL and filename, separated by space
* @param {string} url_filename_mimetype the URL, filename and optionally mime type,
* separated by spaces
* @returns {() => boolean}
* @returns {() => boolean}
*/
*/
Selenium
.
prototype
.
doSetFile
=
function
(
locator
,
url_
and_filenam
e
)
{
Selenium
.
prototype
.
doSetFile
=
function
(
locator
,
url_
filename_mimetyp
e
)
{
var
tmpArray
=
url_
and_filename
.
split
(
'
'
,
2
);
var
tmpArray
=
url_
filename_mimetype
.
split
(
'
'
,
3
);
var
url
=
tmpArray
[
0
];
var
url
=
tmpArray
[
0
];
var
fileName
=
tmpArray
[
1
];
var
fileName
=
tmpArray
[
1
];
var
mimeType
=
tmpArray
[
2
]
||
'
application/octet-stream
'
;
if
(
!
fileName
)
{
if
(
!
fileName
)
{
throw
new
Error
(
'
file name must not be empty.
'
);
throw
new
Error
(
'
file name must not be empty.
'
);
...
@@ -87,7 +89,7 @@ Selenium.prototype.doSetFile = function(locator, url_and_filename) {
...
@@ -87,7 +89,7 @@ Selenium.prototype.doSetFile = function(locator, url_and_filename) {
new
ClipboardEvent
(
''
).
clipboardData
||
new
ClipboardEvent
(
''
).
clipboardData
||
/* specs compliant (as of March 2018 only Chrome) */
/* specs compliant (as of March 2018 only Chrome) */
new
DataTransfer
();
new
DataTransfer
();
dT
.
items
.
add
(
new
File
([
blob
],
fileName
));
dT
.
items
.
add
(
new
File
([
blob
],
fileName
,
{
type
:
mimeType
}
));
fileField
.
files
=
dT
.
files
;
fileField
.
files
=
dT
.
files
;
}));
}));
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment