@@ -613,3 +613,37 @@ test('create instance with additional disks', async ({ page }) => {
613613 await expectRowVisible ( otherDisksTable , { Disk : 'new-disk-1' , size : '5 GiB' } )
614614 await expectRowVisible ( otherDisksTable , { Disk : 'disk-3' , size : '6 GiB' } )
615615} )
616+
617+ test ( 'Validate CPU and RAM' , async ( { page } ) => {
618+ await page . goto ( '/projects/mock-project/instances-new' )
619+
620+ await page . getByRole ( 'textbox' , { name : 'Name' , exact : true } ) . fill ( 'db2' )
621+ await selectASiloImage ( page , 'ubuntu-22-04' )
622+
623+ await page . getByRole ( 'tab' , { name : 'Custom' } ) . click ( )
624+
625+ const cpu = page . getByRole ( 'textbox' , { name : 'CPU' } )
626+ await cpu . fill ( '999' )
627+
628+ // blur CPU
629+ const memory = page . getByRole ( 'textbox' , { name : 'Memory' } )
630+ await memory . click ( )
631+
632+ // make sure it's not clamping the value
633+ await expect ( cpu ) . toHaveValue ( '999' )
634+
635+ await memory . fill ( '1025' )
636+
637+ const submitButton = page . getByRole ( 'button' , { name : 'Create instance' } )
638+
639+ const cpuMsg = page . getByText ( 'Can be at most 64' ) . first ( )
640+ const memMsg = page . getByText ( 'Can be at most 1024 GiB' ) . first ( )
641+
642+ await expect ( cpuMsg ) . toBeHidden ( )
643+ await expect ( memMsg ) . toBeHidden ( )
644+
645+ await submitButton . click ( )
646+
647+ await expect ( cpuMsg ) . toBeVisible ( )
648+ await expect ( memMsg ) . toBeVisible ( )
649+ } )
0 commit comments