-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Upload UI tests #2626
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
Upload UI tests #2626
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2626 +/- ##
=========================================
- Coverage 2.77% 2.75% -0.02%
=========================================
Files 259 260 +1
Lines 12365 12438 +73
Branches 1116 1125 +9
=========================================
Hits 343 343
- Misses 11995 12068 +73
Partials 27 27
Continue to review full report at Codecov.
|
Great initiative @domdomegg! I can try helping with some of the things that you have mentioned in the help section.
It should be quite simple. We can probably get a test user created as discussed in #2226.
Yes, this should be possible via travis. Can you resolve merge conflicts so that i can work on top of it? |
The idea in #2226 was to create a locked down user which we could share the password with so it could run instrumentation tests automatically on anyone's machine - for example tests on the contributions activity. I should have updated it before, but it doesn't seem possible as you can't block a user from changing their password. Also if a user is locked down it means we can't upload the test image. Therefore I think we need a new test user which isn't locked down, but we just keep the login details secretly stored on Travis, and then expect people running tests requiring login on their own machines to login to their own test accounts. |
…id-commons into domdomegg-test-upload
Hey @domdomegg , I want to contribute can you please tell about few test that you are not working upon so that I can write the unit tests :) |
I think this PR requires quite a few Travis config changes which only a few people have access to. I've just submitted #2636 which is a WIP on WelcomeActivityTest (the tutorial) with some TODO ideas there I'm not currently working on. |
@domdomegg As far I have noticed the previous tests were written in Kotlin, so from now onwards are we writing the unit tests in java or in kotlin? |
Good point actually. All the unit tests are done in Kotlin, and the one instrumentation (android) test was done in Java so I continued in Java. Actually thinking about it properly I think we should use Kotlin for the instrumentation tests so all the tests are the same language. |
@domdomegg I have raised a PR to fix this. Now in the setup phase, I generate an image programmatically and then use it for uploading. |
Another thing that we need to take care of is: Runtime Permissions. As of now, I had to grant permission beforehand. Edit: have added |
e.printStackTrace(); | ||
} | ||
|
||
String fileUrl = "https://commons.wikimedia.beta.wmflabs.org/wiki/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.
Can we enhance this bit as well? We can probably call media wiki api to assert if the image was uploaded.
Apart from this, I am working on automating the login bit. Do we have other action items for making this master ready? |
I don't think so. There probably will be more annoying issues once we enable it in Travis though. |
Yes, the final goal should be to have everything work on a fresh install itself. |
Wow, thanks @domdomegg ! :) As the tests are run on Commons beta, I personally think it is OK to use a regular beta account. This:
Sounds like a good idea to me. |
@domdomegg Have raised https://github.com/domdomegg/apps-android-commons/pull/2 to automate the login process. |
With automated login with test account
@domdomegg Can we merge this PR now? |
I think so |
Description
Fixes #705 (as I believe #2086 did unit tests, and this does UI tests so it should be all covered)
Would hopefully catch issues like #2629
TODO
Having the test work automatically from a fresh install. Currently it requires running the app and logging in, and having a file called
image.jpg
in the base of the filesystem.I'm not sure how to go about this, (hence the 'help needed'). I think this roughly breaks into two fairly separate parts:
image.jpg
in/storage/emulated/0/
(symlink'ed from/mnt/sdcard
and/sdcard/
)Also I'm worried that if the API is very slow, the delays I've put in the test at certain points to wait for responses won't be long enough - I'm not sure what we can do about this too.
These will need to be done to get this working on Travis, however as it's not actually running the Android tests at the moment we could merge anyways and fix this when we re-enable them.
Contributing
If you think you can help please do create a branch continuing mine and submit PRs back to
domdomegg/test-upload
:)