Skip to content

Commit 0862cfa

Browse files
committed
test(cypress): add pauses to escrow steps for better visibility
- Added cy.pause() after each escrow step in demo1-complete-flow.cy.ts - Includes pauses after: Initialize Escrow, Fund Escrow, Complete Milestone, Approve Milestone, and Release Funds - Added descriptive log messages for each pause - Allows manual control during automated testing to observe each step
1 parent ee7410b commit 0862cfa

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
describe('Demo 1 - Complete Flow', () => {
2+
const TEST_WALLET_ADDRESS = 'GABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
3+
4+
beforeEach(() => {
5+
cy.visit('/demos');
6+
cy.get('h1', { timeout: 10000 }).should('be.visible');
7+
cy.clearLocalStorage();
8+
});
9+
10+
it('should complete Demo 1 full flow: wallet connection → demo launch → escrow steps → confetti → complete', () => {
11+
// Step 1: Navigate to /demos (already done in beforeEach)
12+
cy.url().should('include', '/demos');
13+
cy.log('✅ Navigated to /demos page');
14+
15+
// Step 2: Open wallet sidebar
16+
cy.get('body').then(($body) => {
17+
let walletButton = null;
18+
19+
// Find wallet button using multiple strategies
20+
if ($body.find('button[title="Open Wallet"]').length > 0) {
21+
walletButton = $body.find('button[title="Open Wallet"]').first();
22+
} else if ($body.find('button').filter(':contains("🔐")').length > 0) {
23+
walletButton = $body.find('button').filter(':contains("🔐")').first();
24+
} else if ($body.find('button').filter(':contains("Wallet")').length > 0) {
25+
walletButton = $body.find('button').filter(':contains("Wallet")').first();
26+
}
27+
28+
if (walletButton && walletButton.length > 0) {
29+
cy.wrap(walletButton).click({ force: true });
30+
cy.wait(2000);
31+
cy.log('✅ Opened wallet sidebar');
32+
}
33+
});
34+
35+
// Step 3: Connect Stellar wallet
36+
cy.get('body').then(($body) => {
37+
if ($body.find('input[placeholder*="Stellar"]').length > 0) {
38+
cy.get('input[placeholder*="Stellar"]').type(TEST_WALLET_ADDRESS, { force: true });
39+
cy.get('button').contains('Connect').click({ force: true });
40+
cy.wait(2000);
41+
cy.log('✅ Connected Stellar wallet');
42+
43+
// Verify connection
44+
cy.get('body').then(($body) => {
45+
if ($body.find('div').filter(':contains("Connected")').length > 0) {
46+
cy.log('✅ Wallet connection verified');
47+
} else {
48+
cy.log('ℹ️ Wallet connection status not visible');
49+
}
50+
});
51+
} else {
52+
cy.log('ℹ️ Wallet input not found - may already be connected or sidebar not opened');
53+
}
54+
});
55+
56+
// Step 4: Launch Demo 1 from demo cards
57+
cy.get('.demo-card').first().within(() => {
58+
cy.get('h3').should('contain', 'Baby Steps to Riches');
59+
cy.get('button').contains('LAUNCH DEMO').click({ force: true });
60+
});
61+
cy.wait(3000);
62+
cy.log('✅ Launched Demo 1');
63+
64+
// Step 5: Start demo in immersive modal
65+
cy.get('body').then(($body) => {
66+
if ($body.find('button').filter(':contains("Start Demo")').length > 0) {
67+
cy.get('button').contains('Start Demo').click();
68+
cy.wait(2000);
69+
cy.log('✅ Started demo in immersive modal');
70+
}
71+
});
72+
73+
// Step 6: Verify demo content is visible
74+
cy.get('body').then(($body) => {
75+
if ($body.find('h2').filter(':contains("Hello Milestone Demo")').length > 0) {
76+
cy.get('h2').contains('🚀 Hello Milestone Demo').should('be.visible');
77+
cy.log('✅ Demo content loaded');
78+
} else {
79+
cy.log('ℹ️ Demo content not found - checking for alternative content');
80+
}
81+
});
82+
83+
// Step 7: Execute all escrow steps with pauses for better visibility
84+
cy.get('body').then(($body) => {
85+
if ($body.find('button.initialize-escrow-button').length > 0) {
86+
// Step 7a: Initialize Escrow
87+
cy.get('button.initialize-escrow-button').click();
88+
cy.wait(3000);
89+
cy.log('✅ Step 1: Initialize Escrow completed');
90+
cy.pause(); // Pause to observe Initialize Escrow step
91+
cy.log('⏸️ Paused after Initialize Escrow - Press space to continue');
92+
93+
// Step 7b: Fund Escrow
94+
cy.get('button.fund-escrow-button').click();
95+
cy.wait(3000);
96+
cy.log('✅ Step 2: Fund Escrow completed');
97+
cy.pause(); // Pause to observe Fund Escrow step
98+
cy.log('⏸️ Paused after Fund Escrow - Press space to continue');
99+
100+
// Step 7c: Complete Milestone
101+
cy.get('button.complete-milestone-button').click();
102+
cy.wait(3000);
103+
cy.log('✅ Step 3: Complete Milestone completed');
104+
cy.pause(); // Pause to observe Complete Milestone step
105+
cy.log('⏸️ Paused after Complete Milestone - Press space to continue');
106+
107+
// Step 7d: Approve Milestone
108+
cy.get('button.approve-milestone-button').click();
109+
cy.wait(3000);
110+
cy.log('✅ Step 4: Approve Milestone completed');
111+
cy.pause(); // Pause to observe Approve Milestone step
112+
cy.log('⏸️ Paused after Approve Milestone - Press space to continue');
113+
114+
// Step 7e: Release Funds
115+
cy.get('button.release-funds-button').click();
116+
cy.wait(3000);
117+
cy.log('✅ Step 5: Release Funds completed');
118+
cy.pause(); // Pause to observe Release Funds step
119+
cy.log('⏸️ Paused after Release Funds - Press space to continue');
120+
}
121+
});
122+
123+
// Step 8: Verify demo completion and confetti animation
124+
cy.get('body').then(($body) => {
125+
if ($body.find('h3').filter(':contains("Demo Completed Successfully")').length > 0) {
126+
cy.get('h3').contains('Demo Completed Successfully!').should('be.visible');
127+
cy.log('✅ Demo completed successfully');
128+
} else if ($body.find('div').filter(':contains("Funds Released Successfully")').length > 0) {
129+
cy.get('div').contains('🎉 Funds Released Successfully!').should('be.visible');
130+
cy.log('✅ Demo completed successfully (alternative text)');
131+
} else {
132+
cy.log('ℹ️ Demo completion text not found - checking for other completion indicators');
133+
}
134+
});
135+
136+
// Step 9: Wait 5 seconds for confetti animation
137+
cy.wait(5000);
138+
cy.log('✅ Waited 5 seconds for confetti animation');
139+
140+
// Step 10: Click complete demo button
141+
cy.get('body').then(($body) => {
142+
if ($body.find('button').filter(':contains("Complete Demo")').length > 0) {
143+
cy.get('button').contains('Complete Demo').click();
144+
cy.log('✅ Clicked Complete Demo button');
145+
} else if ($body.find('button').filter(':contains("Complete")').length > 0) {
146+
cy.get('button').contains('Complete').click();
147+
cy.log('✅ Clicked Complete button');
148+
} else if ($body.find('button').filter(':contains("Submit")').length > 0) {
149+
cy.get('button').contains('Submit').click();
150+
cy.log('✅ Clicked Submit button');
151+
} else {
152+
cy.log('ℹ️ Complete Demo button not found - demo may have auto-completed');
153+
}
154+
});
155+
156+
// Step 11: Verify final state
157+
cy.get('body').then(($body) => {
158+
// Check if modal closed or demo completed
159+
if ($body.find('h3').filter(':contains("Demo Completed Successfully")').length === 0) {
160+
cy.log('✅ Demo flow completed - modal closed or demo finished');
161+
} else {
162+
cy.log('✅ Demo still showing completion state');
163+
}
164+
});
165+
166+
cy.log('🎉 Demo 1 complete flow finished successfully!');
167+
});
168+
});

0 commit comments

Comments
 (0)