diff --git a/fastn-core/tests/01-help/cmd.p1 b/fastn-core/tests/01-help/cmd.p1 index b8b70c7ecf..4c29ed5c25 100644 --- a/fastn-core/tests/01-help/cmd.p1 +++ b/fastn-core/tests/01-help/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test --help +cmd: $FBT_CWD/../target/release/fastn --test --help Will have to be updated every time version changes. diff --git a/fastn-core/tests/02-hello/cmd.p1 b/fastn-core/tests/02-hello/cmd.p1 index a6dca68bdb..cc6e6a74a1 100644 --- a/fastn-core/tests/02-hello/cmd.p1 +++ b/fastn-core/tests/02-hello/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 --ignore-failed +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 --ignore-failed output: amitu/.build -- stdout: diff --git a/fastn-core/tests/03-nested-document/cmd.p1 b/fastn-core/tests/03-nested-document/cmd.p1 index ceda2b5374..8ed652e74d 100644 --- a/fastn-core/tests/03-nested-document/cmd.p1 +++ b/fastn-core/tests/03-nested-document/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 output: amitu/.build diff --git a/fastn-core/tests/04-import-code-block/cmd.p1 b/fastn-core/tests/04-import-code-block/cmd.p1 index dc71a75e33..f05ce204ec 100644 --- a/fastn-core/tests/04-import-code-block/cmd.p1 +++ b/fastn-core/tests/04-import-code-block/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 output: amitu/.build diff --git a/fastn-core/tests/05-hello-font/cmd.p1 b/fastn-core/tests/05-hello-font/cmd.p1 index e5bd727eda..021ccc2a64 100644 --- a/fastn-core/tests/05-hello-font/cmd.p1 +++ b/fastn-core/tests/05-hello-font/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 output: amitu/.build -- stdout: diff --git a/fastn-core/tests/08-static-assets/cmd.p1 b/fastn-core/tests/08-static-assets/cmd.p1 index 14b0fc1713..60294e4e61 100644 --- a/fastn-core/tests/08-static-assets/cmd.p1 +++ b/fastn-core/tests/08-static-assets/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build output: amitu/.build -- stdout: diff --git a/fastn-core/tests/09-markdown-pages/cmd.p1 b/fastn-core/tests/09-markdown-pages/cmd.p1 index 0f4bc70703..028e7d0a9a 100644 --- a/fastn-core/tests/09-markdown-pages/cmd.p1 +++ b/fastn-core/tests/09-markdown-pages/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build output: amitu/.build -- stdout: diff --git a/fastn-core/tests/10-readme-index/cmd.p1 b/fastn-core/tests/10-readme-index/cmd.p1 index 914620bda8..48083adcd4 100644 --- a/fastn-core/tests/10-readme-index/cmd.p1 +++ b/fastn-core/tests/10-readme-index/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build output: amitu/.build skip: temporarily removed markdown support diff --git a/fastn-core/tests/11-readme-with-index/cmd.p1 b/fastn-core/tests/11-readme-with-index/cmd.p1 index 96483f2fa3..f3d92bff73 100644 --- a/fastn-core/tests/11-readme-with-index/cmd.p1 +++ b/fastn-core/tests/11-readme-with-index/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 output: amitu/.build -- stdout: diff --git a/fastn-core/tests/15-fpm-dependency-alias/cmd.p1 b/fastn-core/tests/15-fpm-dependency-alias/cmd.p1 index eecee14d9d..a9efdf7d05 100644 --- a/fastn-core/tests/15-fpm-dependency-alias/cmd.p1 +++ b/fastn-core/tests/15-fpm-dependency-alias/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: cd amitu && $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: cd amitu && $FBT_CWD/../target/release/fastn --test build --edition 2022 output: amitu/.build -- stdout: diff --git a/fastn-core/tests/16-include-processor/cmd.p1 b/fastn-core/tests/16-include-processor/cmd.p1 index 812d354321..e3f5129c2b 100644 --- a/fastn-core/tests/16-include-processor/cmd.p1 +++ b/fastn-core/tests/16-include-processor/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test build --edition 2022 +cmd: $FBT_CWD/../target/release/fastn --test build --edition 2022 output: .build -- stdout: diff --git a/fastn-core/tests/17-sitemap/cmd.p1 b/fastn-core/tests/17-sitemap/cmd.p1 index 6c09245487..9b90bb9b8b 100644 --- a/fastn-core/tests/17-sitemap/cmd.p1 +++ b/fastn-core/tests/17-sitemap/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test build +cmd: $FBT_CWD/../target/release/fastn --test build output: .build -- stdout: diff --git a/fastn-core/tests/18-fmt/cmd.p1 b/fastn-core/tests/18-fmt/cmd.p1 index ac002fd4b3..e1f62e1c29 100644 --- a/fastn-core/tests/18-fmt/cmd.p1 +++ b/fastn-core/tests/18-fmt/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test update && $FBT_CWD/../target/debug/fastn --test fmt +cmd: $FBT_CWD/../target/release/fastn --test update && $FBT_CWD/../target/release/fastn --test fmt output: . -- stdout: diff --git a/fastn-core/tests/19-offline-build/cmd.p1 b/fastn-core/tests/19-offline-build/cmd.p1 index 56da43d49b..9d5e748c6f 100644 --- a/fastn-core/tests/19-offline-build/cmd.p1 +++ b/fastn-core/tests/19-offline-build/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test update && $FBT_CWD/../target/debug/fastn --test build --offline +cmd: $FBT_CWD/../target/release/fastn --test update && $FBT_CWD/../target/release/fastn --test build --offline output: .build -- stdout: diff --git a/fastn-core/tests/20-fastn-update-check/cmd.p1 b/fastn-core/tests/20-fastn-update-check/cmd.p1 index 458afb8156..c3eacaad8c 100644 --- a/fastn-core/tests/20-fastn-update-check/cmd.p1 +++ b/fastn-core/tests/20-fastn-update-check/cmd.p1 @@ -1,5 +1,5 @@ -- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test update --check +cmd: $FBT_CWD/../target/release/fastn --test update --check exit-code: 7 -- stdout: diff --git a/fastn-core/tests/21-bot-ssr/cmd.p1 b/fastn-core/tests/21-bot-ssr/cmd.p1 new file mode 100644 index 0000000000..3f5bf53a2c --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/cmd.p1 @@ -0,0 +1,13 @@ +-- fbt: +cmd: $FBT_CWD/tests/21-bot-ssr/run-test.sh +output: .build + +-- stdout: + +Updated package dependency. +Starting fastn server ... +No packages updated. +### Server Started ### +Go to: http://127.0.0.1:8000 +Curling http://127.0.0.1:8000 with User Agent Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) ... +Curling http://127.0.0.1:8000 with User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123 Safari/537.36 ... diff --git a/fastn-core/tests/21-bot-ssr/input/FASTN.ftd b/fastn-core/tests/21-bot-ssr/input/FASTN.ftd new file mode 100644 index 0000000000..6c57c15503 --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/input/FASTN.ftd @@ -0,0 +1,3 @@ +-- import: fastn + +-- fastn.package: fastn-community.github.io/ssr-test diff --git a/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo-dark.svg b/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo-dark.svg new file mode 100644 index 0000000000..0dfb673b7c --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo-dark.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo.svg b/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo.svg new file mode 100644 index 0000000000..e051e3fa36 --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/input/assets/ipsum-logo.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fastn-core/tests/21-bot-ssr/input/index.ftd b/fastn-core/tests/21-bot-ssr/input/index.ftd new file mode 100644 index 0000000000..15d0a99c06 --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/input/index.ftd @@ -0,0 +1,13 @@ +-- import: fastn-community.github.io/ssr-test/assets + +-- ftd.column: +width: fill-container +height: fill-container +align-content: center +spacing.fixed.rem: 2 + +-- ftd.image: $assets.files.assets.ipsum-logo.svg + +-- ftd.text: Hello SSR! + +-- end: ftd.column diff --git a/fastn-core/tests/21-bot-ssr/output/index-with-ssr.html b/fastn-core/tests/21-bot-ssr/output/index-with-ssr.html new file mode 100644 index 0000000000..d1c527576b --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/output/index-with-ssr.html @@ -0,0 +1,3659 @@ + + + + + + + + + + + + + + + + + + + + + + +
Hello world
Created using fastn
+ + diff --git a/fastn-core/tests/21-bot-ssr/output/index-without-ssr.html b/fastn-core/tests/21-bot-ssr/output/index-without-ssr.html new file mode 100644 index 0000000000..9cef311dbf --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/output/index-without-ssr.html @@ -0,0 +1,3624 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fastn-core/tests/21-bot-ssr/run-test.sh b/fastn-core/tests/21-bot-ssr/run-test.sh new file mode 100755 index 0000000000..c7d1ae5330 --- /dev/null +++ b/fastn-core/tests/21-bot-ssr/run-test.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +FASTN="$FBT_CWD/../target/release/fastn" +SITE_URL="http://127.0.0.1:8000" +BOT_USER_AGENT="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" +NORMAL_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123 Safari/537.36" + +"$FASTN" --test update + +echo "Starting fastn server ..." +"$FASTN" --test serve --offline & +FASTN_SERVE_PID=$! + +sleep 5 + +build_dir=".build" +if [ ! -d "$build_dir" ]; then + mkdir "$build_dir" +fi + +echo "Curling $SITE_URL with User Agent $BOT_USER_AGENT ..." +curl -A "$BOT_USER_AGENT" -s "$SITE_URL" -o "$build_dir/index-with-ssr.html" + +sleep 5 + +echo "Curling $SITE_URL with User Agent $NORMAL_USER_AGENT ..." +curl -A "$NORMAL_USER_AGENT" -s "$SITE_URL" -o "$build_dir/index-without-ssr.html" + +sleep 5 + +kill -9 "$FASTN_SERVE_PID" diff --git a/fastn-core/tests/fbt.p1 b/fastn-core/tests/fbt.p1 index d9c74ffd2f..ddd68e5598 100644 --- a/fastn-core/tests/fbt.p1 +++ b/fastn-core/tests/fbt.p1 @@ -1,2 +1,2 @@ -- fbt: -build: cd .. && cargo install --path fastn --profile dev --features auth +build: cd .. && cargo install --path fastn --profile release --features auth