Last modified: 2014-02-21 22:01:07 UTC
Zero team uses a HTTP header to fake IPs. Until they implement a different way of faking IPs, investigate if Selenium can fake HTTP headers.
Probably not with Se directly, see suggestions at https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/TeC-0TVV7Io
Do we know if Zero team still needs this? Who do we ping there to find out?
To make it explicit, the solution should use Selenium Ruby bindings: https://code.google.com/p/selenium/wiki/RubyBindings
Possibly related blog posts: http://jimevansmusic.blogspot.com/2012/07/webdriver-y-u-no-have-http-status-codes.html http://jimevansmusic.blogspot.com/2013/08/implementing-webdriver-http-status.html http://jimevansmusic.blogspot.com/2013/08/implementing-http-status-codes-in.html http://jimevansmusic.blogspot.com/2013/08/implementing-http-status-codes-in_17.html
We (zero) are currently forced to do testing via our own testing framework (simple script), which is obviously far "superior" to what Selenium offers. We would really like to switch to selenium for testing, but unless we can SET headers on request (we don't care about reading headers in the response), we can't use selenium. I am aware of the proxying solution, but that is not very applicable - we need to set header = value1, test that results match value1, set it to value2, etc.
This is the famous Issue 141 https://code.google.com/p/selenium/issues/detail?id=141
I have changed the title, since it looks to me that this should not be done with Selenium, but another tool.
If you need more information (and you probably do), feel free to ask questions here, at #wikimedia-qa freenode IRC channel or at QA mailing list: https://lists.wikimedia.org/mailman/listinfo/qa
Looks like it should be possible to fake headers, at least for PhantomJS: https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#customheaders-object
More information: http://stackoverflow.com/a/20568647/17469
The goal of this task is to find out what zero team needs and to implement at least one simple test, proving that the solution you found works.
Yuri, can you provide more detail? Mayank (Google Code-in student) is working on this. He needs an example that he will implement.
We currently built a workaround in production, allowing header values to also be passed as URL params. This is obviously a hack, but has worked more or less ok, as long as we don't test what happens after the click (URL params are not preserved via links) Here is an example, but this URL ONLY works if you don't have forceHTTPS or other cookies set - use privacy browser when testing: http://en.m.wikipedia.org/wiki/Special:ZeroRatedMobileAccess?X-CS=-TEST-ALL That same X-CS could be passed as a header, making testing check if the site shows proper behavior after clicking. If some other carrier was used, for example X-CS=250-99 -- https://meta.wikimedia.org/wiki/Zero:250-99 -- they only whitelist en & ru, which means navigating to other languages should not show the banner. Let me know if you have any questions!
Change 101485 had a related patch set uploaded by Mayankmadan: Adding a test to check if supplying custom headers works https://gerrit.wikimedia.org/r/101485
*** Bug 61379 has been marked as a duplicate of this bug. ***
Change 106709 had a related patch set uploaded by Zfilipin: Adding Cucumber tests First cucumber test for checking the banners on Wikipedia Zero. https://gerrit.wikimedia.org/r/106709
Change 101485 abandoned by Zfilipin: WIP: Adding a test to check if supplying custom headers works Reason: Moved to https://gerrit.wikimedia.org/r/#/c/106709/ https://gerrit.wikimedia.org/r/101485
This is now implemented in https://gerrit.wikimedia.org/r/#/c/106709/ Please take a look and merge into ZeroRatedMobileAccess.
Change 114153 had a related patch set uploaded by Zfilipin: Added links for ZeroRatedMobileAccess repository https://gerrit.wikimedia.org/r/114153
Change 106709 merged by jenkins-bot: The first Selenium test: banners https://gerrit.wikimedia.org/r/106709
Change 114153 merged by jenkins-bot: Added links for ZeroRatedMobileAccess repository https://gerrit.wikimedia.org/r/114153