-
-
Notifications
You must be signed in to change notification settings - Fork 676
Enable end to end testing via Pirlo #3669
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
Conversation
7c7403d to
12f9eca
Compare
12f9eca to
6513d8f
Compare
gnprice
left a comment
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! Looking forward to having this set up.
I have a couple of questions below for before merge, and one bit of (non-blocking) feedback on the distribution flow.
There are also some aspects of the shell-scripting style that differ from our preferred style, but that's all easy for me to fix up when/after merging.
.travis.yml
Outdated
|
|
||
| script: | ||
| - TERM=dumb tools/test --full | ||
| - TERM=dumb travis_wait tools/test --full |
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.
Interesting -- what's this bit do?
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.
This is used to ensure that this command keeps on running for 20 minutes even if it doesn't print any output. More information can be found here https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received
|
|
||
| set -e | ||
| echo "Downloading pirlo-cli tool" | ||
| curl https://pirlo-downloads.s3-us-west-1.amazonaws.com/pirlo-cli/pirlo-cli -o pirlo-cli |
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.
This is fine for now for getting started, but one thing that would streamline things is to have the CLI tool available as a package on NPM, so that we could add it to our dependencies in package.json and it'd get installed by yarn install.
In particular that'd mean that once it's downloaded, it doesn't have to be re-downloaded unless a new version is specified. Doesn't much matter in CI, but that would make it a lot smoother to use a script like this interactively.
(Despite the name, there's no need for JS let alone Node to be involved in an NPM package; it basically amounts to a tarball with a name and a version number and a few other bits of metadata, all stuffed into a JSON file at a well-known name inside the tarball. Also it's shockingly easy to upload to NPM.)
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.
Interesting idea. Will definitely add this to our development roadmap and implement it as soon as possible.
tools/test
Outdated
|
|
||
| if [ -z "$suites" ]; then | ||
| suites=(android flow lint jest prettier) | ||
| suites=(android flow lint jest prettier functional) |
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 think we'll want to leave it out of these defaults (for when the test script is run without arguments), so you say tools/test functional when you want to run it. Then we can just say that in the Travis config to make it run in CI.
That takes it out of the hot loop in normal development (edit, run tests, edit, run tests, etc.) -- we try to keep that very fast, like a few seconds.
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.
Sure makes complete sense. I have now removed functional test suite from default test suite.
|
|
||
| echo "Initiating a new automated test run." | ||
|
|
||
| ./pirlo-cli run -k jNmWe3iFhWjvSy_SCjlvLsCWgfw= android/app/build/outputs/apk/release/app-release.apk No newline at end of file |
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 does this token mean -- is it a form of auth, and if so what's the scope of it?
One thing we can do if there needs to be a secret involved (because this is a public repo) is IIRC I can put it in Travis config so it gets passed as an environment variable.
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 this is an auth token with a limited scope to be used by CI system. The auth token can only be used for initiating an automated test run and getting its status. We also agree its better idea to add it as an environment variable in your travis config. You can set an environment variable name PIRLO_API_KEY and then we don't need to pass it as cli argument.
|
Hmm, also it looks like the CI build failed because Travis timed it out at 20 minutes. Our builds in master are 9-10 minutes: One thing this probably means is that we'll want to run this in parallel with our existing tests, rather than in sequence. I'm not sure that's easy to do in Travis, hmm. From email notifications, I see you're already watching the repo and triggering builds based on it. What do you think about sending a notification directly to GitHub too? I believe this is the API that Travis and its various competitors and the like use: In any case that needn't block us from getting the script merged so we can run it ad hoc, which would be a good step forward. I'm curious about how the keys or tokens work, though, as mentioned above. |
6513d8f to
8f883e2
Compare
I have updated the PR to now ensure that functional test and your remaining test suite can run in parallel. The latest build is now passing and is not timing out. We believe the main power of the platform is to be integrated with travis. As mentioned above, adding auth token as an environment variable to your build settings works out of the box and we can remove the auth token as soon as you have added it to travis build settings. |
|
@gnprice what are good next steps for this PR? happy to make changes further if helpful. |
|
Hello! Sorry I've let this linger for a while. I just rebased this branch, and then tried running it. The script seemed to work, except I couldn't actually get the results: I ran But that link doesn't work. I get a page with an empty table that says "Sorry, no matching records found", and a red error banner at the bottom that says "We were not able to fetch all your results. Please try again later." I also tried just browsing the app, at pages like https://app.pirlo.io/tests and https://app.pirlo.io/runs , and got similar results. Then, trying the "gear"/"settings" icon in the left nav on the webapp, I got https://app.pirlo.io/integrations which shows me an API key. I guess that API key is for my account, and the one in the PR is for another one, which makes sense. Maybe that explains why I couldn't see the results, though? So I tried putting my API key, copied from that page, in the script instead of the one that's there. This time, it quickly failed like so: So I guess my API key isn't valid? In any case, that didn't fix the original problem that I can't see the results of a run. |
|
Same story with the results from the Travis run on this PR -- that's https://travis-ci.org/zulip/zulip-mobile/jobs/606361300 and the results end with: But that link: I also pushed the rebased branch to my own fork, so Travis would run there: |
|
A few smaller comments:
|
|
Oh, one more: I don't see at https://app.pirlo.io/integrations (which shows me my API key) an option to invalidate it, and get a new one. That's an important security feature: any API key needs a way to revoke it. Ideally it would be possible to generate a new key, and have both work for a short time in order to enable a smooth rollover. But for a service like this one that isn't especially critical (it's fine if a few builds fail in the minutes or hour or so around changing a key), and it's a bit more complicated on your side. The simplest possible thing -- I hit a button, the old key is gone, there's a new one -- would work fine. |
|
(Thanks again for working on this!) |
|
@gnprice Thanks for the response. We are looking into this and will get back to you shortly. Are you logged into Pirlo using greg@zulipchat.com? Could you try to logout and access the link https://app.pirlo.io/run/1c54f2f8-2f82-47e0-bfe6-50a125f7add4/results?authToken=9mf3-dtyE1lMeDFFoRjm391oY-0%3D? |
Add a functional test suite to `tools/test` that runs e2e test cases recorded on pirlo.io. Also ensure that functional test run in parallel to other test suites.
8f883e2 to
d6fe654
Compare
|
@gnprice We have updated the PR with the suggested changes except for the API security fix which will be tackle in our upcoming sprint. To help answers you posted above 1/ Why could you not see results? 2/ Why are you seeing differents API keys in "Integration settings" and this PR? 3/ Do we need 4/ Why are tied to Travis CI? One benefit of working inside a CI system directly is the APK building portion is handled already for us. We can move towards consuming Github events directly but that would involve creating a system to build APK which is easy but not trivial. Can you verify the functionality and let us know if we can move forward with the integration? |
|
@vinayjain404 Thanks for the updates!
Seems to work! When I followed that link a few minutes ago, I found that it actually already worked; same for the other link https://app.pirlo.io/run/9dc20183-cce8-40cf-a8bc-a497f0a6e41d/results?authToken=9mf3-dtyE1lMeDFFoRjm391oY-0%3D . Also the bar at the top of the page said "Welcome anonymous". Then I went to just app.pirlo.io , and got a login page. I logged in, and https://app.pirlo.io/tests shows one run, from "a month ago". Those two links to specific runs' results still work too. I find that
I'll rerun the suite and confirm that all looks good. |
Was there a particular reason for deleting those lines? I don't know of a real reason they should be there -- they seem like legacy cruft -- so I don't mind taking them out. But I'd be curious to know if there was a particular problem you ran into that caused you to try taking them out.
Build is still running, because Travis is flaky/slow. I've kicked off a new attempt. (It had a network failure downloading Node... so Provided that works fine, I expect to merge this today. Thanks again! |
|
OK, and that indeed worked! So, about to merge. One more bit of UI feedback:
|
|
@gnprice Will make the suggested changes in the CLI and follow up on other questions. |
|
OK -- merged! Pushed the following commits: The first is the one from this PR, with small adjustments to the commit message. The rest are some small commits of mine on top. (Usually I push back to the PR branch just before merge, which allows GitHub to draw the connection between the commits pushed and the PR, and show the PR as merged. I wasn't able to do so for this branch, so GitHub will see it as closed; the difference isn't a meaningful one.) |
This change will integrate Pirlo CLI with the Travis CI system. The Pirlo CLI script will execute a set of pre-defined test cases on real devices in the cloud. The CLI script will output the link to the latest test run in the console.
For your reference, the UI tests can be viewed at https://app.pirlo.io/tests?authToken=9mf3-dtyE1lMeDFFoRjm391oY-0%3D and results for each build is available at https://app.pirlo.io/runs?authToken=9mf3-dtyE1lMeDFFoRjm391oY-0%3D