Automate tutorial following#48
Closed
iurimatias wants to merge 3 commits into
Closed
Conversation
- Pin all logos-co repo refs in the 4 guides to /tutorial-v2 - Fix broken cross-doc anchors (#61-running-with-logoscore, #42-building-lgx-packages) - Sync logos-calc-ui-cpp example with Part 3: add status PROP to calc_ui_cpp.rep and status binding/display to Main.qml Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR pins tutorial documentation examples to the tutorial-v2 branch and adds automated tutorial replay specs plus a Bash runner for scaffolding, building, inspecting, and UI-testing the tutorials. It also updates the C++ UI example to expose and display a backend status property.
Changes:
- Updated tutorial/developer guide flake URLs and some guide cross-reference anchors.
- Added YAML tutorial test specs and a
tests/run-tutorial-test.shharness. - Added
statusto the C++ UI.repinterface and QML display.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
tutorial-wrapping-c-library.md |
Pins tutorial commands and flake examples to tutorial-v2; updates guide links. |
tutorial-qml-ui-app.md |
Pins QML tutorial commands and dependency examples to tutorial-v2; updates guide links. |
tutorial-cpp-ui-app.md |
Pins C++ UI tutorial scaffold and flake examples to tutorial-v2. |
logos-developer-guide.md |
Pins guide command examples to tutorial-v2 and updates LGX guide references. |
tests/run-tutorial-test.sh |
Adds the automated tutorial replay/test runner. |
tests/tutorial-wrapping-c-library.test.yaml |
Adds replay spec for the C library wrapping tutorial. |
tests/tutorial-qml-ui-app.test.yaml |
Adds replay spec for the QML UI tutorial. |
tests/tutorial-cpp-ui-app.test.yaml |
Adds replay spec for the C++ UI backend tutorial. |
logos-calc-ui-cpp/src/calc_ui_cpp.rep |
Adds a status Remote Objects property. |
logos-calc-ui-cpp/src/qml/Main.qml |
Reads and displays the backend status property. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Available: scaffold,files,build,inspect,logoscore,basecamp | ||
| # --keep-workdir Don't delete the temp working directory on exit | ||
| # --workdir <path> Use existing directory instead of creating a fresh one | ||
| # (skips scaffold+files phases unless explicitly requested) |
| tutorial: tutorial-wrapping-c-library.md | ||
|
|
||
| scaffold: | ||
| template: "github:logos-co/logos-module-builder#with-external-lib" |
| description = "Calculator module - wraps libcalc C library for Logos"; | ||
|
|
||
| inputs = { | ||
| logos-module-builder.url = "github:logos-co/logos-module-builder"; |
| tutorial: tutorial-qml-ui-app.md | ||
|
|
||
| scaffold: | ||
| template: "github:logos-co/logos-module-builder#ui-qml" |
Comment on lines
+230
to
+231
| logos-module-builder.url = "github:logos-co/logos-module-builder"; | ||
| calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module"; |
| tutorial: tutorial-cpp-ui-app.md | ||
|
|
||
| scaffold: | ||
| template: "github:logos-co/logos-module-builder#ui-qml-backend" |
Comment on lines
+305
to
+306
| logos-module-builder.url = "github:logos-co/logos-module-builder"; | ||
| calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module"; |
Comment on lines
+426
to
+478
|
|
||
| # Generate .mjs test file from YAML basecamp declarations | ||
| MJS_FILE="$(mktemp "${WORKDIR}/basecamp-test-XXXXXX.mjs")" | ||
|
|
||
| { | ||
| echo 'import { resolve } from "node:path";' | ||
| echo "const qtMcpRoot = \"$QT_MCP\";" | ||
| echo 'const { test, run } = await import(resolve(qtMcpRoot, "test-framework/framework.mjs"));' | ||
| echo '' | ||
| echo "test(\"$TUTORIAL_NAME: basecamp UI verification\", async (app) => {" | ||
|
|
||
| BC_TEST_COUNT=$(yq_read '.basecamp.tests | length') | ||
| for i in $(seq 0 $((BC_TEST_COUNT - 1))); do | ||
| ACTION=$(yq_read ".basecamp.tests[$i].action") | ||
| TARGET=$(yq_read ".basecamp.tests[$i].target") | ||
| TEXTS=$(yq_read ".basecamp.tests[$i].texts") | ||
| TIMEOUT=$(yq_read ".basecamp.tests[$i].timeout") | ||
| NAME=$(yq_read ".basecamp.tests[$i].name") | ||
|
|
||
| case "$ACTION" in | ||
| click) | ||
| echo " await app.click(\"$TARGET\");" | ||
| ;; | ||
| expect_texts) | ||
| TEXTS_JS=$(yq_read ".basecamp.tests[$i].texts | @json") | ||
| echo " await app.expectTexts($TEXTS_JS);" | ||
| ;; | ||
| wait_for) | ||
| TEXTS_JS=$(yq_read ".basecamp.tests[$i].texts | @json") | ||
| TO="${TIMEOUT:-10000}" | ||
| echo " await app.waitFor(" | ||
| echo " async () => { await app.expectTexts($TEXTS_JS); }," | ||
| echo " { timeout: $TO, interval: 500, description: \"$NAME\" }" | ||
| echo " );" | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| echo '});' | ||
| echo '' | ||
| echo 'run();' | ||
| } > "$MJS_FILE" | ||
|
|
||
| [[ "$VERBOSE" == "true" ]] && echo " Generated test file: $MJS_FILE" | ||
|
|
||
| # Run the generated test | ||
| if node "$MJS_FILE" --ci "$BASECAMP_BIN" --verbose 2>&1; then | ||
| pass "basecamp UI tests" | ||
| else | ||
| fail "basecamp UI tests" "test runner exited with non-zero" | ||
| fi | ||
|
|
||
| rm -f "$MJS_FILE" |
| QUIT_FLAG="--quit-on-finish" | ||
| fi | ||
|
|
||
| cmd="timeout $CALL_TIMEOUT logoscore $QUIT_FLAG -m ./modules -l $MODULE_NAME -c \"$TEST_CALL\"" |
automate tutorial following improve test specs; ensure basecamp tests are being run replicate issue; run tests in the CI merge actions
fix for tutorial fix linux test
b1e631e to
c051f59
Compare
Member
Author
|
closed in favour of #50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.