Skip to content

Commit

Permalink
v3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dsheiko committed Mar 23, 2020
1 parent 9ab9719 commit 429512e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Puppetry 3.2.1

### Bug fixes
- fix: accept relative path for target.upload
- fix: workaround for https://github.com/puppeteer/puppeteer/issues/5420

# Puppetry 3.2.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "puppetry",
"description": "Puppetry - codeless end-to-end test automation, integrated with CI/CD pipeline",
"version": "3.2.0",
"version": "3.2.1",
"author": "Dmitry Sheiko <me@dsheiko.com> (http://dsheiko.com)",
"engines": {
"node": ">=11.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export class ParamsFormBuilder extends React.Component {

onClickSelectFile = ( e, item ) => {
e.preventDefault();
if ( typeof item === "undefined" ) {
return;
}
this.filepathName = item.name;
ipcRenderer.send( E_BROWSE_FILE, "" );
}
Expand Down Expand Up @@ -130,7 +133,7 @@ export class ParamsFormBuilder extends React.Component {
placeholder={ field.placeholder }
rows={ 4 } /> );
case FILE:
return ( <Input style={ inputStyle } onClick={ this.onClickSelectFile } disabled /> );
return ( <Input style={ inputStyle } onClick={ this.onClickSelectFile } /> );
case TARGET_SELECT:
return ( <Select
{ ...SELECT_SEARCH_PROPS }
Expand Down
17 changes: 13 additions & 4 deletions src/component/Schema/Params/Element/upload.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import { FILE, INPUT, INPUT_NUMBER } from "../../constants";
import { renderTarget, result } from "service/utils";
import fs from "fs";
import { join } from "path";

export const upload = {
template: ({ target, params }) => {
const { path, name, size } = params;
template: ({ target, params, targetObj, projectDirectory }) => {
const { path, name, size } = params,
resolvedPath = path ? ( fs.existsSync( path ) ? path : join( projectDirectory, path ) ) : null;

return `
// Upload input[type=file]
${ ( name && size )
? `result = util.generateTmpUploadFile( "${ name }", ${ size } );`
: `result = "${ path }";` }
await ( ${ renderTarget( target ) } ).uploadFile( result );`;
: `result = "${ resolvedPath }";` }
await ( ${ renderTarget( target ) } ).uploadFile( result );
// workaround https://github.com/puppeteer/puppeteer/issues/5420
if ( ${ JSON.stringify( targetObj.css ) } ) {
await bs.page.evaluate(( inputSelector ) => {
document.querySelector( inputSelector ).dispatchEvent(new Event('change', { bubbles: true }));
}, ${ JSON.stringify( targetObj.selector ) } );
}`;
},

toLabel: ({ params }) => ( params.name && params.size )
Expand Down

0 comments on commit 429512e

Please sign in to comment.