File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333html {
3434 scroll-behavior : smooth;
3535 overflow-x : hidden;
36- background-color : var (--color-primary );
3736}
3837
3938body {
Original file line number Diff line number Diff line change @@ -5,4 +5,14 @@ interface ImportMetaEnv {
55
66interface ImportMeta {
77 readonly env : ImportMetaEnv ;
8- }
8+ }
9+
10+ // Allow interaction between the speedtest and the controller process
11+ // for running this test automated in a headless browser
12+ interface Window {
13+ nbSpeedtestOptions ?: {
14+ acceptedPolicy ?: boolean
15+ }
16+ nbSpeedtestOnResult ?: ( result : any ) => void
17+ nbSpeedtestOnFinished ?: ( ) => void
18+ }
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ const App: Component = () => {
6363 </ ColsLayout >
6464 </ Container >
6565 </ >
66-
6766 ) ;
6867} ;
6968
Original file line number Diff line number Diff line change @@ -91,6 +91,10 @@ const NBSpeedTest: Component<{ onStateChange?: (state: SpeedTestState) => void }
9191 const newResults = [ ...results ( ) , outcome ]
9292 setResults ( newResults )
9393
94+ if ( window . nbSpeedtestOnResult ) {
95+ window . nbSpeedtestOnResult ( { success : outcome . success , result : outcome . success ? outcome . result . getSummary ( ) : undefined } )
96+ }
97+
9498 const nextIndex = currentIndex + 1
9599 if ( nextIndex < testRuns ( ) . length ) {
96100 setCurrentTest ( nextIndex )
@@ -99,6 +103,10 @@ const NBSpeedTest: Component<{ onStateChange?: (state: SpeedTestState) => void }
99103 setTestRunCount ( prev => prev + 1 )
100104 setFinished ( new Date ( ) )
101105 setTimeout ( restart , config . repeatIntervalSec * 1000 )
106+
107+ if ( window . nbSpeedtestOnFinished ) {
108+ window . nbSpeedtestOnFinished ( )
109+ }
102110 }
103111 }
104112
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export const PowerBtn: Component<{ onClick?: JSX.EventHandlerUnion<HTMLButtonEle
99 < div class = "p-8 bg-primary/5 rounded-full aspect-square" >
1010 < div class = "p-8 bg-primary/10 rounded-full aspect-square border border-primary/20" >
1111 < div class = "p-8 bg-primary/20 rounded-full aspect-square border border-primary/30" >
12- < button class = "btn btn-circle btn-xl text-primary-content border-primary p-12 text-5xl bg-gradient-to-b from-primary to-primary/50 shadow-xl" onClick = { props . onClick } >
12+ < button id = "nb_speedtest_start_btn" class = "btn btn-circle btn-xl text-primary-content border-primary p-12 text-5xl bg-gradient-to-b from-primary to-primary/50 shadow-xl" onClick = { props . onClick } >
1313 < TbPower />
1414 < span class = 'sr-only' > { t . speedtest . startBtn ( ) } </ span >
1515 </ button >
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export const PrivacyPolicyModal: Component<PrivacyPolicyModalProps> = (props) =>
5555 </ div >
5656 < div class = "modal-action flex-col items-stretch" >
5757 < button
58+ id = "nb_speedtest_accept_policy"
5859 class = "btn btn-primary"
5960 onClick = { handleAccept }
6061 autofocus
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ export function getPrivacyPolicyVersion(): string {
1111}
1212
1313export function isPrivacyPolicyAccepted ( ) : boolean {
14+ if ( window . nbSpeedtestOptions ?. acceptedPolicy === true ) {
15+ return true
16+ }
17+
1418 try {
1519 const stored = localStorage . getItem ( STORAGE_KEY ) ;
1620 if ( ! stored ) {
You can’t perform that action at this time.
0 commit comments