o
    i)	                     @   s@   d Z ddlmZ ddlmZ ddlmZ dZdd Zd	d
 Z	dS )z/Test saving a notebook with escaped characters
    )quote)By   )wait_for_selectorz
var done = arguments[arguments.length - 1];
%s.then(
    data => { done(["success", data]); },
    error => { done(["error", error]); }
);
c                 C   s&   | t|  \}}|dkr|S t|)Nsuccess)execute_async_script
promise_js	Exception)jsbrowserstatedata r   \/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/notebook/tests/selenium/test_save.pyexecute_promise   s   r   c                 C   sX  d}t |}| jddd | jd| td| j}|d |ks"J | jd}||ks.J | jd	}||ks:J | jtjd
j}|d |ksKJ td| j | jd}t	|dks_J | jtj
d  g }t| jdD ]#}	|	d}
||
v rtd|
 | j|
 t| jd  n||
 qqt|d|| jd}||ksJ d S )Nu'   has#hash and space and unicø∂e.ipynbr   zs = '??')indexcontentz0Jupyter.notebook.set_notebook_name(arguments[0])z Jupyter.notebook.save_notebook()namez%return Jupyter.notebook.notebook_namez%return Jupyter.notebook.notebook_pathnotebook_namez.ipynbz"Jupyter.notebook.save_checkpoint()z#return Jupyter.notebook.checkpointsr   z#ipython_notebook aza.item_linkhrefOpeningz.cellz not found in )r   	edit_cellr   execute_scriptr   find_elementr   IDtextlenCSS_SELECTORclickr   get_attributeprintgetappendAssertionError)notebooknbnameescaped_namemodelcurrent_namecurrent_pathdisplayed_namecheckpointshrefs_nonmatchlinkr   r   r   r   	test_save   s8   

r.   N)
__doc__urllib.parser   selenium.webdriver.common.byr   utilsr   r   r   r.   r   r   r   r   <module>   s    	