-
Notifications
You must be signed in to change notification settings - Fork 107
Add test steps #2466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
junhouse
wants to merge
4
commits into
main
Choose a base branch
from
add-test-steps
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add test steps #2466
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Coffee Beans E-commerce (React + Node/Express) | ||
|
|
||
| > **Note:** This app was generated using AI and is used only for testing purposes for mixpanel-skill to prevent prompt drift. | ||
|
|
||
| A small, fully functioning demo e-commerce app for selling coffee beans. | ||
|
|
||
| ## Features | ||
| - Product list + product detail pages | ||
| - Cart (add/remove/update quantities) | ||
| - Checkout flow (shipping + customer info) with order confirmation | ||
| - Contact Us form | ||
| - About + FAQ pages | ||
| - Backend REST API (products, orders, contact) | ||
| - Simple in-memory data store (swap to DB later) | ||
|
|
||
| ## Tech | ||
| - Frontend: React + Vite + React Router | ||
| - Backend: Node.js + Express + CORS | ||
| - Dev experience: two terminals (client + server) or use the root `dev` script | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1) Install dependencies | ||
| From the project root: | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| ### 2) Run in development (two ways) | ||
|
|
||
| **Option A: one command (recommended)** | ||
| ```bash | ||
| npm run dev | ||
| ``` | ||
| This starts: | ||
| - API server at http://localhost:5000 | ||
| - React dev server at http://localhost:5173 (proxy to API) | ||
|
|
||
| **Option B: two terminals** | ||
| Terminal 1: | ||
| ```bash | ||
| npm run dev:server | ||
| ``` | ||
| Terminal 2: | ||
| ```bash | ||
| npm run dev:client | ||
| ``` | ||
|
|
||
| ### 3) Build for production | ||
| ```bash | ||
| npm run build | ||
| npm start | ||
| ``` | ||
| This will: | ||
| - build the client | ||
| - serve the built client from the Express server at http://localhost:5000 | ||
|
|
||
| --- | ||
|
|
||
| ## Folder Structure | ||
| - `client/` React app (Vite) | ||
| - `server/` Express API server | ||
|
|
||
| --- | ||
|
|
||
| ## Notes / Next Up Ideas | ||
| - Add Stripe/Shopify payments | ||
| - Add admin dashboard (CRUD products, orders) | ||
| - Add persistent storage (PostgreSQL/MongoDB) | ||
| - Add auth + saved addresses |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Coffee Beans Shop</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.jsx"></script> | ||
| </body> | ||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "coffee-commerce-client", | ||
| "private": true, | ||
| "version": "1.0.0", | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite", | ||
| "build": "vite build", | ||
| "preview": "vite preview" | ||
| }, | ||
| "dependencies": { | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1", | ||
| "react-router-dom": "^6.26.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/react": "^18.3.3", | ||
| "@types/react-dom": "^18.3.0", | ||
| "@vitejs/plugin-react": "^4.3.1", | ||
| "vite": "^5.4.2" | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React from "react"; | ||
| import { Routes, Route } from "react-router-dom"; | ||
| import Layout from "./components/Layout.jsx"; | ||
|
|
||
| import Home from "./pages/Home.jsx"; | ||
| import Shop from "./pages/Shop.jsx"; | ||
| import ProductDetail from "./pages/ProductDetail.jsx"; | ||
| import Cart from "./pages/Cart.jsx"; | ||
| import Checkout from "./pages/Checkout.jsx"; | ||
| import OrderConfirmation from "./pages/OrderConfirmation.jsx"; | ||
| import Contact from "./pages/Contact.jsx"; | ||
| import About from "./pages/About.jsx"; | ||
| import FAQ from "./pages/FAQ.jsx"; | ||
| import Login from "./pages/Login.jsx"; | ||
| import Signup from "./pages/Signup.jsx"; | ||
| import NotFound from "./pages/NotFound.jsx"; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <Layout> | ||
| <Routes> | ||
| <Route path="/" element={<Home />} /> | ||
| <Route path="/shop" element={<Shop />} /> | ||
| <Route path="/products/:id" element={<ProductDetail />} /> | ||
| <Route path="/cart" element={<Cart />} /> | ||
| <Route path="/checkout" element={<Checkout />} /> | ||
| <Route path="/order/:id" element={<OrderConfirmation />} /> | ||
| <Route path="/contact" element={<Contact />} /> | ||
| <Route path="/about" element={<About />} /> | ||
| <Route path="/faq" element={<FAQ />} /> | ||
| <Route path="/login" element={<Login />} /> | ||
| <Route path="/signup" element={<Signup />} /> | ||
| <Route path="*" element={<NotFound />} /> | ||
| </Routes> | ||
| </Layout> | ||
| ); | ||
| } |
11 changes: 11 additions & 0 deletions
11
public/mixpanel-skill/test-app/client/src/components/ErrorBox.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import React from "react"; | ||
|
|
||
| export default function ErrorBox({ error }) { | ||
| if (!error) return null; | ||
| return ( | ||
| <div className="card" style={{ padding: 16, borderColor: "rgba(239,68,68,0.45)" }}> | ||
| <div style={{ fontWeight: 800, marginBottom: 6 }}>Something went wrong</div> | ||
| <div className="small">{String(error.message || error)}</div> | ||
| </div> | ||
| ); | ||
| } |
73 changes: 73 additions & 0 deletions
73
public/mixpanel-skill/test-app/client/src/components/Layout.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import React from "react"; | ||
| import { Link, NavLink, useNavigate } from "react-router-dom"; | ||
| import { useCart } from "../state/cart.jsx"; | ||
| import { useAuth } from "../state/auth.jsx"; | ||
|
|
||
| function CartCount() { | ||
| const { items } = useCart(); | ||
| const count = items.reduce((s, it) => s + it.qty, 0); | ||
| return <span className="badge">{count} item{count === 1 ? "" : "s"}</span>; | ||
| } | ||
|
|
||
| function AuthNav() { | ||
| const { user, logout } = useAuth(); | ||
| const nav = useNavigate(); | ||
|
|
||
| function handleLogout() { | ||
| logout(); | ||
| nav("/"); | ||
| } | ||
|
|
||
| if (user) { | ||
| return ( | ||
| <> | ||
| <span className="small" style={{ opacity: 0.7 }}>{user.name}</span> | ||
| <button className="btn" onClick={handleLogout} style={{ marginLeft: 8 }}> | ||
| Log Out | ||
| </button> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <NavLink to="/login">Log In</NavLink> | ||
| <NavLink to="/signup" className="btn">Sign Up</NavLink> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default function Layout({ children }) { | ||
| return ( | ||
| <div> | ||
| <header className="nav"> | ||
| <div className="nav-inner"> | ||
| <Link to="/" className="brand"> | ||
| <span style={{ fontSize: 18 }}>☕</span> | ||
| <span>Cinder & Bloom</span> | ||
| <span className="badge">Coffee Beans</span> | ||
| </Link> | ||
|
|
||
| <nav className="navlinks"> | ||
| <NavLink to="/shop">Shop</NavLink> | ||
| <NavLink to="/cart">Cart</NavLink> | ||
| <NavLink to="/contact">Contact</NavLink> | ||
| <NavLink to="/faq">FAQ</NavLink> | ||
| <NavLink to="/about">About</NavLink> | ||
| <CartCount /> | ||
| <AuthNav /> | ||
| </nav> | ||
| </div> | ||
| </header> | ||
|
|
||
| <main className="container">{children}</main> | ||
|
|
||
| <footer className="footer"> | ||
| <div>© {new Date().getFullYear()} Cinder & Bloom Coffee</div> | ||
| <div className="small" style={{ marginTop: 8 }}> | ||
| Demo store • Replace branding, products, and policies before launching. | ||
| </div> | ||
| </footer> | ||
| </div> | ||
| ); | ||
| } |
9 changes: 9 additions & 0 deletions
9
public/mixpanel-skill/test-app/client/src/components/Loading.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import React from "react"; | ||
|
|
||
| export default function Loading({ label = "Loading..." }) { | ||
| return ( | ||
| <div className="card" style={{ padding: 16 }}> | ||
| <div className="small">{label}</div> | ||
| </div> | ||
| ); | ||
| } |
9 changes: 9 additions & 0 deletions
9
public/mixpanel-skill/test-app/client/src/components/Price.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import React from "react"; | ||
|
|
||
| export function formatUsdFromCents(cents) { | ||
| return `$${(Number(cents || 0) / 100).toFixed(2)}`; | ||
| } | ||
|
|
||
| export default function Price({ cents }) { | ||
| return <span>{formatUsdFromCents(cents)}</span>; | ||
| } |
22 changes: 22 additions & 0 deletions
22
public/mixpanel-skill/test-app/client/src/components/Toast.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import React from "react"; | ||
|
|
||
| export default function Toast({ message, onClose }) { | ||
| if (!message) return null; | ||
| return ( | ||
| <div style={{ | ||
| position: "fixed", | ||
| right: 16, | ||
| bottom: 16, | ||
| maxWidth: 420, | ||
| zIndex: 50 | ||
| }}> | ||
| <div className="card" style={{ padding: 14, display: "flex", gap: 10, alignItems: "center" }}> | ||
| <div style={{ flex: 1 }}> | ||
| <div style={{ fontWeight: 700 }}>Added to cart</div> | ||
| <div className="small">{message}</div> | ||
| </div> | ||
| <button className="btn" onClick={onClose}>OK</button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| export async function apiGet(path) { | ||
| const res = await fetch(path, { headers: { "Accept": "application/json" }}); | ||
| if (!res.ok) throw new Error(await safeErr(res)); | ||
| return res.json(); | ||
| } | ||
|
|
||
| export async function apiPost(path, body) { | ||
| const res = await fetch(path, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json", "Accept": "application/json" }, | ||
| body: JSON.stringify(body) | ||
| }); | ||
| if (!res.ok) throw new Error(await safeErr(res)); | ||
| return res.json(); | ||
| } | ||
|
|
||
| async function safeErr(res) { | ||
| try { | ||
| const data = await res.json(); | ||
| return data?.error || res.statusText; | ||
| } catch { | ||
| return res.statusText; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React from "react"; | ||
| import ReactDOM from "react-dom/client"; | ||
| import { BrowserRouter } from "react-router-dom"; | ||
| import App from "./App.jsx"; | ||
| import { CartProvider } from "./state/cart.jsx"; | ||
| import { AuthProvider } from "./state/auth.jsx"; | ||
| import "./styles.css"; | ||
|
|
||
| ReactDOM.createRoot(document.getElementById("root")).render( | ||
| <React.StrictMode> | ||
| <BrowserRouter> | ||
| <AuthProvider> | ||
| <CartProvider> | ||
| <App /> | ||
| </CartProvider> | ||
| </AuthProvider> | ||
| </BrowserRouter> | ||
| </React.StrictMode> | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to test/evaluate.