Remove dependency to pageSource* HTML testcase files in test_pagesource.py
Categories
(Remote Protocol :: Marionette, enhancement, P3)
Tracking
(firefox71 fixed)
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: whimboo, Assigned: rgpt, Mentored)
References
Details
(Keywords: good-first-bug, Whiteboard: [lang=py])
User Story
For steps in how to get started please consult our documentation for new users: https://firefox-source-docs.mozilla.org/testing/marionette/marionette/NewContributors.html In the case of questions you can find us on IRC in the #ateam channel.
Attachments
(1 file, 6 obsolete files)
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Updated•7 years ago
|
Comment hidden (mozreview-request) |
Reporter | ||
Comment 7•7 years ago
|
||
Comment hidden (mozreview-request) |
Reporter | ||
Comment 10•7 years ago
|
||
mozreview-review |
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Reporter | ||
Comment 13•7 years ago
|
||
Reporter | ||
Comment 15•7 years ago
|
||
Reporter | ||
Comment 16•7 years ago
|
||
Comment 17•7 years ago
|
||
Comment 18•7 years ago
|
||
Reporter | ||
Comment 19•7 years ago
|
||
Comment 20•7 years ago
|
||
Reporter | ||
Comment 21•7 years ago
|
||
Comment 22•7 years ago
|
||
Comment 23•7 years ago
|
||
Reporter | ||
Comment 24•7 years ago
|
||
Reporter | ||
Updated•7 years ago
|
Comment 25•7 years ago
|
||
Comment hidden (mozreview-request) |
Reporter | ||
Comment 27•7 years ago
|
||
Reporter | ||
Comment 28•7 years ago
|
||
mozreview-review |
Reporter | ||
Comment 29•7 years ago
|
||
Reporter | ||
Comment 30•6 years ago
|
||
Comment 31•6 years ago
|
||
Reporter | ||
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Reporter | ||
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
Comment 37•6 years ago
|
||
Comment 38•6 years ago
|
||
Comment 39•6 years ago
|
||
Reporter | ||
Comment 40•6 years ago
|
||
Comment hidden (mozreview-request) |
Updated•6 years ago
|
Reporter | ||
Comment 42•6 years ago
|
||
mozreview-review |
Comment hidden (mozreview-request) |
Reporter | ||
Comment 44•6 years ago
|
||
mozreview-review |
Reporter | ||
Comment 45•6 years ago
|
||
mozreview-review |
Comment 46•6 years ago
|
||
Reporter | ||
Comment 47•6 years ago
|
||
Comment 48•6 years ago
|
||
Reporter | ||
Comment 49•6 years ago
|
||
Comment 50•6 years ago
|
||
Comment 51•6 years ago
|
||
Comment 52•6 years ago
|
||
Comment 53•6 years ago
|
||
Reporter | ||
Comment 54•6 years ago
|
||
Comment 55•6 years ago
|
||
Reporter | ||
Comment 56•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 58•6 years ago
|
||
Comment 59•6 years ago
|
||
Comment 60•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 61•6 years ago
|
||
Comment 62•6 years ago
|
||
Comment 63•6 years ago
|
||
Reporter | ||
Comment 64•6 years ago
|
||
Comment 65•6 years ago
|
||
Comment 66•6 years ago
|
||
Reporter | ||
Comment 67•6 years ago
|
||
Comment 68•6 years ago
|
||
Comment 69•6 years ago
|
||
Comment 70•6 years ago
|
||
Reporter | ||
Comment 71•6 years ago
|
||
Comment 72•6 years ago
|
||
Reporter | ||
Comment 73•6 years ago
|
||
Comment 74•6 years ago
|
||
Comment 75•6 years ago
|
||
Comment 76•6 years ago
|
||
Comment 77•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Comment 79•6 years ago
|
||
Reporter | ||
Comment 80•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 82•6 years ago
|
||
Reporter | ||
Comment 83•6 years ago
|
||
Reporter | ||
Comment 84•6 years ago
|
||
Comment 85•6 years ago
|
||
Comment 86•6 years ago
|
||
I have a fix I'd like to test, but I can't find information on testing my code. Which commands do I need to run?
Reporter | ||
Comment 87•6 years ago
|
||
Benjamin, please check https://firefox-source-docs.mozilla.org/testing/marionette/Testing.html#marionette-functional-tests in how to run the unit tests for Marionette.
Reporter | ||
Updated•6 years ago
|
Comment 88•6 years ago
|
||
One of the test cases are failing and I don't know how to fix it. It seems the "source" variable which is given it's value by "self.marionette.page_source" in the "testShouldReturnReturnAXMLDocumentSource" method is adding some beginning html tags to the solely expected xml code resulting in an error. This is the output of running "./mach marionette-test testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py":
./mach marionette-test testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py
0:00.00 INFO Using workspace for temporary data: "/home/ben/BigData/src/mozilla-unified"
0:00.00 mozversion INFO application_buildid: 20190323155725
0:00.00 mozversion INFO application_changeset: 59e55930dc0f243357a8730be1a0ca372e6baddb
0:00.00 mozversion INFO application_display_name: Nightly
0:00.00 mozversion INFO application_id: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
0:00.00 mozversion INFO application_name: Firefox
0:00.00 mozversion INFO application_remotingname: firefox
0:00.00 mozversion INFO application_vendor: Mozilla
0:00.00 mozversion INFO application_version: 68.0a1
0:00.00 mozversion INFO platform_buildid: 20190323155725
0:00.00 mozversion INFO platform_changeset: 59e55930dc0f243357a8730be1a0ca372e6baddb
0:00.00 mozversion INFO platform_version: 68.0a1
0:00.00 INFO Application command: /home/ben/BigData/src/mozilla-unified/obj-x86_64-pc-linux-gnu/dist/bin/firefox -no-remote -marionette -profile /tmp/tmpkuwpjU.mozrunner
0:02.02 INFO Profile path is /tmp/tmpkuwpjU.mozrunner
0:02.02 INFO Starting fixture servers
0:02.14 INFO Fixture server listening on http://127.0.0.1:41567/
0:02.14 INFO Fixture server listening on https://127.0.0.1:33217/
0:02.34 INFO e10s is enabled
0:02.36 mozversion INFO application_buildid: 20190323155725
0:02.36 mozversion INFO application_changeset: 59e55930dc0f243357a8730be1a0ca372e6baddb
0:02.36 mozversion INFO application_display_name: Nightly
0:02.36 mozversion INFO application_id: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
0:02.36 mozversion INFO application_name: Firefox
0:02.36 mozversion INFO application_remotingname: firefox
0:02.36 mozversion INFO application_vendor: Mozilla
0:02.36 mozversion INFO application_version: 68.0a1
0:02.36 mozversion INFO platform_buildid: 20190323155725
0:02.36 mozversion INFO platform_changeset: 59e55930dc0f243357a8730be1a0ca372e6baddb
0:02.36 mozversion INFO platform_version: 68.0a1
0:02.36 SUITE_START: marionette-test - running 1 tests
0:02.36 TEST_START: testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py TestPageSource.testShouldReturnAXMLDocumentSource
0:02.61 TEST_END: FAIL, expected PASS - AssertionError: u'<html><head></head><body><xml><foo><bar>baz</bar></foo></xml></body></html>' != '<xml><foo><bar>baz</bar></foo></xml>'
Traceback (most recent call last):
File "/home/ben/BigData/src/mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 159, in run
testMethod()
File "/home/ben/BigData/src/mozilla-unified/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py", line 66, in testShouldReturnAXMLDocumentSource
self.assertEqual(re.sub("\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>")
0:02.62 TEST_START: testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py TestPageSource.testShouldReturnTheSourceOfAPage
0:02.66 TEST_END: PASS
0:02.66 TEST_START: testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py TestPageSource.testShouldReturnTheSourceOfAPageWhenThereAreUnicodeChars
0:02.71 TEST_END: PASS
0:02.71 INFO
SUMMARY
0:02.71 INFO passed: 2
0:02.71 INFO failed: 1
0:02.71 INFO todo: 0
0:02.71 INFO
FAILED TESTS
0:02.71 INFO test_pagesource.py test_pagesource.TestPageSource.testShouldReturnAXMLDocumentSource
0:02.71 SUITE_END
marionette-test
Ran 3 checks (3 tests)
Expected results: 2
Unexpected results: 1
test: 1 (1 fail)
Unexpected Results
------------------
FAIL testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py TestPageSource.testShouldReturnAXMLDocumentSource - AssertionError: u'<html><head></head><body><xml><foo><bar>baz</bar></foo></xml></body></html>' != '<xml><foo><bar>baz</bar></foo></xml>'
Traceback (most recent call last):
File "/home/ben/BigData/src/mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 159, in run
testMethod()
File "/home/ben/BigData/src/mozilla-unified/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py", line 66, in testShouldReturnAXMLDocumentSource
self.assertEqual(re.sub("\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>")
Reporter | ||
Comment 89•6 years ago
|
||
Sorry, but as long as I cannot see your changes to the code there is nothing I can do.
Comment 90•6 years ago
|
||
-- coding: utf-8 --
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
from future import absolute_import
import urllib
from marionette_harness import MarionetteTestCase
def inline(doc):
return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
class TestPageSource(MarionetteTestCase):
def testShouldReturnTheSourceOfAPage(self):
#test_html = self.marionette.absolute_url("testPageSource.html")
self.marionette.navigate(inline("""
<html>
<head>
<title>PageSource Test</title>
</head>
<body>
<p> Check the PageSource
</body>
</html>
"""))
source = self.marionette.page_source
from_web_api = self.marionette.execute_script("return document.documentElement.outerHTML")
self.assertTrue("<html" in source)
self.assertTrue("PageSource" in source)
self.assertEqual(source, from_web_api)
def testShouldReturnTheSourceOfAPageWhenThereAreUnicodeChars(self):
#test_html = self.marionette.absolute_url("testPageSourceWithUnicodeChars.html")
self.marionette.navigate(inline("""
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="pragma" content="no-cache"/>
<!--
- the « section[id^="wifi-"] » selector.
-->
</body>
</html>
"""))
# if we don't throw on the next line we are good!
source = self.marionette.page_source
from_web_api = self.marionette.execute_script("return document.documentElement.outerHTML")
self.assertEqual(source, from_web_api)
def testShouldReturnAXMLDocumentSource(self):
#test_xml = self.marionette.absolute_url("testPageSource.xml")
self.marionette.navigate(inline("""
<xml>
<foo>
<bar>baz</bar>
</foo>
</xml>
"""))
source = self.marionette.page_source
from_web_api = self.marionette.execute_script("return document.documentElement.outerHTML")
import re
self.assertEqual(re.sub("\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>")
self.assertEqual(source, from_web_api)
Reporter | ||
Comment 91•6 years ago
|
||
Your inline()
method as defined always produces HTML. If you want to have XML, you would need something like:
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/webdriver/tests/support/inline.py
Comment 92•6 years ago
|
||
I don't understand the example and can't find documentation on the various methods and variable names used in inline for that example nor can I find documentation on .format() itself. Could you explain or link to documentation that can explain what's going on?
Reporter | ||
Comment 93•6 years ago
|
||
Basically what you want is to serve a different doctype for XML otherwise it won't work as you can see. Check the example for exactly this purpose. Also format()
is a method which comes from Python itself. So check its own documentation.
Comment 94•5 years ago
|
||
If no one else is working on it, we are a student group from LNMIIT learning the Team Software Process, and if you are able to mentor us can we pick up this enhancement? @Henrik
Reporter | ||
Comment 95•5 years ago
|
||
Kabeer, at any time! Just read the user story at the top of the bug, and especially the link for new contributors. So get familiar with Marionette, and how to run tests. Feel free to ask if something is unclear, here or on IRC.
Comment 96•5 years ago
|
||
@Henrik All right we will start getting familiar with the work that has been done and other stuff that you mentioned thanks!
Assignee | ||
Comment 97•5 years ago
|
||
Comment 98•5 years ago
|
||
We are still actually working on this @Rishi Gupta , I do think we have a 20 day period before someone else is allowed to work on this, can you confirm @Henrik
Reporter | ||
Comment 99•5 years ago
|
||
I'm not aware of a 20 days period. If we don't here from people after a week, or don't see any progress it is fine if someone else gets also started. The bug will usually be assigned to the person who first submits a usable patch. So if you are still interested in contributing please feel free to pick another bug which we have lots of. Thanks.
Comment 100•5 years ago
|
||
Hi! I'm new to open source contribution and I'd like to give this a try if no one else is working on it currently.
Reporter | ||
Comment 101•5 years ago
|
||
No, this bug is taken. Please have a look at others like bug 1443572 or bug 1354458.
Comment 102•5 years ago
|
||
We are a student group from a college. We had picked up this bug as part of our course project. We had to document the process by which we will fix this bug which is why we were late in submitting a patch. We have already created the whole schema for patching this bug and were actually going to submit it by today or tomorrow. So if possible @Rishi Gupta, @Henrik could you please reconsider assigning this bug to us.
If not then can you please point us towards other good first bugs related to python.
Thank you.
The plan we formulated:
https://imgur.com/a/yV0SKAI
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 103•5 years ago
|
||
(In reply to Kabeer Seth from comment #102)
We are a student group from a college. We had picked up this bug as part of our course project. We had to document the process by which we will fix this bug which is why we were late in submitting a patch. We have already created the whole schema for patching this bug and were actually going to submit it by today or tomorrow. So if possible @Rishi Gupta, @Henrik could you please reconsider assigning this bug to us.
If not then can you please point us towards other good first bugs related to python.
We have guidelines in how to handle mentored bugs. And as you can see a lot tries have been made before which all were not successful, or we never got reply from the person who wanted to fix it. So by default it's a first come, first serve policy, and the bug will be assigned to the person who uploads the patch at first. Please see my comment 101 which references two easy bugs to work on. Those are not exactly the same, but easy to implement. I hope that's still ok for you.
Assignee | ||
Comment 104•5 years ago
|
||
@whimboo resolved nits on D45958. Thanks
Reporter | ||
Comment 105•5 years ago
|
||
There was no reply by Kabeer in the last 8 days. So I think that we are fine in getting review for Rishi's patch, and get it landed once finished.
Comment 106•5 years ago
|
||
I didn't reply anything because I thought you have assigned it to Rishi and was trying to look and understand thew new bugs that you stated above, if you are allowing me to work on this I can submit a patch in 24 hours after you allow me to.
@Whimboo
Reporter | ||
Comment 107•5 years ago
|
||
Actually not for this bug anymore. The patch is close to be landed. Please reply on one of the other bugs in a timely manner if you want to work on it, and also supply a patch without a huge delay. Feel happy to ask on such a bug if something is unclear.
Comment 108•5 years ago
|
||
Comment 109•5 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•