-
Notifications
You must be signed in to change notification settings - Fork 2
End‐To‐End testing
How to test that our code still passes the end-to-end tests before merging with main. Find below the precise Git commands and Android Studio instructions, as well as explanations on what all this does.
You will do every next step locally, which means you never need to push, but will sometimes need to commit your changes.
Let feat/my-branch
be the name of the branch you are working on, which you want to test against the end-to-end tests. From that finished branch, create a (local) branch, named for example feat/my-branch-e2e
and check it out. Merge the test/end-to-end
branch into it. You should now have all the code you were working on, plus the end-to-end tests in feat/my-branch-e2e
. Run the tests you need. If they pass, you're all good!
If they do not pass: work on feat/my-branch-e2e
to fix your code. Do not work on feat/my-branch
while you modify feat/my-branch-e2e
. Once you've fixed it, commit your changes (don't commit any change to the end-to-end tests). Since it's just a fix, you should be able to do it in only one commit (the fewer commits, the better), but if there are a lot of changes, you might want to do it in multiple commits.
Then, checkout your working branch feat/my-branch
and cherry-pick the fix commit(s) you just made. Now you should have your feat/my-branch
with the code you worked on, updated with the fix, but not the end-to-end tests. Well done!
Don't forget to delete your feat/my-branch-e2e
when you don't need it anymore!
# Step 1: Create and checkout a new branch from `feat/my-branch`
git checkout -b feat/my-branch-e2e feat/my-branch
# Step 2: Merge end-to-end tests
# while checked out in `feat/my-branch/e2e`
git merge test/end-to-end
# Step 3: Run tests
# run tests however you need to
# Step 4: Fix issues if tests fail
# Make necessary code changes
git add . # only if you've not modified the end-to-end test.
# If you have, stage your files one by one
git commit -m "fix: fix issues found during end-to-end testing"
# Step 5: Cherry-pick fixes
git checkout feat/my-branch
git cherry-pick <commit-hash> # if there are multiple commits, you can do:
# git cherry-pick <commit-hash1> <commit-hash2> ... <commit-hashN>
Don't forget to delete your feat/my-branch-e2e
when you don't need it anymore!
Open the Git panel (Alt+9):
Right-click on feat/my-branch
> New branch from 'feat/my-branch'. Name it however you want in the dialog that appears, tick the "Checkout branch" option and then click "Create". You should now be checked into the new branch.
In the Git panel (Alt+9), find the test/end-to-end
branch. Right click on it > Merge 'test/end-to-end' into 'feat/my-branch-e2e'.
Run your tests.
Still checked into feat/my-branch-e2e
, got to the Commits panel (Alt+0):
Select the changes you want to commit (do not commit changes to the end-to-end files!), write your commit message (for example: "fix: fix issues found during end-to-end testing") and click on "Commit".
Check out feat/my-branch
: in the Git panel, right-click your feat/my-branch
> Checkout. In the commits list, click on the fix you just made. If you want to select multiple commits, you can do Ctrl-click. If you are struggling to find your commits, you can filter the view to only show commits from feat/my-branch-e2e
. Then click on Cherry-Pick (here, I have selected three commits to cherry-pick):
Don't forget to delete your feat/my-branch-e2e
when you don't need it anymore!
This part is AI-generated to save me some time.
You create a new branch feat/my-branch-e2e
from feat/my-branch
.
This ensures that feat/my-branch-e2e
starts with the same codebase as feat/my-branch
.
You merge the test/end-to-end
branch into feat/my-branch-e2e
.
This adds the end-to-end tests to feat/my-branch-e2e
without affecting feat/my-branch
.
You run the end-to-end tests on feat/my-branch-e2e
.
If the tests pass, you can proceed to whatever you needed to do with your feat/my-branch
branch.
If the tests fail, you make the necessary fixes on feat/my-branch-e2e
.
You commit these fixes to feat/my-branch-e2e
(ensuring not to commit any changes to the end-to-end tests themselves).
You check out feat/my-branch
.
You cherry-pick the fix commits from feat/my-branch-e2e
to feat/my-branch
.
This ensures that feat/my-branch
gets the necessary fixes without including the end-to-end tests.
feat/my-branch
remains clean and only includes the necessary code and fixes.
feat/my-branch-e2e
is used for testing and fixing issues related to end-to-end tests.
The end-to-end tests are not included in feat/my-branch
, keeping it focused on the feature development.