-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 #20927: Error message about unsaved changes #21331
base: develop
Are you sure you want to change the base?
Fix #20927: Error message about unsaved changes #21331
Conversation
Assigning @Nik-09 for the first pass review of this PR. Thanks! |
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 @ujjwalpathaak LGTM
Hi @ujjwalpathaak, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to ask someone to merge your PR once the CI checks pass and you're happy with it. Thanks! |
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.
Hey @ujjwalpathaak Please also write the tests for the changes made. Thanks!
Hi @ujjwalpathaak, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 4 days, it will be automatically closed so that others can take up the issue. |
@seanlip @HardikGoyal2003 I was trying to mimic the behaviour of closing the tab by In the file
tried it both with fakeAsync and without fakeAsync. With fakeAsync -
i had mirrored the implementation of If it's been working fine is there a need to add the behaviour test for onClosingStoryEditorBrowserTab or we can skip it? as manual testing shows it's getting called on closing then tab. (shown in the demo video in PR's desc) If it's needed to be added on both |
Hi @ujjwalpathaak, I'm sorry but I don't understand what you are asking. I can answer the parts I can understand:
If you still run into issues I would encourage you to create a debugging doc (see our wiki) and we can guide you if you have open questions. |
Sorry @seanlip, if my previous message was not that clear! I'll try to explain the issue with best efforts.
The issue is that it's a unit test so it's not able to mimic the window reload behavious. this sums it up correctly <- read this.
I have tried many things ~ trying to dispatch the As per my research online - in the unit test we should test the working of the Now we just need to test westher the beforeunload event is calling the Now in my last message I was referring to the This only has a test which checks for the implementation of the function ( What do I think? - If we need to add the test which checks if these function are getting called on the |
There is where the 2nd problems comes - I cant write or debug the E2E tests on my machine. As you know Oppia's frontend tests face problems when on macos -
The units tests are still manageable! but E2E tests don't work at all. I once had a word with @Akhilesh-max too.. he also suggested that E2E tests dont run on MacOS. What I can do is maybe raise a PR to write the E2E tests for this fix, so that someone with a linux/windows machine could write them. Do you have any suggestion as to how can we fix the tests for Macos - It can be a really huge blocker for someone who wants to contribute and is on mac. |
Thanks @ujjwalpathaak. I would probably try to dispatch the event. You say an approach like this does not work? Do you have a debugging doc that digs into what happens then and why it doesn't work? Re e2e tests ... that is a separate issue, let's not combine it with this one. I think the only thing we can do is to figure out what's blocking the e2e tests on Mac and try to fix that. Do you want to give it a try? Though that would be a separate task IMO. |
Let me know if you are able to dispatch the event and write a test for this behaviour! What i wanted to say was that if the unit tests are not able to test the desired behaviour of triggering a function on tab close correctly we can maybe open a new issue to write e2e tests for this behaviour instead of the unit tests.. so that someone else can pick it up. I have a pending PR to open will try to look for a solution to the e2e tests on mac problem after it. |
@ujjwalpathaak My previous comment still applies. |
Hi @ujjwalpathaak, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 4 days, it will be automatically closed so that others can take up the issue. |
Overview
Essential Checklist
Please follow the instructions for making a code change.
Proof that changes are correct
Screen.Recording.2024-11-06.at.9.59.47.AM.webm