o
    i                     @   s4   d dl mZ ddlmZ dd Zdd Zdd	 Zd
S )    )By   )wait_for_selectorc                 C   s,   | j tjd  t| j ddd  d S )N
kernellinkz#int_kernelTsingle)browserfind_elementr   IDclickr   notebook r   a/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/notebook/tests/selenium/test_interrupt.pyinterrupt_from_menu   s   r   c                 C   s   | j d d S )Nii)body	send_keysr   r   r   r   interrupt_from_keyboard   s   r   c                 C   sf   d}| j d|d ttfD ]#}| d |   | d ||  t| jddd}d|jv s0J qdS )	a   Test the interrupt function using both the button in the Kernel menu and the keyboard shortcut "ii"

        Having trouble accessing the Interrupt message when execution is halted. I am assuming that the
        message does not lie in the "outputs" field of the cell's JSON object. Using a timeout work-around for
        test with an infinite loop. We know the interrupt function is working if this test passes.
        Hope this is a good start.
    z/import time
for x in range(3):
   time.sleep(1)r   )indexcontentz.output_subareaTr   KeyboardInterruptN)		edit_cellr   r   clear_cell_outputto_command_modeexecute_cellr   r   text)r   r   interrupt_methodoutputr   r   r   test_interrupt   s   	

r   N)selenium.webdriver.common.byr   utilsr   r   r   r   r   r   r   r   <module>   s
    