-
Notifications
You must be signed in to change notification settings - Fork 341
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: Cleanup old web-ext run artifacts dir when we are connecting to an android device #1866
Conversation
@rpl Sir the main thing that I have done is adbClient.readdir(deviceId, '/sdcard') and then for their result checked if there is directory and if it then its starting is "web-ext-artifacts-" if so then delete it. I couldn't get git to commit in the previous one but in this one I have used branch, so probably future commits won't require new pull request. |
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.
Hi @Vishalghyv
follows another round of review comments.
Besides the review comments below, I wanted to add some other more general ones:
-
are you testing this interactively on an android device (or an android emulator)? (I haven't yet tried it this branch, but in the meantime I want to be sure that you are already able to try your branch while you are designing your proposed fix, let me know if you are unable to run this locally and you would need some help with that)
-
it looks that you would like to add an CLI option, take a look to one some of the existing CLI option related to the firefox-android extension runner are defined and how they are getting passed to the firefox-android extension runner instance. Let me know if there are some details about this that you are not yet able to follow.
-
As described in the review comments below, from the current version of your patches I got a rough idea of the strategy that you may be thinking of, but your implementation doesn't yet match what I think you want to achieve. In general I would suggest you to decide how the "fix/feature" would work for the user first, then decide how to split and assign the responsibilities to the components involved. It is easier to make clean changes when you have a clear plan.
-
I haven't yet commented on the automated tests required for this change, if you don't have some previous experiences on writing unit tests the following comment may provide some useful hints and links to docs: fix: Choose a random free tcp port to be used for the Firefox Desktop remote debugging server #1669 (comment)
@rpl , Thanks for reviewing the pull request and giving such brief and informative comments. |
Hey, @rpl I have tried to implement the changes you requested. |
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.
Hi @Vishalghyv, here is another round of review comments (some of them are actually being pointed out in the previous review, but are not handled yet or not completely).
As a side note, I haven't looked into the tests yet because I'd like you to get to an implementation as simple and clean as possible first (and after that I'll review the code in the tests).
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 @Vishalghyv, this version looks already cleaner and better than the previous ones.
Follows another round of review comments for this new version.
I mean first I thought my code was fine but following your suggestion was amazing. I couldn't work yesterday because of some errors in os. But will do today |
Sir, Yes I tried to go through all four condition which might occur in this |
|
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.
@Vishalghyv it looks that we are getting there.
Follows another round of review comments.
Sir, I have tried to implement the requested changes. And will change var directories to let directories in the next commit |
Sorry, For so many commits and clean ups left |
tests/unit/test-util/test.adb.js
Outdated
}, | ||
}); | ||
const adbUtils = new ADBUtils({adb}); | ||
const temp = '/sdcard/'; |
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.
temp doesn't seem to be used anywhere else bug in the next line, doesn't seem necessary to give it a 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.
Can't directly concatenate the strings thus this was required, and can't use concat function as it will add sdcard in end of artifactDir
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.
not sure what you mean with tou can't use concat function? there is no real need to use different ways to concatenate strings (the String concat method and the + operator).
you can just compose all of them together using the template string syntax I mentioned in another review comment:
const part1 = "part1";
const part2 = "part2";
const part3 = "part3";
const aComposedString = `${part1}${part2}${part3}`;
Maybe four files are not necessary but this allowed to make sure that the test would break if the function did not worked properly especially when it's the case of deleting a folder from the users phone |
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 sorry @Vishalghyv took me longer than expected to get back to this and focus on it a bit to collect another round of review comments.
Follows some new review comments related to the changes on the implementation side and some more on the tests (as I also mentioned below I think that we also need some more tests in test.firefox-android.js to better cover this change).
We should also make sure to remove the changes to package-lock.json and package.json from this PR.
tests/unit/test-util/test.adb.js
Outdated
}, | ||
}); | ||
const adbUtils = new ADBUtils({adb}); | ||
const temp = '/sdcard/'; |
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.
not sure what you mean with tou can't use concat function? there is no real need to use different ways to concatenate strings (the String concat method and the + operator).
you can just compose all of them together using the template string syntax I mentioned in another review comment:
const part1 = "part1";
const part2 = "part2";
const part3 = "part3";
const aComposedString = `${part1}${part2}${part3}`;
Should I use two tests for different params, two running instance or is there another way? (for checking the expected call params of checkOrCleanArtifacts function) |
If the test might look like the current version, should this test be added to the one above it i.e in 'stops any running instances of the selected Firefox apk' And should adbCleanArtifacts directly retrieved from params |
@Vishalghyv this pull request still container the unrelated changes to package.json and package-lock.json, removing the file in a new commit isn't the right way to remove those changes. I did cleaned up and rebased your branch locally and pushed here in my github fork here (in the branch named pr-1866-Vishalghyv-REBASE-DONE): you can get the commit from there and overwrite this PR with it (it has to be in a branch with the same name of your and and then pushed into your github fork using --force to overwrite the branch, otherwise git will refuse to push the commit on the existing branch because it is not a new commit on top of the existing one) If you are curious about how I achieved that, here is what I did locally:
Mission accomplished! yay \o/ Using the revision system can be tricky some times, but the more you practice it (and then learn about it as a side effect), the easier and faster it gets to work with it. I hope that this will help you to get the cleanup on this branch done. Let me know if you have still issues and you are unable to get this branch cleaned up as needed. |
…an android device
1 similar comment
Mission accomplished! yay \o/ |
Thanks Sir for the help :) |
Tried the original version by you, Comment was really good, I saved it as a code snippet for squashing commits and rebase. |
(Fixes #1591)