Skip to content

Commit e3cf369

Browse files
committed
Add Bugster integration for automated testing, update README, and add test cases for product browsing and cart functionality
1 parent e5a609b commit e3cf369

11 files changed

+346
-26
lines changed

.bugster/.analysis_state.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"status": "completed",
3+
"started_at": "2025-07-11T15:00:51.174589",
4+
"version": "1.0",
5+
"completed": true,
6+
"completed_at": "2025-07-11T15:01:36.816131",
7+
"duration_seconds": 45.641555
8+
}

.bugster/next/analysis.json

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"metadata": {
3+
"timestamp": 1752256861.4664378,
4+
"version": 2,
5+
"git": {
6+
"branch": "main",
7+
"commit": "e5a609bae1dd6c284cad0c163cc5a9ecbe4dbe38"
8+
}
9+
},
10+
"data": {
11+
"framework": {
12+
"id": "next",
13+
"name": "Next.js",
14+
"dir_path": "/Users/giovaborgogno/repos/bugster/shirt-shop-example/"
15+
},
16+
"router_type": "app",
17+
"stats": {
18+
"fileCount": 34,
19+
"routeCount": 2,
20+
"apiRouteCount": 0,
21+
"layoutCount": 1
22+
},
23+
"layouts": [
24+
{
25+
"name": "function",
26+
"relative_file_path": "app/layout.tsx",
27+
"relative_dir_path": "app",
28+
"content": "import { VercelToolbar } from '@vercel/toolbar/next';\nimport { Analytics } from '@vercel/analytics/next';\nimport type { Metadata } from 'next';\nimport { Toaster } from 'sonner';\n\nimport './globals.css';\nimport { FreeDelivery } from '@/app/free-delivery';\nimport { Footer } from '@/components/footer';\nimport { Navigation } from '@/components/navigation';\n\nexport const metadata: Metadata = {\n title: 'Shirt Shop Example',\n description: 'A shirt shop example for Ecommerce',\n};\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n const showFreeDeliveryBanner = true;\n\n return (\n <html lang=\"en\">\n <body className=\"antialiased\">\n <div className=\"bg-white\">\n <FreeDelivery show={showFreeDeliveryBanner} />\n <Navigation />\n {children}\n <Footer />\n </div>\n <Toaster />\n <Analytics />\n <VercelToolbar />\n </body>\n </html>\n );\n}\n",
29+
"components": [
30+
"Analytics",
31+
"Footer",
32+
"Toaster",
33+
"FreeDelivery",
34+
"Navigation",
35+
"VercelToolbar"
36+
]
37+
}
38+
],
39+
"routes": [
40+
{
41+
"routePath": "/cart",
42+
"relativeFilePath": "app/cart/page.tsx",
43+
"layoutChain": [
44+
"function"
45+
],
46+
"components": [
47+
"OrderSummary",
48+
"ShoppingCart",
49+
"Main"
50+
],
51+
"hasParams": false,
52+
"hasForm": false,
53+
"hooks": [],
54+
"eventHandlers": [],
55+
"featureFlags": []
56+
},
57+
{
58+
"routePath": "/",
59+
"relativeFilePath": "app/page.tsx",
60+
"layoutChain": [
61+
"function"
62+
],
63+
"components": [
64+
"ProductHeader",
65+
"ProductDetails",
66+
"SizePicker",
67+
"Main",
68+
"ColorPicker",
69+
"AddToCart",
70+
"SummerSale",
71+
"ImageGallery",
72+
"ProductDetailPageProvider"
73+
],
74+
"hasParams": false,
75+
"hasForm": false,
76+
"hooks": [],
77+
"eventHandlers": [],
78+
"featureFlags": []
79+
}
80+
],
81+
"api_routes": [],
82+
"all_paths": [
83+
"app/add-to-cart.tsx",
84+
"app/cart/order-summary.tsx",
85+
"app/cart/page.tsx",
86+
"app/cart/proceed-to-checkout.tsx",
87+
"app/free-delivery.tsx",
88+
"app/layout.tsx",
89+
"app/page.tsx",
90+
"app/summer-sale.tsx",
91+
"components/banners/examples-banner.tsx",
92+
"components/banners/free-delivery-banner.tsx",
93+
"components/banners/summer-sale-banner.tsx",
94+
"components/dev-tools.tsx",
95+
"components/footer.tsx",
96+
"components/image-gallery.tsx",
97+
"components/main.tsx",
98+
"components/navigation.tsx",
99+
"components/product-detail-page/add-to-cart-button.tsx",
100+
"components/product-detail-page/color-picker.tsx",
101+
"components/product-detail-page/product-details.tsx",
102+
"components/product-detail-page/product-header.tsx",
103+
"components/product-detail-page/product-reviews.tsx",
104+
"components/product-detail-page/size-picker.tsx",
105+
"components/shopping-cart/order-summary-section.tsx",
106+
"components/shopping-cart/proceed-to-checkout-button.tsx",
107+
"components/shopping-cart/shopping-cart-item.tsx",
108+
"components/shopping-cart/shopping-cart-list.tsx",
109+
"components/shopping-cart/shopping-cart-remove-button.tsx",
110+
"components/shopping-cart/shopping-cart.tsx",
111+
"components/utils/cart-types.ts",
112+
"components/utils/images.ts",
113+
"components/utils/product-detail-page-context.tsx",
114+
"lib/actions.ts",
115+
"lib/get-cart-id.ts",
116+
"tailwind.config.ts"
117+
]
118+
}
119+
}

.bugster/project.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"metadata": {
3+
"timestamp": 1752256854938,
4+
"version": 2,
5+
"git": {
6+
"branch": "main",
7+
"commit": "e5a609bae1dd6c284cad0c163cc5a9ecbe4dbe38"
8+
}
9+
},
10+
"data": {
11+
"frameworks": [
12+
{
13+
"id": "next",
14+
"name": "Next.js",
15+
"dir_path": "/Users/giovaborgogno/repos/bugster/shirt-shop-example/"
16+
}
17+
]
18+
}
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Product browsing on homepage
2+
page: /
3+
page_path: app/page.tsx
4+
task: Verify users can view product details on the homepage
5+
steps:
6+
- Navigate to the homepage
7+
- Verify product images are visible in the gallery
8+
- Verify product name and price are displayed
9+
- Verify product description is visible
10+
expected_result: Product details including images, name, price, and description are
11+
displayed correctly
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Add product to cart
2+
page: /
3+
page_path: app/page.tsx
4+
task: Verify users can add a product to their cart
5+
steps:
6+
- Navigate to the homepage
7+
- Select a color option
8+
- Select a size option
9+
- Click the 'Add to cart' button
10+
- Verify success notification appears
11+
expected_result: Product is added to cart and success notification appears
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Navigation to cart page
2+
page: /
3+
page_path: app/page.tsx
4+
task: Verify users can navigate to cart page from the navigation menu
5+
steps:
6+
- Navigate to the homepage
7+
- Click on the cart icon in the navigation bar
8+
- Verify redirect to cart page
9+
- Verify the URL is /cart
10+
expected_result: User is redirected to the cart page
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: View cart contents
2+
page: /cart
3+
page_path: app/cart/page.tsx
4+
task: Verify users can view items in their shopping cart
5+
steps:
6+
- Add a product to cart from the homepage
7+
- Navigate to the cart page
8+
- Verify product appears in the cart list
9+
- Verify product details (name, color, size, price) are correct
10+
expected_result: Cart page displays all added items with correct details
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Remove item from cart
2+
page: /cart
3+
page_path: app/cart/page.tsx
4+
task: Verify users can remove items from their cart
5+
steps:
6+
- Add a product to cart from the homepage
7+
- Navigate to the cart page
8+
- Click the remove button on a cart item
9+
- Verify the item is removed from the cart
10+
- Verify cart total is updated
11+
expected_result: Item is removed from cart and cart is updated

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
# Bugster
39+
.bugster/results/
40+
.bugster/screenshots/
41+
.bugster/videos/
42+
.bugster/logs/
43+
.bugster/reports/
44+
*.bugster.log
45+

README.md

Lines changed: 120 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,150 @@
1-
# Shirt Shop Flags SDK Example
1+
# 🐛 Bugster - Automated Testing for Next.js
22

3-
This example uses the [Flags SDK](https://flags-sdk.dev) along with the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar) and `@vercel/analytics`.
3+
**Generate and run comprehensive tests for your Next.js applications with AI-powered automation.**
44

5-
## Demo
5+
This is a demo shirt shop built with Next.js to showcase how Bugster can automatically generate and run tests for your web applications. Follow this step-by-step guide to try it from scratch!
66

7-
[https://shirt-shop.labs.vercel.dev/](https://shirt-shop.labs.vercel.dev/)
7+
## 🚀 Phase 1: Try Bugster Locally
88

9-
## How it works
9+
### Step 1: Install Bugster CLI
1010

11-
This demo uses two feature flags defined in code control the visibility of two banners on the page.
12-
Both flags are configured to show/hide each banner 50% of the time.
11+
#### macOS/Linux
1312

14-
Once you visit the page, you can see a variation of both/one/none of the banners.
15-
Since this example is using a stable id to identify users, you will see the same variation all the time.
13+
```bash
14+
curl -sSL https://github.com/Bugsterapp/bugster-cli/releases/latest/download/install.sh | bash -s -- -y
15+
```
1616

17-
To test different variations, you can use the Dev Tools at the bottom to reset the stable id and reload the page.
18-
This allows you to test different variations of the banners.
17+
#### Verify Installation
1918

20-
This templates also tracks analytics events in Vercel Analytics.
19+
```bash
20+
bugster --version
21+
```
2122

22-
If you deployed your own instance of this example you can also use the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar) to test different variations by creating overrides.
23+
_If the command doesn't work, open a new terminal to load the new command._
2324

24-
## Deploy this template
25+
### Step 2: Clone and Run the Example
2526

26-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fflags%2Ftree%2Fmain%2Fexamples%2Fshirt-shop&env=FLAGS_SECRET&envDescription=The+FLAGS_SECRET+will+be+used+by+the+Flags+Explorer+to+securely+overwrite+feature+flags.+Must+be+32+random+bytes%2C+base64-encoded.+Use+the+generated+value+or+set+your+own.&envLink=https%3A%2F%2Fvercel.com%2Fdocs%2Fworkflow-collaboration%2Ffeature-flags%2Fsupporting-feature-flags%23flags_secret-environment-variable&project-name=shirt-shop-flags-sdk-example&repository-name=shirt-shop-flags-sdk-example)
27+
```bash
28+
git clone https://github.com/Bugsterapp/bugster-nextjs-example.git
29+
cd bugster-nextjs-example
30+
npm install --legacy-peer-deps
31+
npm run dev
32+
```
2733

28-
### Step 1: Link the project
34+
Your demo shirt shop should now be running at `http://localhost:3000`
2935

30-
In order to use the Flags Explorer, you need to link the project on your local machine.
36+
Open your editor:
3137

3238
```bash
33-
vercel link
39+
# With Cursor
40+
cursor .
41+
# or with VS Code
42+
code .
3443
```
3544

36-
Select the project from the list you just deployed.
45+
### Step 3: Try Bugster in Action
46+
47+
#### Initialize Bugster
48+
49+
```bash
50+
bugster init
51+
# or
52+
bugster init --project-name bugster-nextjs-example --url http://localhost:3000 --no-credentials
53+
```
3754

38-
### Step 2: Pull all environment variables
55+
#### Generate Tests
3956

40-
This allows the Flags SDK and the Flags Explorer to work correctly, by getting additional metadata.
57+
This repo already has some tests at `.bugster/tests` generated with the `bugster generate` command but you can generate more if you want:
4158

4259
```bash
43-
vercel env pull
60+
bugster generate
4461
```
4562

46-
### Step 3: Install dependencies
63+
_Bugster will analyze your Next.js app and automatically generate comprehensive tests_
64+
65+
#### Run Generated Tests
4766

4867
```bash
49-
npm install
68+
bugster run
5069
```
5170

52-
### Step 4: Run the project
71+
_Watch as Bugster runs the tests it generated for your application_
72+
73+
## 🚀 Phase 2: Deploy to Production with GitHub Integration
74+
75+
Ready to see Bugster in production? Let's deploy your own version and set up GitHub integration for automatic testing on every deployment.
76+
77+
### Step 1: Create Your Own Repository
78+
79+
After testing locally, create your own repository with this code:
80+
81+
**Create a new repository**
82+
83+
1. Create a new repository on GitHub
84+
2. From your local directory, update the remote:
5385

5486
```bash
55-
npm run dev
87+
git add .
88+
git commit -m "Add Bugster Integration"
89+
git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
90+
git push -u origin main
5691
```
92+
93+
### Step 2: Deploy to Vercel
94+
95+
1. Go to [Vercel Dashboard](https://vercel.com/dashboard)
96+
2. Click "New Project"
97+
3. Import **your repository** (the one you just created)
98+
4. Deploy with default settings
99+
100+
### Step 3: Set Up GitHub Integration
101+
102+
Connect Bugster with GitHub to automatically run tests on every Vercel Preview deployment.
103+
104+
#### Enable Vercel Protection Bypass
105+
106+
According to the best secure practices, Vercel protects your Vercel Previews, so this step is essential to allow Bugster access to your Previews
107+
108+
1. In [Vercel Dashboard](https://vercel.com/dashboard), go to your project
109+
2. Navigate to **Settings****Deployment Protection**
110+
3. Find "Protection Bypass for Automation" and click **"Add Secret"**
111+
4. Save (you can leave the value empty - it will be generated automatically)
112+
5. Copy the generated secret
113+
114+
#### Configure Bugster
115+
116+
Add the secret to `.bugster/config.yaml`:
117+
118+
```yaml
119+
"x-vercel-protection-bypass": "your-secret-here"
120+
```
121+
122+
Push these changes:
123+
124+
```bash
125+
git add .
126+
git commit -m "Add Protection Vercel Bypass Automation token to bugster config.yaml"
127+
git push
128+
```
129+
130+
#### Connect Repository
131+
132+
1. Visit [Bugster Dashboard](https://gui.bugster.dev/dashboard)
133+
2. Connect your GitHub repository
134+
3. Test the integration by creating a PR
135+
136+
Create a Pull Request and watch Bugster automatically test your Vercel Preview! 🎉
137+
138+
## 🤝 Contributing
139+
140+
Found a bug or want to improve the demo? PRs welcome!
141+
142+
## 📚 Learn More
143+
144+
- [Bugster Documentation](https://docs.bugster.dev)
145+
- [Next.js Documentation](https://nextjs.org/docs)
146+
- [Vercel Platform](https://vercel.com/new)
147+
148+
---
149+
150+
**Made with ❤️ by the Bugster team**

0 commit comments

Comments
 (0)