@@ -17,47 +17,40 @@ test.describe('Console Pane: Python', { tag: [tags.WEB, tags.CONSOLE, tags.WIN]
1717 await app . workbench . console . waitForConsoleContents ( 'done' , { expectedCount : 2 , timeout : 30000 } ) ;
1818 } ) ;
1919
20- test ( 'Python - Verify cancel button on console bar' , async function ( { app, python } ) {
21- await app . workbench . console . executeCode ( 'Python' , 'import time' ) ;
22- await app . workbench . console . executeCode ( 'Python' , 'time.sleep(10)' , { waitForReady : false } ) ;
23- await app . workbench . console . interruptExecution ( ) ;
24- } ) ;
25-
2620 test ( 'Python - Verify console commands are queued during execution' , async function ( { app, python } ) {
21+ await app . workbench . console . clearButton . click ( ) ;
2722 await app . workbench . console . pasteCodeToConsole ( '123 + 123' ) ;
2823 await app . workbench . console . executeCode ( 'Python' , '456 + 456' ) ;
2924
3025 await app . workbench . console . waitForConsoleContents ( '912' , { expectedCount : 1 , timeout : 10000 } ) ;
3126 await app . workbench . console . waitForConsoleContents ( '123 + 123' , { expectedCount : 1 , timeout : 10000 } ) ;
3227 await app . workbench . console . waitForConsoleContents ( '246' , { expectedCount : 0 , timeout : 5000 } ) ;
33-
3428 } ) ;
3529
3630 test ( 'Python - Verify interrupt stops execution mid-work' , async function ( { app, python } ) {
31+ const { console } = app . workbench ;
32+
3733 // Execute code that does work in a loop and prints progress
3834 const code = `
3935import time
4036for i in range(10):
41- print(f"Step {i}")
42- time.sleep(1)
37+ print(f"Step {i}")
38+ time.sleep(1)
4339print("Completed all steps")
4440` ;
45- await app . workbench . console . executeCode ( 'Python' , code , { waitForReady : false } ) ;
46-
47- // Wait for some work to be done (at least 2-3 steps)
48- await app . workbench . console . waitForConsoleContents ( 'Step 2' , { expectedCount : 1 , timeout : 10000 } ) ;
49-
50- // Interrupt the execution
51- await app . workbench . console . interruptExecution ( ) ;
41+ await console . clearButton . click ( ) ;
42+ await console . executeCode ( 'Python' , code , { waitForReady : false } ) ;
5243
53- // Wait for KeyboardInterrupt to appear
54- await app . workbench . console . waitForConsoleContents ( 'KeyboardInterrupt' , { expectedCount : 1 , timeout : 5000 } ) ;
44+ // Wait for some work to be done (at least 2-3 steps) and then interrupt
45+ await console . waitForConsoleContents ( 'Step 2' , { expectedCount : 1 , timeout : 10000 } ) ;
46+ await console . interruptExecution ( ) ;
47+ await console . waitForConsoleContents ( 'KeyboardInterrupt' , { expectedCount : 1 , timeout : 5000 } ) ;
5548
5649 // Verify that some work was done (we saw Step 2)
57- await app . workbench . console . waitForConsoleContents ( 'Step 2' , { expectedCount : 1 , timeout : 1000 } ) ;
50+ await console . waitForConsoleContents ( 'Step 2' , { expectedCount : 1 , timeout : 1000 } ) ;
5851
5952 // Verify that not all work was completed (Step 9 should not appear)
60- await app . workbench . console . waitForConsoleContents ( 'Step 9' , { expectedCount : 0 , timeout : 1000 } ) ;
53+ await console . waitForConsoleContents ( 'Step 9' , { expectedCount : 0 , timeout : 1000 } ) ;
6154 } ) ;
6255
6356} ) ;
0 commit comments