-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.html
More file actions
944 lines (820 loc) · 35.1 KB
/
testing.html
File metadata and controls
944 lines (820 loc) · 35.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Smash QA Framework - Testing Strategy</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎭</text></svg>">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: #2b2b2b;
background: #f5f3ed;
min-height: 100vh;
}
/* Smashburger brand colors */
:root {
--smash-orange: #e94e1b;
--smash-dark-orange: #d13d0d;
--smash-burgundy: #8b1e3f;
--smash-cream: #f5f3ed;
--smash-black: #2b2b2b;
--smash-tan: #d4c5a9;
}
.header {
background: var(--smash-orange);
color: white;
padding: 40px 20px;
box-shadow: 0 4px 12px rgba(233, 78, 27, 0.3);
}
.header-content {
max-width: 1200px;
margin: 0 auto;
}
.logo-area {
display: flex;
align-items: center;
gap: 20px;
margin-bottom: 20px;
}
.logo-circle {
width: 80px;
height: 80px;
background: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 48px;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
h1 {
font-size: 3em;
font-weight: 900;
text-transform: uppercase;
letter-spacing: -1px;
margin: 0;
}
.tagline {
font-size: 1.2em;
opacity: 0.95;
font-weight: 300;
margin-top: 10px;
}
.nav {
display: flex;
gap: 15px;
margin-top: 25px;
flex-wrap: wrap;
}
.nav a {
color: white;
text-decoration: none;
padding: 12px 24px;
background: var(--smash-burgundy);
border-radius: 30px;
font-weight: 600;
transition: all 0.3s ease;
text-transform: uppercase;
font-size: 0.9em;
letter-spacing: 0.5px;
}
.nav a:hover {
background: var(--smash-black);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.container {
max-width: 1200px;
margin: 40px auto;
background: white;
border-radius: 0;
box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.content {
padding: 60px 50px;
}
.intro-section {
background: linear-gradient(135deg, var(--smash-orange) 0%, var(--smash-burgundy) 100%);
color: white;
padding: 40px;
border-radius: 8px;
margin-bottom: 40px;
box-shadow: 0 6px 20px rgba(233, 78, 27, 0.3);
}
.intro-section h2 {
color: white;
border-bottom: 3px solid white;
padding-bottom: 15px;
margin-bottom: 25px;
font-size: 2em;
}
.intro-section p {
font-size: 1.1em;
line-height: 1.8;
margin-bottom: 20px;
opacity: 0.95;
}
.intro-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin-top: 30px;
}
.intro-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
padding: 25px;
border-radius: 8px;
border: 2px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
}
.intro-card:hover {
background: rgba(255, 255, 255, 0.15);
transform: translateY(-4px);
}
.intro-card h3 {
color: white;
margin: 0 0 15px 0;
font-size: 1.3em;
text-transform: uppercase;
}
.intro-card ul {
list-style: none;
margin: 0;
padding: 0;
}
.intro-card li {
padding: 8px 0;
font-size: 1.05em;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.intro-card li:last-child {
border-bottom: none;
}
.intro-card li::before {
content: "✓";
margin-right: 10px;
font-weight: bold;
color: white;
}
h2 {
color: var(--smash-orange);
margin-top: 50px;
margin-bottom: 25px;
padding-bottom: 15px;
border-bottom: 4px solid var(--smash-orange);
font-size: 2.2em;
font-weight: 900;
text-transform: uppercase;
letter-spacing: -0.5px;
}
h2:first-of-type {
margin-top: 0;
}
h3 {
color: var(--smash-burgundy);
margin-top: 35px;
margin-bottom: 20px;
font-size: 1.5em;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
}
p {
margin-bottom: 20px;
font-size: 1.05em;
line-height: 1.8;
}
ul, ol {
margin: 20px 0 20px 35px;
}
li {
margin: 12px 0;
font-size: 1.05em;
line-height: 1.7;
}
li strong {
color: var(--smash-orange);
font-weight: 700;
}
code {
background: var(--smash-cream);
padding: 4px 10px;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 0.9em;
color: var(--smash-burgundy);
border: 1px solid var(--smash-tan);
}
pre {
background: var(--smash-black);
color: var(--smash-cream);
padding: 25px;
border-radius: 8px;
overflow-x: auto;
margin: 25px 0;
border-left: 6px solid var(--smash-orange);
font-size: 0.95em;
line-height: 1.5;
}
pre code {
background: none;
color: inherit;
padding: 0;
border: none;
}
.section {
background: var(--smash-cream);
padding: 30px;
border-radius: 8px;
margin: 30px 0;
border-left: 6px solid var(--smash-orange);
}
.highlight {
background: #fff8e1;
padding: 25px;
border-radius: 8px;
border-left: 6px solid var(--smash-burgundy);
margin: 25px 0;
font-size: 1.05em;
}
.highlight strong {
color: var(--smash-burgundy);
font-weight: 700;
}
.tech-stack-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin: 30px 0;
}
.tech-card {
background: white;
padding: 20px;
border-radius: 8px;
border: 2px solid var(--smash-tan);
transition: all 0.3s ease;
}
.tech-card:hover {
border-color: var(--smash-orange);
transform: translateY(-4px);
box-shadow: 0 6px 16px rgba(233, 78, 27, 0.2);
}
.tech-card h4 {
color: var(--smash-orange);
margin-bottom: 15px;
font-weight: 700;
text-transform: uppercase;
font-size: 1.1em;
}
.footer {
background: var(--smash-black);
color: white;
padding: 30px;
text-align: center;
font-size: 0.95em;
}
.footer a {
color: var(--smash-orange);
text-decoration: none;
font-weight: 600;
}
.footer a:hover {
text-decoration: underline;
}
@media (max-width: 768px) {
h1 {
font-size: 2em;
}
.content {
padding: 30px 20px;
}
.logo-area {
flex-direction: column;
text-align: center;
}
.nav {
justify-content: center;
}
.intro-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="header">
<div class="header-content">
<div class="logo-area">
<div class="logo-circle">🎭</div>
<div>
<h1>Smash-QA-Framework</h1>
<p class="tagline">End-to-End Testing Strategy & Documentation</p>
</div>
</div>
<div class="nav">
<a href="index.html">📊 Test Report</a>
<a href="https://github.com/Anasss/smash-qa-framework/">📦 Repository</a>
</div>
</div>
</div>
<div class="container">
<div class="content">
<div class="intro-section">
<h2>🎯 Overview</h2>
<p>
The <strong>Smash-QA-Framework</strong> is a comprehensive end-to-end test automation solution built with Playwright and TypeScript for testing Smashburger's online ordering platform at <a href="https://dev.smashburger.com/" target="_blank" style="color: white; text-decoration: underline; font-weight: 600;">dev.smashburger.com</a>. This framework validates the complete customer journey from menu browsing to order confirmation, ensuring a flawless digital ordering experience.
</p>
<div class="intro-grid">
<div class="intro-card">
<h3>🍔 What We Test</h3>
<ul>
<li>Complete ordering workflow</li>
<li>Custom burger creation</li>
<li>Location selection (Pickup)</li>
<li>Cart management</li>
<li>Checkout & payment flow</li>
<li>Order confirmation</li>
</ul>
</div>
<div class="intro-card">
<h3>🛠️ How We Test</h3>
<ul>
<li>Page Object Model (POM)</li>
<li>Data-driven scenarios</li>
<li>Fixtures for reusability</li>
<li>Parallel execution</li>
<li>CI/CD integration</li>
<li>Automated reporting</li>
</ul>
</div>
<div class="intro-card">
<h3>⚡ Key Features</h3>
<ul>
<li>TypeScript for type safety</li>
<li>Semantic locators</li>
<li>Fast execution (30s/test)</li>
<li>Screenshot on failure</li>
<li>GitHub Pages reports</li>
<li>Mock data support</li>
</ul>
</div>
</div>
</div>
<h2>📋 Tech Stack Analysis</h2>
<p>Based on DOM and network inspection, the Smashburger website (<code>https://dev.smashburger.com</code>) is built with modern, scalable technologies:</p>
<div class="tech-stack-grid">
<div class="tech-card">
<h4>⚛️ Core Frameworks</h4>
<ul style="margin-left: 20px;">
<li><strong>Next.js (React)</strong></li>
<li><strong>React</strong></li>
<li><strong>Tailwind CSS</strong></li>
</ul>
</div>
<div class="tech-card">
<h4>📊 Data Management</h4>
<ul style="margin-left: 20px;">
<li><strong>React Query</strong></li>
<li>Via <code>dehydratedState</code></li>
</ul>
</div>
<div class="tech-card">
<h4>🔌 Third-Party</h4>
<ul style="margin-left: 20px;">
<li>Google Tag Manager</li>
<li>Google Maps API</li>
<li>Google reCAPTCHA</li>
<li>Braze (engagement)</li>
<li>TrustArc (consent)</li>
</ul>
</div>
<div class="tech-card">
<h4>☁️ Infrastructure</h4>
<ul style="margin-left: 20px;">
<li>Cloudflare CDN</li>
<li>AWS S3 (assets)</li>
<li>Google Fonts</li>
</ul>
</div>
</div>
<div class="highlight">
<strong>💡 Implication:</strong> This stack implies modern, scalable, and component-driven front-end architecture optimized for performance and user experience.
</div>
<h2>🔌 Observed APIs</h2>
<h3>Location & Menu</h3>
<pre><code>GET /api/location/search?query=80246
GET /api/location/menu
GET /api/location</code></pre>
<ul>
<li><strong>Search restaurants</strong> by ZIP code</li>
<li><strong>Fetch menu</strong> by location</li>
<li><strong>Retrieve location</strong> details</li>
</ul>
<h3>Basket & Ordering</h3>
<pre><code>POST /api/basket
GET /api/basket
POST /api/basket/products
GET /api/basket/delivery-mode
POST /api/basket/validate
GET /api/basket/freedompay-iframe?billingMethod=creditcard</code></pre>
<ul>
<li><strong>Create basket</strong> (requires <code>VendorId</code>)</li>
<li><strong>Add products</strong> with customization options</li>
<li><strong>Delivery/pickup</strong> mode selection</li>
<li><strong>Basket validation</strong> before checkout</li>
<li><strong>Payment iframe</strong> integration</li>
</ul>
<h3>Page Data (Next.js)</h3>
<pre><code>GET /_next/data/.../menu/smashburgers/create-your-own.json
GET /_next/data/.../cart.json
GET /_next/data/.../cart/checkout.json</code></pre>
<div class="highlight">
<strong>💡 Key Insight:</strong> UI tests heavily rely on backend APIs. Failures may originate in backend rather than UI. Hybrid API+UI tests or API health monitoring could reduce flakiness and improve reliability.
</div>
<h2>💡 Recommendations: Shift Left Testing Strategy</h2>
<div class="section">
<p style="font-size: 1.1em; margin-bottom: 25px;">
Based on the observed API dependencies, we recommend implementing a comprehensive <strong>Shift Left testing approach</strong> to catch defects earlier in the development cycle, reduce costs, and improve overall quality.
</p>
<div style="background: white; padding: 25px; border-radius: 8px; border-left: 6px solid var(--smash-burgundy); margin-bottom: 25px;">
<h3 style="margin-top: 0; color: var(--smash-burgundy);">🔄 The Testing Pyramid</h3>
<p style="margin-bottom: 20px;">Move from heavy reliance on E2E tests to a balanced pyramid approach:</p>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin: 25px 0;">
<div style="background: var(--smash-cream); padding: 20px; border-radius: 8px; border-top: 4px solid var(--smash-orange);">
<h4 style="color: var(--smash-orange); margin-bottom: 10px; font-size: 1.1em;">🧱 Unit Tests</h4>
<p style="font-size: 0.95em; margin-bottom: 10px;"><strong>Coverage: 70-80%</strong></p>
<ul style="margin-left: 20px; font-size: 0.95em;">
<li>Fast execution (milliseconds)</li>
<li>Test individual functions/components</li>
<li>Low maintenance cost</li>
<li>High confidence in code quality</li>
</ul>
</div>
<div style="background: var(--smash-cream); padding: 20px; border-radius: 8px; border-top: 4px solid var(--smash-orange);">
<h4 style="color: var(--smash-orange); margin-bottom: 10px; font-size: 1.1em;">🔗 Integration Tests</h4>
<p style="font-size: 0.95em; margin-bottom: 10px;"><strong>Coverage: 15-20%</strong></p>
<ul style="margin-left: 20px; font-size: 0.95em;">
<li>Medium execution time (seconds)</li>
<li>Test API endpoints & database</li>
<li>Validate data flow</li>
<li>Catch integration issues early</li>
</ul>
</div>
<div style="background: var(--smash-cream); padding: 20px; border-radius: 8px; border-top: 4px solid var(--smash-orange);">
<h4 style="color: var(--smash-orange); margin-bottom: 10px; font-size: 1.1em;">📋 Contract Tests</h4>
<p style="font-size: 0.95em; margin-bottom: 10px;"><strong>Coverage: 5%</strong></p>
<ul style="margin-left: 20px; font-size: 0.95em;">
<li>Fast execution (seconds)</li>
<li>Verify API contracts</li>
<li>Provider/Consumer validation</li>
<li>Prevent breaking changes</li>
</ul>
</div>
<div style="background: var(--smash-cream); padding: 20px; border-radius: 8px; border-top: 4px solid var(--smash-orange);">
<h4 style="color: var(--smash-orange); margin-bottom: 10px; font-size: 1.1em;">🎭 E2E Tests</h4>
<p style="font-size: 0.95em; margin-bottom: 10px;"><strong>Coverage: 5-10%</strong></p>
<ul style="margin-left: 20px; font-size: 0.95em;">
<li>Slow execution (30s per test)</li>
<li>Critical user journeys only</li>
<li>High maintenance cost</li>
<li>Focus on business value</li>
</ul>
</div>
</div>
</div>
<h3>🎯 Recommended Implementation Strategy</h3>
<div style="background: white; padding: 25px; border-radius: 8px; margin: 20px 0;">
<h4 style="color: var(--smash-burgundy); margin-bottom: 15px;">1. Unit Tests (Backend & Frontend)</h4>
<p><strong>Backend API Unit Tests:</strong></p>
<pre style="margin-top: 10px;"><code>// Example: Test basket creation logic
describe('Basket Service', () => {
it('should create basket with valid VendorId', () => {
const basket = basketService.create({ vendorId: '12345' });
expect(basket.vendorId).toBe('12345');
expect(basket.items).toEqual([]);
});
it('should throw error for invalid VendorId', () => {
expect(() => basketService.create({ vendorId: null }))
.toThrow('VendorId is required');
});
});</code></pre>
<p style="margin-top: 20px;"><strong>Frontend Component Unit Tests:</strong></p>
<pre style="margin-top: 10px;"><code>// Example: Test CartItem component
describe('CartItem Component', () => {
it('should display item name and price', () => {
const item = { name: 'Classic Smash', price: 8.99 };
render(<CartItem item={item} />);
expect(screen.getByText('Classic Smash')).toBeInTheDocument();
expect(screen.getByText('$8.99')).toBeInTheDocument();
});
it('should display fallback image when image URL missing', () => {
const item = { name: 'Custom Burger', image: null };
render(<CartItem item={item} />);
const img = screen.getByRole('img');
expect(img).toHaveAttribute('src', '/fallback-burger.png');
});
});</code></pre>
</div>
<div style="background: white; padding: 25px; border-radius: 8px; margin: 20px 0;">
<h4 style="color: var(--smash-burgundy); margin-bottom: 15px;">2. Integration Tests (API Layer)</h4>
<p>Test API endpoints with real database interactions:</p>
<pre style="margin-top: 10px;"><code>// Example: Test basket API endpoints
describe('POST /api/basket', () => {
it('should create basket and return basketId', async () => {
const response = await request(app)
.post('/api/basket')
.send({ vendorId: '12345' })
.expect(201);
expect(response.body).toHaveProperty('basketId');
expect(response.body.vendorId).toBe('12345');
});
});
describe('POST /api/basket/products', () => {
it('should add product to existing basket', async () => {
const basketId = await createTestBasket();
const response = await request(app)
.post('/api/basket/products')
.send({
basketId,
productId: 'burger-001',
quantity: 1,
options: { bun: 'classic', patty: 'double' }
})
.expect(200);
expect(response.body.items).toHaveLength(1);
expect(response.body.items[0].productId).toBe('burger-001');
});
});</code></pre>
<p style="margin-top: 20px;"><strong>Key Integration Test Areas:</strong></p>
<ul style="margin-left: 20px;">
<li>✅ <code>/api/location/*</code> - Location search and menu retrieval</li>
<li>✅ <code>/api/basket/*</code> - Basket creation, product addition, validation</li>
<li>✅ <code>/api/basket/delivery-mode</code> - Pickup/delivery options</li>
<li>✅ Database transactions - Ensure data consistency</li>
<li>✅ External API integrations - Google Maps, payment gateway</li>
</ul>
</div>
<div style="background: white; padding: 25px; border-radius: 8px; margin: 20px 0;">
<h4 style="color: var(--smash-burgundy); margin-bottom: 15px;">3. Contract Tests (API Contracts)</h4>
<p>Use tools like Pact or Spring Cloud Contract to ensure API contracts are honored:</p>
<pre style="margin-top: 10px;"><code>// Example: Consumer-driven contract test
describe('Basket API Contract', () => {
const provider = new Pact({
consumer: 'SmashburgerUI',
provider: 'BasketService'
});
it('should return basket with items', async () => {
await provider.addInteraction({
state: 'basket exists with items',
uponReceiving: 'a request for basket',
withRequest: {
method: 'GET',
path: '/api/basket',
query: { basketId: '12345' }
},
willRespondWith: {
status: 200,
body: {
basketId: '12345',
items: Matchers.eachLike({
productId: Matchers.string('burger-001'),
name: Matchers.string('Classic Smash'),
price: Matchers.decimal(8.99),
quantity: Matchers.integer(1)
})
}
}
});
// Consumer test validates the contract
const basket = await basketClient.getBasket('12345');
expect(basket.items).toBeDefined();
});
});</code></pre>
<p style="margin-top: 20px;"><strong>Benefits of Contract Testing:</strong></p>
<ul style="margin-left: 20px;">
<li>✅ Prevent breaking changes to API contracts</li>
<li>✅ Enable independent deployment of services</li>
<li>✅ Fast feedback (runs in seconds)</li>
<li>✅ Clear communication between frontend and backend teams</li>
</ul>
</div>
<div style="background: white; padding: 25px; border-radius: 8px; margin: 20px 0;">
<h4 style="color: var(--smash-burgundy); margin-bottom: 15px;">4. E2E Tests (Critical User Journeys)</h4>
<p><strong>Focus only on the most important business-critical scenarios:</strong></p>
<ul style="margin-left: 20px; margin-bottom: 20px;">
<li>✅ Complete burger ordering flow (Create Your Own)</li>
<li>✅ Pickup order placement and confirmation</li>
<li>✅ Cart modifications and checkout</li>
<li>❌ <em>Avoid:</em> Testing every burger variant (covered by lower layers)</li>
<li>❌ <em>Avoid:</em> Testing API response formats (covered by contract tests)</li>
<li>❌ <em>Avoid:</em> Testing individual component rendering (covered by unit tests)</li>
</ul>
<p><strong>E2E Test Optimization:</strong></p>
<ul style="margin-left: 20px;">
<li>Keep tests under 30 seconds per scenario</li>
<li>Use API calls for test setup (faster than UI interactions)</li>
<li>Mock external dependencies when possible</li>
<li>Run E2E tests only for smoke testing in CI/CD</li>
</ul>
</div>
<h3 style="margin-top: 40px;">📊 Expected Benefits</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 25px;">
<div style="background: #e8f5e9; padding: 20px; border-radius: 8px; border-left: 4px solid #4caf50;">
<h4 style="color: #2e7d32; margin-bottom: 10px;">⚡ Faster Feedback</h4>
<p style="font-size: 0.95em; margin: 0;">Catch defects in seconds (unit tests) instead of minutes (E2E tests)</p>
</div>
<div style="background: #e3f2fd; padding: 20px; border-radius: 8px; border-left: 4px solid #2196f3;">
<h4 style="color: #1565c0; margin-bottom: 10px;">💰 Lower Costs</h4>
<p style="font-size: 0.95em; margin: 0;">Defects found early are 10-100x cheaper to fix than in production</p>
</div>
<div style="background: #f3e5f5; padding: 20px; border-radius: 8px; border-left: 4px solid #9c27b0;">
<h4 style="color: #6a1b9a; margin-bottom: 10px;">🔧 Easier Maintenance</h4>
<p style="font-size: 0.95em; margin: 0;">Unit/integration tests are more stable and easier to debug than E2E</p>
</div>
<div style="background: #fff3e0; padding: 20px; border-radius: 8px; border-left: 4px solid #ff9800;">
<h4 style="color: #e65100; margin-bottom: 10px;">📈 Higher Coverage</h4>
<p style="font-size: 0.95em; margin: 0;">Test more scenarios without exponentially increasing execution time</p>
</div>
</div>
</div>
<div class="highlight" style="margin-top: 30px;">
<strong>🎯 Shift Left Recommendation:</strong> Implement unit tests and integration tests for the observed APIs (<code>/api/basket/*</code>, <code>/api/location/*</code>) before expanding E2E coverage. This will provide faster feedback, reduce flakiness, and lower maintenance costs while ensuring comprehensive quality coverage across all layers.
</div>
<h2>🧪 Testing Strategy</h2>
<div class="section">
<h3>Core Testing Principles</h3>
<ul>
<li><strong>Scope:</strong> Focus on UI automation with Playwright + TypeScript, minimal framework overhead</li>
<li><strong>Primary Flow:</strong> E2E burger ordering — pickup order via <a href="https://dev.smashburger.com/menu/smashburgers/create-your-own" target="_blank" style="color: var(--smash-orange); font-weight: 600;">"Create Your Own Burger"</a> page</li>
<li><strong>Data Setup:</strong> Use ZIP code <code>80246</code>, select the first available restaurant</li>
<li><strong>Validation Points:</strong> Ensure order details are consistent across Cart, Checkout, and Order Details pages</li>
<li><strong>Design Pattern:</strong> Page Object Model (POM), modular code, fixtures for setup, utilities for reusability</li>
<li><strong>Resilience:</strong> Prefer <code>data-testid</code>/ID locators, handle dynamic elements properly with proper waits</li>
<li><strong>Quality:</strong> Parallel execution (3 workers), headless runs, screenshot capture on failures</li>
</ul>
</div>
<h2>📋 Test Coverage</h2>
<div class="section">
<h3>1. Ordering a Burger (E2E Scenario)</h3>
<p><strong>Test Case:</strong> Place a pickup order with "Create Your Own" burger</p>
<p><strong>Implementation:</strong> <code>tests/pickup-create-your-own-order.spec.ts</code></p>
<ul>
<li><strong>Test URL:</strong> <a href="https://dev.smashburger.com/menu/smashburgers/create-your-own" target="_blank" style="color: var(--smash-orange);">Create Your Own Burger Page</a></li>
<li><strong>Flow:</strong>
<ol style="margin-left: 20px; margin-top: 10px;">
<li>Navigate to Create Your Own page (<code>product.gotoCreateYourOwn()</code>)</li>
<li>Select pickup location by ZIP code 80246 (<code>bootstrapPickupAtZip()</code>)</li>
<li>Configure burger with custom options (<code>create.createBurger(burger)</code>)</li>
<li>Add to cart and proceed to checkout</li>
<li>Verify cart displays correct burger details</li>
<li>Fill customer information (name, email, phone)</li>
<li>Fill payment information (credit card via iframe)</li>
<li>Place order and verify confirmation page</li>
</ol>
</li>
<li><strong>Validations:</strong>
<ul style="margin-left: 20px; margin-top: 10px;">
<li>✅ Cart page: Verify size, bun, cheese, toppings, sauces, add-ons</li>
<li>✅ Checkout page: Verify order summary matches selections</li>
<li>✅ Confirmation page: Verify "Thank You", order number, pickup details</li>
<li>✅ End-to-end consistency across all pages</li>
</ul>
</li>
</ul>
<h3>2. Data-Driven Testing Scenarios</h3>
<p><strong>Implementation:</strong> <code>tests/pickup-orders-dataset.spec.ts</code></p>
<p><strong>Data Source:</strong> <code>test-data/burger-combinations.json</code></p>
<ul>
<li><strong>Test Approach:</strong> Parameterized tests using JSON data sets</li>
<li><strong>Burger Customization Variants Covered:</strong>
<ul style="margin-left: 20px; margin-top: 10px;">
<li><strong>Protein options:</strong> Double Beef, Single Beef, Crispy Chicken, Double Chicken, Turkey, Black Bean</li>
<li><strong>Bun types:</strong> Classic, Spicy Chipotle</li>
<li><strong>Cheese varieties:</strong> American, Aged Swiss, Pepper Jack, Aged Cheddar</li>
<li><strong>Toppings:</strong> Lettuce, Tomatoes, Red Onion, Pickles, Jalapeños, Grilled options</li>
<li><strong>Sauces:</strong> Smash Sauce®, Mayo, Ranch, BBQ, Chipotle Ranch, Truffle Mayo</li>
<li><strong>Premium Add-ons:</strong> Applewood Smoked Bacon, Smashed Avocado</li>
</ul>
</li>
<li><strong>Test Execution:</strong>
<ul style="margin-left: 20px; margin-top: 10px;">
<li>6 different burger scenarios from data file</li>
<li>Each scenario tests complete E2E flow</li>
<li>Parallel execution for faster feedback</li>
<li>Single customer profile (default) with ZIP 80246</li>
</ul>
</li>
</ul>
<h3>3. Cart Page Item's Image Validation</h3>
<p><strong>Implementation:</strong> <code>tests/cart-placeholder-images.spec.ts</code></p>
<p><strong>Objective:</strong> Validate image handling for cart items with placeholder/missing images</p>
<div style="background: white; padding: 20px; border-radius: 8px; border: 2px solid var(--smash-orange); margin-top: 15px;">
<h4 style="color: var(--smash-burgundy); margin-bottom: 15px; font-size: 1.1em;">Test Scenario</h4>
<ul style="margin-left: 20px;">
<li><strong>Setup:</strong> Add 3 items to cart from <code>test-data/mock-cart-items.json</code></li>
<li><strong>Items tested:</strong>
<ul style="margin-left: 20px; margin-top: 10px;">
<li>Double Smoked Brisket Bacon Smash® (qty: 1)</li>
<li>Chili Cheese Dog (qty: 2)</li>
<li>Large French Fries (qty: 3)</li>
</ul>
</li>
<li><strong>Action:</strong> Navigate to Cart Page</li>
<li><strong>Mock Implementation:</strong> Use Playwright route interception to replace placeholder images with actual burger image</li>
</ul>
<h4 style="color: var(--smash-burgundy); margin: 20px 0 15px 0; font-size: 1.1em;">Implementation Details</h4>
<pre style="margin-top: 10px;"><code>// Route interception for placeholder images
await page.route('**/placeholder.e96474ea.jpg', async (route) => {
// Fetch the actual fallback image
const response = await page.request.get(PLACEHOLDER_IMAGE_URL);
const body = await response.body();
// Fulfill request with real image
await route.fulfill({
status: 200,
contentType: 'image/png',
body
});
});
// Verify all cart images are visible
const cartImages = page.getByRole('img', { name: /cart item/i });
const count = await cartImages.count();
for (let i = 0; i < count; i++) {
await expect(cartImages.nth(i)).toBeVisible();
}</code></pre>
<h4 style="color: var(--smash-burgundy); margin: 20px 0 15px 0; font-size: 1.1em;">Validation Points</h4>
<ul style="margin-left: 20px;">
<li>✅ All cart items display images after route interception</li>
<li>✅ Placeholder image URL (<code>placeholder.e96474ea.jpg</code>) is intercepted</li>
<li>✅ Replacement image loaded successfully from S3</li>
<li>✅ Images are visible in DOM (<code>toBeVisible()</code>)</li>
<li>✅ Cart layout remains consistent with images</li>
</ul>
</div>
</div>
<h2>🎯 Test Execution</h2>
<div class="tech-stack-grid">
<div class="tech-card">
<h4>⚡ Parallel Execution</h4>
<p>Tests run with <strong>3 workers</strong> for faster execution and efficient resource utilization</p>
</div>
<div class="tech-card">
<h4>🔄 Continuous Integration</h4>
<p>Automated runs on <strong>push/PR to main</strong> branch via GitHub Actions</p>
</div>
<div class="tech-card">
<h4>📊 Reporting</h4>
<p><strong>HTML reports</strong> deployed to GitHub Pages automatically with full test artifacts</p>
</div>
<div class="tech-card">
<h4>🔍 Quality Gates</h4>
<p>Screenshot on failure, continue-on-error for visibility, detailed test summaries</p>
</div>
</div>
<h2>🔒 Test Data Strategy</h2>
<div class="section">
<h3>Environment Configuration</h3>
<ul>
<li><strong>Base URL:</strong> <code>https://dev.smashburger.com</code></li>
<li><strong>Test ZIP Code:</strong> <code>80246</code> (Denver, CO area)</li>
<li><strong>Restaurant Selection:</strong> First available location</li>
<li><strong>Payment Method:</strong> Test credit card data https://neapay.com/online-tools/credit-card-number-generator-validator.html</li>
</ul>
<h3>Test User Management</h3>
<p>Guest checkout flow primarily tested to avoid account dependencies and simplify test maintenance.</p>
</div>
<h2>📈 Success Metrics</h2>
<div class="section">
<h3>Performance Targets</h3>
<ul>
<li><strong>E2E Scenario Execution Time:</strong> Under <strong>30 seconds</strong> per test scenario</li>
<li><strong>Full Suite Execution:</strong> Complete within CI/CD pipeline timeout (60 minutes max)</li>
<li><strong>Test Reliability:</strong> 95%+ pass rate on consecutive runs</li>
<li><strong>Defect Detection:</strong> UI regressions caught before production deployment</li>
</ul>
<h3>Coverage Goals</h3>
<ul>
<li>✅ Critical user journey: Create Your Own burger order (E2E)</li>
<li>✅ Data-driven scenarios for typical food ordering flows</li>
<li>✅ Cross-browser compatibility (Chromium, Firefox, WebKit)</li>
<li>✅ Mobile viewport testing for responsive design</li>
</ul>
</div>
<div class="highlight">
<strong>🎯 Primary Goal:</strong> Ensure every Smashburger customer gets a flawless digital ordering experience from menu browsing to order confirmation, with each E2E scenario completing in under 30 seconds for rapid feedback.
</div>
</div>
</div>
<div class="footer">
<p><strong>Smashburger QA Automation</strong> | Built with Playwright & TypeScript</p>
<p>Questions? Check the <a href="index.html">Test Report</a> or view the <a href="https://github.com/Anasss/smash-qa-framework/">Repository</a></p>
</div>
</body>
</html>