Skip to content

Commit

Permalink
doc(examples): report fantoccini use (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
agilarity authored Sep 1, 2023
1 parent bee9bd8 commit a631c5c
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions examples/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ echo "CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = $examples"

[tasks.test-runner-report]
workspace = false
description = "report ci test runners for each example - OPTION: [all]"
description = "report ci test runners and tools for each example - OPTION: [all]"
script = '''
set -emu
Expand All @@ -62,7 +62,7 @@ YELLOW="\e[0;33m"
RESET="\e[0m"
echo
echo "${YELLOW}Test Runner Report${RESET}"
echo "${YELLOW}Test Runner & Tool Report${RESET}"
echo "${ITALIC}Pass the option \"all\" to show all the examples${RESET}"
echo
Expand All @@ -77,52 +77,71 @@ start_path=$(pwd)
for path in $makefile_paths; do
cd $path
test_runner=
crate_symbols=
test_count=$(grep -rl -E "#\[test\]" | wc -l)
if [ $test_count -gt 0 ]; then
test_runner="T"
crate_symbols="T"
fi
while read -r line; do
case $line in
*"cucumber"*)
test_runner=$test_runner"C"
crate_symbols=$crate_symbols"C"
;;
*"fantoccini"*)
crate_symbols=$crate_symbols"F"
;;
*"rstest"*)
test_runner=$test_runner"R"
crate_symbols=$crate_symbols"R"
;;
esac
done <"./Cargo.toml"
while read -r line; do
case $line in
*"wasm-test.toml"*)
test_runner=$test_runner"W"
crate_symbols=$crate_symbols"W"
;;
*"playwright-test.toml"*)
test_runner=$test_runner"P"
crate_symbols=$crate_symbols"P"
;;
*"cargo-leptos-test.toml"*)
test_runner=$test_runner"L"
crate_symbols=$crate_symbols"L"
;;
esac
done <"./Makefile.toml"
runners=$(echo ${test_runner} | grep -o . | sort | tr -d "\n")
# Sort list of tools
sorted_crate_symbols=$(echo ${crate_symbols} | grep -o . | sort | tr -d "\n")
formatted_crate_symbols=" ➤ ${BOLD}${YELLOW}${sorted_crate_symbols}${RESET}"
crate_line=$path
if [ ! -z ${1+x} ]; then
# Show all examples
echo "$path ➤ ${BOLD}${runners}${RESET}"
elif [ ! -z $runners ]; then
if [ ! -z $crate_symbols ]; then
crate_line=$crate_line$formatted_crate_symbols
fi
echo $crate_line
elif [ ! -z $crate_symbols ]; then
# Filter out examples that do not run tests in `ci`
echo "$path ➤ ${BOLD}${runners}${RESET}"
crate_line=$crate_line$formatted_crate_symbols
echo $crate_line
fi
cd ${start_path}
done
c="${BOLD}${YELLOW}C${RESET} = Cucumber"
f="${BOLD}${YELLOW}F${RESET} = Fantoccini WebDriver"
l="${BOLD}${YELLOW}L${RESET} = Cargo Leptos"
p="${BOLD}${YELLOW}P${RESET} = Playwright"
r="${BOLD}${YELLOW}R${RESET} = RS Test"
t="${BOLD}${YELLOW}T${RESET} = Cargo"
w="${BOLD}${YELLOW}W${RESET} = WASM"
echo
echo "${ITALIC}Runners: C = Cucumber, L = Cargo Leptos, P = Playwright, R = RS Test, T = Cargo, W = WASM${RESET}"
echo "${ITALIC}Key:${RESET} $c, $f, $l, $p, $r, $t, $w"
echo
'''

Expand Down

0 comments on commit a631c5c

Please sign in to comment.