Skip to content

Commit

Permalink
#32 - baseline option to output to separate folder
Browse files Browse the repository at this point in the history
not yet tested for windows runner. but that’s ok, shouldn’t break
existing functionality when baseline option is not used. test that when
have access to windows env. tested for macos/linux

decided to put as part of existing framework because it can be done
within the main runners tagui / tagui.cmd easily and elegantly. no need
to wait until extending to natural-language cli helper to implement.
  • Loading branch information
kensoh committed Aug 5, 2017
1 parent 10ac6f0 commit 0bcf01f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tagui",
"version": "2.1.0",
"version": "2.2.0",
"description": "General purpose tool for automating web interactions",
"keywords": [
"tagui"
Expand Down
22 changes: 19 additions & 3 deletions src/tagui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ chrome_command="google-chrome"

if [ -z "$1" ]
then
echo "tagui v2.0: use following syntax and below options to run ./tagui flow_filename option(s)"
echo "tagui v2.2: use following syntax and below options to run ./tagui flow_filename option(s)"
echo
echo "IMPORTANT: SAVE YOUR WORK BEFORE USING CHROME OR HEADLESS, TAGUI WILL RESTART CHROME"
echo "headless - run on invisible Chrome web browser instead of default PhantomJS (first install Chrome)"
Expand All @@ -17,6 +17,7 @@ echo "report - web report for sharing of run results on webserver (default is
echo "debug - show run-time backend messages from PhantomJS for detailed tracing and logging"
echo "quiet - run without output except for explicit output (echo / show / check / errors etc)"
echo "test - professional testing using CasperJS assertions (TagUI smart tx('selector') usable)"
echo "baseline - output execution log and relative-path output files to a separate baseline directory"
echo "input(s) - add your own parameter(s) to be used in your automation flow as variables p1 to p9"
echo
echo "TagUI is a general purpose tool for automating web interactions ~ http://tebel.org"
Expand All @@ -34,8 +35,23 @@ fi;fi;fi;fi; set -- "$online_flowname" "${@:2}"; fi
# check whether specified automation flow file exists
if ! [ -f "$1" ]; then echo "ERROR - cannot find $1"; exit 1; fi

# get and set absolute filename of automation flow file
set -- "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" "${@:2}"
tagui_baseline_mode=false
# check baseline parameter to output files to baseline directory
if [ "$2" = "baseline" ]; then set -- "$1" "${@:3}"; tagui_baseline_mode=true; fi
if [ "$3" = "baseline" ]; then set -- "${@:1:2}" "${@:4}"; tagui_baseline_mode=true; fi
if [ "$4" = "baseline" ]; then set -- "${@:1:3}" "${@:5}"; tagui_baseline_mode=true; fi
if [ "$5" = "baseline" ]; then set -- "${@:1:4}" "${@:6}"; tagui_baseline_mode=true; fi
if [ "$6" = "baseline" ]; then set -- "${@:1:5}" "${@:7}"; tagui_baseline_mode=true; fi
if [ "$7" = "baseline" ]; then set -- "${@:1:6}" "${@:8}"; tagui_baseline_mode=true; fi
if [ "$8" = "baseline" ]; then set -- "${@:1:7}" "${@:9}"; tagui_baseline_mode=true; fi
if [ "$9" = "baseline" ]; then set -- "${@:1:8}"; tagui_baseline_mode=true; fi

# check baseline option, get and set absolute filename of automation flow file
if [ "$tagui_baseline_mode" == false ]; then set -- "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" "${@:2}"
else if ! [ -d "$(cd "$(dirname "$1")"; pwd)/baseline" ]; then mkdir "$(cd "$(dirname "$1")"; pwd)/baseline"; fi
cp "$1" "$(cd "$(dirname "$1")"; pwd)/baseline/."
set -- "$(cd "$(dirname "$1")"; pwd)/baseline/$(basename "$1")" "${@:2}"
fi

# save location of initial directory where tagui is called
initial_dir=`pwd`
Expand Down
51 changes: 48 additions & 3 deletions src/tagui.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rem enable windows for loop advanced flow control
setlocal enableextensions enabledelayedexpansion

if "%~1"=="" (
echo tagui v2.0: use following syntax and below options to run - tagui flow_filename option^(s^)
echo tagui v2.2: use following syntax and below options to run - tagui flow_filename option^(s^)
echo.
echo IMPORTANT: SAVE YOUR WORK BEFORE USING CHROME OR HEADLESS, TAGUI WILL RESTART CHROME
echo headless - run on invisible Chrome web browser instead of default PhantomJS ^(first install Chrome^)
Expand All @@ -19,6 +19,7 @@ echo report - web report for sharing of run results on webserver ^(default is
echo debug - show run-time backend messages from PhantomJS for detailed tracing and logging
echo quiet - run without output except for explicit output ^(echo / show / check / errors etc^)
echo test - professional testing using CasperJS assertions ^(TagUI smart tx^('selector'^) usable^)
echo baseline - output execution log and relative-path output files to a separate baseline directory
echo input^(s^) - add your own parameter^(s^) to be used in your automation flow as variables p1 to p9
echo.
echo TagUI is a general purpose tool for automating web interactions ~ http://tebel.org
Expand Down Expand Up @@ -59,8 +60,52 @@ if not "%flow_file%"=="" if not exist "%online_flowname%" (
exit /b 1
)

rem get and set absolute filename of automation flow file
if "%flow_file%"=="" set "flow_file=%~dpnx1"
set tagui_baseline_mode=false
rem check baseline parameter to output files to baseline directory
if "%arg2%"=="baseline" (
set arg2=
set tagui_baseline_mode=true
)
if "%arg3%"=="baseline" (
set arg3=
set tagui_baseline_mode=true
)
if "%arg4%"=="baseline" (
set arg4=
set tagui_baseline_mode=true
)
if "%arg5%"=="baseline" (
set arg5=
set tagui_baseline_mode=true
)
if "%arg6%"=="baseline" (
set arg6=
set tagui_baseline_mode=true
)
if "%arg7%"=="baseline" (
set arg7=
set tagui_baseline_mode=true
)
if "%arg8%"=="baseline" (
set arg8=
set tagui_baseline_mode=true
)
if "%arg9%"=="baseline" (
set arg9=
set tagui_baseline_mode=true
)

rem check baseline option, get and set absolute filename of automation flow file
if %tagui_baseline_mode%==false (
if "%flow_file%"=="" set "flow_file=%~dpnx1"
) else (
if "%flow_file%"=="" set "flow_file=%~dpnx1"
for %%i in ("%flow_file%") do set "flow_folder=%%~dpi"
for %%i in ("%flow_file%") do set "flow_filename=%%~nxi"
if not exist "!flow_folder!baseline" mkdir "!flow_folder!baseline"
copy "%flow_file%" "!flow_folder!baseline\." > nul
set "flow_file=!flow_folder!baseline\!flow_filename!"
)

rem save location of initial directory where tagui is called
set "initial_dir=%cd%"
Expand Down

0 comments on commit 0bcf01f

Please sign in to comment.