@@ -4,16 +4,17 @@ import Settings from '../SettingsPage/Settings';
44
55describe ( 'Settings Page' , ( ) => {
66 // shared setup for all tests
7- const setupTest = ( ) => {
7+ const setupTest = async ( ) => {
88 const user = userEvent . setup ( ) ;
99 render ( < Settings /> ) ;
10+ await screen . findByRole ( 'switch' , { name : / l a u n c h a t s t a r t u p / i } ) ;
1011 return { user } ;
1112 } ;
1213
1314 describe ( 'Interaction Sanity' , ( ) => {
1415 describe ( 'User Preferences Section' , ( ) => {
1516 test ( 'YOLO model dropdown opens and shows options' , async ( ) => {
16- const { user } = setupTest ( ) ;
17+ const { user } = await setupTest ( ) ;
1718
1819 const dropdownTrigger = screen . getByRole ( 'button' , {
1920 name : / n a n o | s m a l l | m e d i u m / i,
@@ -28,9 +29,9 @@ describe('Settings Page', () => {
2829 } ) ;
2930
3031 test ( 'GPU Acceleration toggle changes state on click' , async ( ) => {
31- const { user } = setupTest ( ) ;
32+ const { user } = await setupTest ( ) ;
3233
33- const gpuSwitch = screen . getByRole ( 'switch' ) ;
34+ const gpuSwitch = screen . getByRole ( 'switch' , { name : / g p u a c c e l e r a t i o n / i } ) ;
3435 expect ( gpuSwitch ) . toHaveAttribute ( 'aria-checked' , 'false' ) ;
3536
3637 await user . click ( gpuSwitch ) ;
@@ -49,7 +50,7 @@ describe('Settings Page', () => {
4950 test . each ( buttonCases ) (
5051 '$label button does not crash when clicked' ,
5152 async ( { name } ) => {
52- const { user } = setupTest ( ) ;
53+ const { user } = await setupTest ( ) ;
5354
5455 const button = screen . getByRole ( 'button' , { name } ) ;
5556
@@ -71,7 +72,7 @@ describe('Settings Page', () => {
7172 test . each ( yoloSelectionCases ) (
7273 'selecting $expectedText updates dropdown display' ,
7374 async ( { selectOption, expectedText } ) => {
74- const { user } = setupTest ( ) ;
75+ const { user } = await setupTest ( ) ;
7576
7677 const dropdownTrigger = screen . getByRole ( 'button' , { name : / n a n o / i } ) ;
7778 expect ( dropdownTrigger ) . toHaveTextContent ( 'Nano' ) ;
@@ -88,7 +89,7 @@ describe('Settings Page', () => {
8889 ) ;
8990
9091 test ( 'dropdown can be reopened after selection' , async ( ) => {
91- const { user } = setupTest ( ) ;
92+ const { user } = await setupTest ( ) ;
9293
9394 const dropdownTrigger = screen . getByRole ( 'button' , { name : / n a n o / i } ) ;
9495 await user . click ( dropdownTrigger ) ;
@@ -102,9 +103,9 @@ describe('Settings Page', () => {
102103
103104 describe ( 'GPU Acceleration Toggle' , ( ) => {
104105 test ( 'toggle cycles through ON/OFF states' , async ( ) => {
105- const { user } = setupTest ( ) ;
106+ const { user } = await setupTest ( ) ;
106107
107- const gpuSwitch = screen . getByRole ( 'switch' ) ;
108+ const gpuSwitch = screen . getByRole ( 'switch' , { name : / g p u a c c e l e r a t i o n / i } ) ;
108109 expect ( gpuSwitch ) . toHaveAttribute ( 'aria-checked' , 'false' ) ;
109110
110111 await user . click ( gpuSwitch ) ;
0 commit comments