-
Notifications
You must be signed in to change notification settings - Fork 66
Save as improvements #267
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save as improvements #267
Conversation
I am running into issues running tests both locally and in CI on my fork that I am unsure how to fix. I am unsure if they will replicate in the CI here. |
Thank you for submitting this PR @andrewfulton9, the new CI failures that are present seem to be the I am wondering, after trying some different paths, using the new function, |
Thanks for taking a look at this @RRosio!
I agree that this seems to be an issue with JS dependencies. I have been trying to figure out a fix, but have yet to find one. I was able to get the tests to go through CI by hard pinning the all the versions, but oddly this isn't working for me locally. Once I get that figured out I will fix and update
Good catch. So if an invalid path is given in |
Have you by any chance cleared the bower cache located in
That is a good idea, I went ahead and opened #268.
Yes that is correct! |
Closing and reopening to rerun CI checks |
|
@andrewfulton9 it looks like the only failure in Playwright tests is in
|
Thanks for the heads up @krassowski, I should have some time next week to look at this. |
After re-running the CI Playwright Tests, one of the three failures passed but two others are still failing. To me it seems that these failures may not actually be related to the PR itself. However it has been difficult to consistently reproduce these failures locally, where the entire test suite passes with no notable issues. |
@RRosio, I finally got a chance to come back to this. I added error handling and tests to this PR and they are are passing locally. I am still getting some CI failures on my branch, but as far as I can tell they aren't related. |
It looks like some tests are still failing, but I am not able to reproduce locally. |
Looks like #329 should solve the dependency issues here; I'm reverting my changes. |
0500f31
to
78d4de9
Compare
|
||
def attempt_form_fill_and_save(): | ||
def attempt_form_fill_and_save(notebook_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 111 needs partial as in line 192:
TypeError: attempt_form_fill_and_save() missing 1 required positional argument: 'notebook_path'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think attempt_form_fill_w_dir_and_save
was never actually called in this test. Let me fix that now...
Hi @andrewfulton9 we are getting ready to cut a new release and it would be awesome to get this in. Do you want to rebase your changes? That might fix some of the test failures on CI. |
Hi @danyeaw, after a discussion with @andrewfulton9 I'm shepherding this one through review, so I'm happy to rebase this. Thanks again for the dependency updates! |
d50e480
to
5816f8f
Compare
@@ -2866,6 +2866,7 @@ define([ | |||
|
|||
Notebook.prototype.save_notebook_as = function() { | |||
var that = this; | |||
var current_notebook_name = $('body').attr('data-notebook-name') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since tests are passing on main
but not here, I suspect the code might have some issues. While I do not see it straightaway, I would add semicolons, both because lack of these can lead to unexpected evaluation in JS, and to match the style in surrounding code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrgh, I can't get the tests to pass locally on main
, so I can't really begin to debug this branch locally either.
git clean -fdx; npm run build; OPENSSL_CONF=/etc/ssl python -m nbclassic.jstest base
On main
, I still get the same issue, Error adding link: TypeError: undefined is not a function (evaluating 'Number.isFinite(num)')
.
I'll start by cleaning this up a bit and see if we can't get a better idea of the real problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure what's going on here, but it seems like there are some instances in the code base here where ES6 functions are being called, like Math.log10
and Math.isFinite
. When run on a version of node that doesn't support these, we get the JS errors we've been seeing in the tests. Funny thing is we haven't touched the dependencies here, so I have no idea why this branch is behaving any different in places of the code that weren't touched 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why it manifested this way, but there was a problematic arrow function buried in the click handler for the modal that prompts the user when generating the missing parent directories. Seems like tests are passing now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the "Save as" functionality for notebooks by adding the ability to infer the new notebook name from the current one and to create missing directories when needed. Key changes include updating end-to-end tests to pass the notebook path dynamically, modifying UI behavior in the save-as dialog, and introducing recursive directory creation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
nbclassic/tests/end_to_end/test_save_as_notebook.py | Updated tests to dynamically supply notebook names and test saving notebooks in new directories with adjusted timeouts. |
nbclassic/static/notebook/js/notebook.js | Modified save-as logic to infer notebook name and added recursive directory creation when the target directory does not exist. |
c3c4a44
to
c134476
Compare
c8deb54
to
7569f10
Compare
Okay, I think some of the end to end tests were failing because the frontend doesn't have time to respond when playwright checks for the presence/absence of certain DOM elements. I've added a few waits here and there, and that seems to have resolved the issues on linux. However |
Thanks for retriggering tests - I think the end-to-end tests are just flaky, and in adding another form we're potentially exacerbating the underlying flakiness. Not sure what the best course of action is; looks like it must have gotten stuck here, based on the log: https://github.com/andrewfulton9/nbclassic/blob/2680b1dc1daad44c4021edbb8b19b0aefc1e9067/nbclassic/tests/end_to_end/test_save_as_notebook.py#L123 On the other hand, these tests seem to be able to pass at least intermittently: https://github.com/peytondmurray/nbclassic/actions/runs/14603851073/job/40968241964?pr=1. Maybe the sleep interval after each click isn't large enough on the small github runners that the tests are running on? I'll bump that now - if anyone has other suggestions I'd be grateful for them! EDIT: Okay, I'm still getting flaky tests on stuff that is unrelated as well, see https://github.com/peytondmurray/nbclassic/actions/runs/14610590297/job/40987766926?pr=1. |
Thank you @peytondmurray and @krassowski for all your work here! I just re-ran the Playwright tests and they are all passing. It seems that there may still be some lingering flakiness in the tests. Thanks again, I will go ahead and merge this! |
Fixes for #266
Adds functionality for inferring new notebook name from current notebook and creating directories from "save as".
No backwards incompatibilities as far as I am aware.
nbclassic_save_as_fixes.mp4