File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,10 +63,20 @@ function rewriteLinks() {
6363 "click" ,
6464 ( event ) => {
6565 rewriteTargets ( ) ;
66+ let target = "" ;
67+ if ( event . target instanceof Element ) {
68+ if ( event . target . id ) {
69+ target = `#${ event . target . id } ` ;
70+ } else if ( event . target . classList . length ) {
71+ target = `.${ event . target . classList . value . replaceAll ( " " , "." ) } ` ;
72+ } else {
73+ target = event . target . tagName ;
74+ }
75+ }
6676 sendMessageToTestBox ( CLICK , {
6777 x : event . x ,
6878 y : event . y ,
69- target : event . target ,
79+ target,
7080 } ) ;
7181 } ,
7282 false
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ type HealthCheckEvent = {
2222type ClickEvent = {
2323 x : number ;
2424 y : number ;
25- target : any ;
25+ target ?: string ;
26+ } ;
27+
28+ type LoginFailEvent = {
29+ message ?: string ;
2630} ;
2731
2832export interface TestBoxOutgoingEvents {
@@ -35,7 +39,7 @@ export interface TestBoxOutgoingEvents {
3539 [ INITIALIZE_FAIL ] : undefined ;
3640 [ LOGIN_ACK ] : undefined ;
3741 [ LOGIN_SUCCESS ] : undefined ;
38- [ LOGIN_FAIL ] : undefined ;
42+ [ LOGIN_FAIL ] : LoginFailEvent ;
3943 [ LOGIN_NO_CREDS ] : undefined ;
4044 [ NAVIGATE_ACK ] : undefined ;
4145}
Original file line number Diff line number Diff line change 11import { sendMessageToTestBox } from "../messaging" ;
22import { LOGIN_FAIL , LOGIN_SUCCESS } from "../messaging/outgoing" ;
33import { IncomingEventHandlers , LoginEvent } from "../messaging/incoming" ;
4+ import { error , info } from "./logging" ;
45
56export let loggingIn = false ;
67
@@ -9,22 +10,24 @@ export async function autoLogin(
910 router : Partial < IncomingEventHandlers >
1011) {
1112 let nextUrl : string | boolean ;
13+ let errorMessage : string ;
1214 loggingIn = true ;
1315 try {
1416 const func = router [ "login" ] ;
1517 if ( ! func ) {
16- console . log ( "No login callback exists!" ) ;
18+ info ( "No login callback exists!" ) ;
1719 sendMessageToTestBox ( LOGIN_FAIL ) ;
1820 return ;
1921 }
2022 nextUrl = await func ( data ) ;
2123 } catch ( e ) {
22- console . log ( e ) ;
24+ error ( e ) ;
25+ errorMessage = e . message ;
2326 nextUrl = false ;
2427 }
2528
2629 if ( nextUrl === false ) {
27- sendMessageToTestBox ( LOGIN_FAIL ) ;
30+ sendMessageToTestBox ( LOGIN_FAIL , { message : errorMessage } ) ;
2831 } else {
2932 sendMessageToTestBox ( LOGIN_SUCCESS ) ;
3033 }
You can’t perform that action at this time.
0 commit comments