- Notifications
You must be signed in to change notification settings - Fork5.5k
Add save as menu option#3289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
fd25ae1 Add 'Save As' option to the menu
Madhu94ee79a7f UI changes
Madhu949b18d07 Switch sessions instead of opening in new window
Madhu9484e565c More UI changes
Madhu94eab1e70 Add basic selenium test case
Madhu9481c6eed Don't get entire contents of the notebooks, while checking
Madhu940c81fc3 Remove ES6 syntax from save_notebook_as
minrkFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletionsnotebook/static/notebook/js/menubar.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
93 changes: 91 additions & 2 deletionsnotebook/static/notebook/js/notebook.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionsnotebook/templates/notebook.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletionsnotebook/tests/selenium/test_save_as_notebook.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from notebook.tests.selenium.utils import wait_for_selector | ||
| from selenium.webdriver.common.keys import Keys | ||
| from selenium.webdriver.support.ui import WebDriverWait | ||
| def wait_for_rename(browser, nbname, timeout=10): | ||
| wait = WebDriverWait(browser, timeout) | ||
| def notebook_renamed(browser): | ||
| elem = browser.find_element_by_id('notebook_name') | ||
| current_name = browser.execute_script('return arguments[0].innerText', elem) | ||
| return current_name == nbname | ||
| return wait.until(notebook_renamed) | ||
| def save_as(nb): | ||
| JS = 'Jupyter.notebook.save_notebook_as()' | ||
| return nb.browser.execute_script(JS) | ||
| def get_notebook_name(nb): | ||
| JS = 'return Jupyter.notebook.notebook_name' | ||
| return nb.browser.execute_script(JS) | ||
| def set_notebook_name(nb, name): | ||
| JS = 'Jupyter.notebook.rename("{}")'.format(name) | ||
| nb.browser.execute_script(JS) | ||
| def test_save_notebook_as(notebook): | ||
| # Set a name for comparison later | ||
| set_notebook_name(notebook, name="nb1.ipynb") | ||
| wait_for_rename(notebook.browser, "nb1") | ||
| assert get_notebook_name(notebook) == "nb1.ipynb" | ||
| # Wait for Save As modal, save | ||
| save_as(notebook) | ||
| wait_for_selector(notebook.browser, '.save-message') | ||
| inp = notebook.browser.find_element_by_xpath('//input[@data-testid="save-as"]') | ||
| inp.send_keys('new_notebook.ipynb') | ||
| inp.send_keys(Keys.RETURN) | ||
| wait_for_rename(notebook.browser, "new_notebook") | ||
| # Test that the name changed | ||
| assert get_notebook_name(notebook) == "new_notebook.ipynb" | ||
| # Test that address bar was updated (TODO: get the base url) | ||
| assert "new_notebook.ipynb" in notebook.browser.current_url |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.