@@ -31,10 +31,84 @@ const puppeteer = require('puppeteer');
3131 throw new Error ( 'Signup form not found' ) ;
3232 }
3333
34- console . log ( '✓ Test passed successfully!' ) ;
34+ // Fill out the signup form
35+ console . log ( 'Filling out signup form...' ) ;
36+
37+ const testData = {
38+ email : `bob@acme.com` ,
39+ password : 'TestPassword123!' ,
40+ firstName : 'Bob' ,
41+ lastName : 'McFlows' ,
42+ organization : 'ACME'
43+ } ;
44+
45+ // Fill out the signup form fields
46+ const firstNameField = await page . $ ( '#id_first_name' ) ;
47+ if ( firstNameField ) {
48+ await firstNameField . type ( testData . firstName ) ;
49+ console . log ( '✓ First name field filled' ) ;
50+ } else {
51+ throw new Error ( 'First name field not found' ) ;
52+ }
53+
54+ const lastNameField = await page . $ ( '#id_last_name' ) ;
55+ if ( lastNameField ) {
56+ await lastNameField . type ( testData . lastName ) ;
57+ console . log ( '✓ Last name field filled' ) ;
58+ } else {
59+ throw new Error ( 'Last name field not found' ) ;
60+ }
61+
62+ const emailField = await page . $ ( '#id_email' ) ;
63+ if ( emailField ) {
64+ await emailField . type ( testData . email ) ;
65+ console . log ( '✓ Email field filled' ) ;
66+ } else {
67+ throw new Error ( 'Email field not found' ) ;
68+ }
69+
70+ const passwordField = await page . $ ( '#id_password1' ) ;
71+ if ( passwordField ) {
72+ await passwordField . type ( testData . password ) ;
73+ console . log ( '✓ Password field filled' ) ;
74+ } else {
75+ throw new Error ( 'Password field not found' ) ;
76+ }
77+
78+ const workspaceField = await page . $ ( '#id_workspace' ) ;
79+ if ( workspaceField ) {
80+ await workspaceField . click ( { clickCount : 3 } ) ;
81+ await workspaceField . type ( testData . organization ) ;
82+ console . log ( '✓ Workspace field filled' ) ;
83+ } else {
84+ throw new Error ( 'Workspace field not found' ) ;
85+ }
86+
87+ console . log ( 'Submitting signup form...' ) ;
88+
89+ const submitButton = await page . $x ( 'button[type="submit"]' ) ;
90+ if ( submitButton . length > 0 ) {
91+ await submitButton [ 0 ] . click ( ) ;
92+ console . log ( '✓ Sign Up button clicked' ) ;
93+ } else {
94+ throw new Error ( 'Sign Up button not found' ) ;
95+ }
96+
97+ await page . waitForNavigation ( { waitUntil : 'networkidle2' , timeout : 10000 } ) ;
98+
99+ console . log ( '✓ Signup form test completed successfully!' ) ;
35100
36101 } catch ( error ) {
37102 console . error ( '✗ Test failed:' , error . message ) ;
103+
104+ // Try to capture a screenshot for debugging
105+ try {
106+ await page . screenshot ( { path : 'test-failure.png' , fullPage : true } ) ;
107+ console . log ( 'Screenshot saved as test-failure.png' ) ;
108+ } catch ( screenshotError ) {
109+ console . log ( 'Could not save screenshot' ) ;
110+ }
111+
38112 process . exit ( 1 ) ;
39113 } finally {
40114 await browser . close ( ) ;
0 commit comments