From e02abb988b5a6b56ab22cdad1f1cdb090beeea84 Mon Sep 17 00:00:00 2001 From: Dmitry Sheiko Date: Fri, 13 Aug 2021 11:33:51 +0200 Subject: [PATCH] https://github.com/dsheiko/puppetry/issues/93 --- .eslintrc.js | 1 + src/component/Modal/TestReportModal/BrowserOptions.jsx | 5 +++-- src/component/Schema/Jest/index.js | 5 ++++- src/component/Schema/Params/Element/upload.js | 3 +-- src/service/ExpressionParser.js | 3 +++ src/service/assert.js | 5 +++-- src/service/io.js | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6751bb08..d0339ee7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -146,6 +146,7 @@ module.exports = { "identifiers": false, "lang": "en_US", "skipWords": [ + "hfirefox", "Puppetter", "reCaptcha", "Captcha", diff --git a/src/component/Modal/TestReportModal/BrowserOptions.jsx b/src/component/Modal/TestReportModal/BrowserOptions.jsx index 416ab348..7465dbfc 100644 --- a/src/component/Modal/TestReportModal/BrowserOptions.jsx +++ b/src/component/Modal/TestReportModal/BrowserOptions.jsx @@ -1,5 +1,5 @@ import React from "react"; -import { Checkbox, Select, Icon } from "antd"; +import { Checkbox, Select } from "antd"; import ErrorBoundary from "component/ErrorBoundary"; import AbstractComponent from "component/AbstractComponent"; import BrowseDirectory from "component/Global/BrowseDirectory"; @@ -209,7 +209,8 @@ export class BrowserOptions extends AbstractComponent { { [ "headless", "chromium", "chrome" ].includes( this.state.product ) ? : null } - { [ "_firefox", "firefox" ].includes( this.state.product ) ? : null } + { [ "_firefox", "firefox" ].includes( this.state.product ) + ? : null } { [ "headless", "chromium", "chrome" ].includes( this.state.product ) ?
diff --git a/src/component/Schema/Jest/index.js b/src/component/Schema/Jest/index.js index ad55cf3c..97c40654 100644 --- a/src/component/Schema/Jest/index.js +++ b/src/component/Schema/Jest/index.js @@ -92,7 +92,10 @@ const { bs, util, fetch, localStorage } = require( "../lib/bootstrap" )( ${ JSON.stringify( normalizeName( title ) ) } ), puppeteerOptions = require( "../puppeteer.config.json" ), - devices = require( "puppeteer" ).devices; + devices = require( "puppeteer" ).devices, + fs = require( "fs" ), + path = require( "path" ), + os = require( "os" ); ${ runner === RUNNER_PUPPETRY ? ` diff --git a/src/component/Schema/Params/Element/upload.js b/src/component/Schema/Params/Element/upload.js index 0d3397d9..1f5384fa 100644 --- a/src/component/Schema/Params/Element/upload.js +++ b/src/component/Schema/Params/Element/upload.js @@ -1,7 +1,6 @@ import { FILE, INPUT, INPUT_NUMBER } from "../../constants"; import { renderTarget, result } from "service/utils"; import ExpressionParser from "service/ExpressionParser"; -import fs from "fs"; import { join } from "path"; export const upload = { @@ -103,4 +102,4 @@ export const upload = { } } ] -}; +}; \ No newline at end of file diff --git a/src/service/ExpressionParser.js b/src/service/ExpressionParser.js index ca2eb4fa..0a8038a0 100644 --- a/src/service/ExpressionParser.js +++ b/src/service/ExpressionParser.js @@ -52,6 +52,9 @@ class Parsers { // {{ FOO }} variable = ( key ) => `ENV[ "${ key }" ]`; + + // {{ eval("process.cwd()") }} + eval = ([ key ]) => key; } export default class ExpressionParser { diff --git a/src/service/assert.js b/src/service/assert.js index 2f447963..84892e82 100644 --- a/src/service/assert.js +++ b/src/service/assert.js @@ -74,10 +74,11 @@ export function justify( text ) { } function parseTpl( value, id, type ) { - if ( typeof type === "undefined" || type !== "string" ) { + // https://github.com/dsheiko/puppetry/pull/91/commits/8c939d2bd822a88eb49511e78ac5055d17828962 + if ( typeof type === "undefined" || !( type == "string" || type == "text" ) ) { return JSON.stringify( value ); } - // @see ./src/component/Schema/Params/Element/assertText.js + // @see ./src/component/Schema/Params/Element/assertText.js if ( typeof type !== "undefined" && type === "text" ) { value = value.replace( /\n+/gm, "\n" ); } diff --git a/src/service/io.js b/src/service/io.js index d4fb8a1c..4bb26264 100644 --- a/src/service/io.js +++ b/src/service/io.js @@ -576,7 +576,7 @@ export function initRuntimeTestPath() { return; } try { - shell.mkdir( "-p" , DEST_DIR ); + shell.mkdir( "-p" , DEST_DIR ); shell.cp( "-f" , SRC_DIR + "/package.json", DEST_DIR + "/" ); shell.chmod( "-R", 777, DEST_DIR ); } catch ( e ) {