E2e tests with real Flask + seeded test DB, fix platform-specific build failures, update workshop content, remove Google Fonts, disable telemetry#178
Conversation
…ld deps Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
|
@copilot take a look at the steps in the content folder, which is where learners work on the app as part of a workshop. At some point they're asked to make changes to the app. Make sure those changes make sense with the updated app structure |
…rences) Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Updated all workshop content in commit 9a5fed4. Changes across 11 files: 1-hour workshop: Updated README, Full-day workshop: Updated README, Other: Root |
|
@copilot lets update that e2e approach! Rather than mocking out the Flask server, let's get a separate database setup for Flask to use that's seeded for the API calls when Playwright runs. Then make sure everything is setup to use this new approach |
…r e2e tests Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Done in 28e1ba4. The e2e tests now use the real Flask server with a separate test database:
All 13 e2e tests pass against the real Flask server. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot lets get rid of the Google fonts |
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Removed in dd43328. Deleted the three Google Fonts Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot make sure Astro telemetry is disabled |
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
The e2e tests previously used
page.route()to mock client-side fetches — but with SSR, fetches happen server-side, making those mocks ineffective. Additionally, direct@esbuild/linux-arm64dependencies caused build failures on x64. Workshop content in thecontent/folder also referenced Svelte components and tooling that no longer exist after the app simplification.E2e test architecture — real Flask with seeded test database
server/utils/seed_test_database.py— creates a freshe2e_test_dogshelter.dbwith deterministic test data (3 breeds, 3 dogs with known attributes)server/app.pynow accepts aDATABASE_PATHenvironment variable, allowing tests to use a separate database without touching the main oneplaywright.config.tsseeds the test database, starts Flask (withDATABASE_PATHpointing to the test DB), and starts the Astro dev server (API_SERVER_URL→ Flask) before running testsE2e test rewrites
api-integration.spec.ts— Replacedpage.route()client-side mocks with assertions against SSR-rendered content from the seeded test databasehomepage.spec.ts— Removed "loading state" and client-side error tests (don't exist with SSR); switched todata-testidselectorsdog-details.spec.ts— Replaced.grid a[href^="/dog/"]CSS selectors withdata-testidlocatorsDependency cleanup
@esbuild/linux-arm64,esbuild,esbuild-wasm(transitive via Vite, direct deps caused platform mismatch)Remove Google Fonts
<link>tags (preconnect + Inter stylesheet) fromLayout.astro--font-sansCSS variable to use system font stack only, removing the'Inter'referenceDisable Astro telemetry
process.env.ASTRO_TELEMETRY_DISABLED = '1'at the top ofastro.config.mjsto disable Astro telemetry project-wideWorkshop content updates
Updated all Svelte references across both workshops to reflect the pure-Astro app structure:
README.md,0-setup.md,1-add-endpoint.md,3-copilot-instructions.md,4-add-feature.md— replaced "Astro and Svelte" with "Astro", changedDogList.sveltefile references toDogList.astroREADME.md,3-codespaces.md(removedsvelte.svelte-vscodefrom devcontainer extensions),5-context.md,6-code.md— same Svelte → Astro updatesREADME.mdandscripts/start-app.shcomment updatedOriginal prompt
This section details on the original issue you should resolve
<issue_title>Streamline app</issue_title>
<issue_description># Plan: Simplify Client App — Pure Astro, Remove Svelte
Problem Statement
The client app is more complex than necessary:
DogList.svelte,DogDetails.svelte) have zero client-side interactivity (no state changes, no event handlers, just data display and<a>links). They can be simple Astro components.fetch('/api/...'), even though Astro is configured for SSR and can fetch server-side in page frontmatter/api/requests and proxies them to Flask. With server-side fetching in Astro, this layer is unnecessaryautoprefixer,postcss(Tailwind v4 handles this),flask-cors(no cross-origin requests with SSR)Proposed Approach
Remove Svelte entirely. Convert Svelte components to Astro components. Fetch data server-side in Astro page frontmatter. Remove the middleware proxy, dead dependencies, and unused files.
Todos
1. Convert
DogList.svelte→DogList.astroclient/src/components/DogList.svelteclient/src/components/DogList.astrodogsarray viaAstro.props2. Convert
DogDetails.svelte→DogDetails.astroclient/src/components/DogDetails.svelteclient/src/components/DogDetails.astrodogobject viaAstro.props3. Update
index.astro— server-side data fetchingclient/src/pages/index.astroAPI_SERVER_URL/api/dogs)DogList.astroas propsglobal.cssimport (already in Layout)4. Update
[id].astro— server-side data fetchingclient/src/pages/dog/[id].astroAPI_SERVER_URL/api/dogs/{id})DogDetails.astroas propsexport const prerender = falseand unusedpropsvariable5. Remove the API proxy middleware
client/src/middleware.ts6. Remove Svelte from the project
client/astro.config.mjs— Remove Svelte integration and duplicate vite pluginclient/svelte.config.jsclient/package.json— Removesvelte,@astrojs/svelte7. Remove dead dependencies
client/package.json— Removeautoprefixer,postcss(Tailwind v4 + Vite handles CSS natively)server/requirements.txt— Removeflask-cors(no cross-origin with SSR)8. Remove unused assets
client/src/assets/astro.svg,client/src/assets/background.svg(starter template leftovers, not referenced anywhere)9. Clean up minor issues
global.css— It only contains@import "tailwindcss". Move this into the<style is:global>block inLayout.astroand delete the file. Removes a file and 3 redundant imports.dark:variants —<html>hasclass="dark"hardcoded, sodark:prefixes are always active. The non-dark variants (bg-blue-500,bg-white,text-slate-800) never apply. Replacebg-blue-500 dark:bg-blue-700with justbg-blue-700, etc. Simpler for learners to read.transition-colors duration-300— These transition classes appear on many elements but never trigger (no theme switching). Dead code.// about pagecomment fromabout.astro10. Update all libraries to latest versions
astro,@astrojs/node,@tailwindcss/vite,tailwindcss,typescript,@playwright/test,@types/nodeflask,sqlalchemy,flask_sqlalchemyto latest stable11. Add data-testid attributes to all components
data-testidattributes to key elements across all Astro components for stable test selectorsDogList.astro,DogDetails.astro,index.astro,[id].astro,about.astro,Header.astrodog-list,dog-card,dog-name,dog-breed,dog-details,dog-age,dog-gender,dog-status,dog-description,error-message,empty-state,back-link12. Create mock API server for e2e tests
client/e2e-tests/mock-api.ts— A lightweight Node.js...🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.