-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix timeline feature error when base url is set #402
Conversation
Failures seem to be unrelated (see #403). |
c17f130
to
87dc382
Compare
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 #393 seems to suggest an issue with the server base URL, should you make use of it in this PR? The baseUrl
is available in JupyterLab's page config.
The problem isn't actually with the baseUrl, it's just that the document name was being incorrectly extracted. |
Could you write a test that shows that this was indeed the cause of problem? In particular, I'd like to see that your fix works even if "api/collaboration/timeline" is present in the base URL. |
Currently, the updated logic ensures that only the last occurrence of Would you still like me to add a specific test to verify this behavior? I also want to mention that there’s another open PR (#401) that creates a test file for the timeline slider. If I add a test here, it would create or modify the same file, potentially leading to conflicts later. Let me know how you'd like to proceed—whether to hold off on tests for this PR until #401 is merged or go ahead and add them now. |
@@ -20,6 +20,7 @@ type Props = { | |||
contentType: string; | |||
format: string; | |||
}; | |||
const DOCUMENT_TIMELINE_URL = 'api/collaboration/timeline'; |
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.
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.
Yes I will fix that. Thanks for the feedback !
Yes it would be nice to have a test. I merged #401. |
c40bd3a
to
a0b14fb
Compare
e49ef76
to
dc4f8ff
Compare
ui-tests/package.json
Outdated
@@ -5,7 +5,9 @@ | |||
"private": true, | |||
"scripts": { | |||
"start": "jupyter lab --config jupyter_server_test_config.py", | |||
"test": "npx playwright test", | |||
"start:timeline": "jupyter lab --config jupyter_server_test_config_timeline.py", |
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.
You can get rid of ui-tests/jupyter_server_test_config_timeline.py
and do:
"start:timeline": "jupyter lab --config jupyter_server_test_config_timeline.py", | |
"start:timeline": "jupyter lab --ServerApp.base_url=/api/collaboration/timeline/", |
|
||
isTimeline && test.use({ autoGoto: false }) | ||
|
||
test('should fail if there are console errors when opening from path', async ({ page, tmpPath }) => { |
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 don't understand what this test does. It seems that you do nothing if isTimeline
?
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.
There is no need to execute this test in the added timeline test environment (with the set baseurl)
but this is the test for this PR that was merged #401
await openNotebook(page, `${tmpPath}/Untitled.ipynb`); | ||
|
||
expect(pageErrors).toHaveLength(0); | ||
}); | ||
|
||
test('should display in status bar without console errors when baseUrl is set', async ({ page, baseURL }) => { |
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.
Same comment as above.
await page.notebook.close(); | ||
|
||
if(!isTimeline) |
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.
if(!isTimeline) |
|
||
test.describe('Timeline Slider', () => { | ||
|
||
isTimeline && test.use({ autoGoto: false }) |
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.
What is it for?
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.
So I found that even with different configuration, somehow playwright overwrites the baseurl and goes to the default one (http://localhost:8888
) by default so we need to use this test.use({ autoGoto: false })
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.
And the part isTimeline &&
?
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.
isTimeline is the environment variable used to determine whether we are testing with the new environment or the default one. So we need to do this test.use({ autoGoto: false })
only if we are testing with the new env (when isTimeline
is true like in here TIMELINE_FEATURE=1 jlpm test:timeline
)
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.
Could you explain what you mean by "new environment" and "default environment"?
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.
The "new environment" refers to the testing setup needed for this PR, which uses a custom baseUrl
(/api/collaboration/timeline/
) as opposed to the "default environment," where tests run with the standard baseUrl
(/lab
or /
). The new environment is specifically configured to validate the Timeline functionality in isolation, whereas the default environment is used for general tests without the Timeline-specific context.
isTimeline
is used to identify which environment is active. If isTimeline
is true, we disable the automatic navigation (test.use({ autoGoto: false })
) that Playwright performs, as this navigation doesn’t respect the custom baseUrl
and defaults to http://localhost:8888
. Disabling it allows us to manually control the navigation to the appropriate custom environment.
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.
Thanks. I think this is clearer:
isTimeline && test.use({ autoGoto: false }) | |
if (isTimeline) { | |
test.use({ autoGoto: false }); | |
} |
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.
Thanks @Meriem-BenIsmail.
This PR fixes #393