Bug 344344 - [client] [textmatestyler] Run textMateStyler unit tests in the build
Summary: [client] [textmatestyler] Run textMateStyler unit tests in the build
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Editor (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.5 M1   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on: 337160
Blocks:
  Show dependency tree
 
Reported: 2011-04-29 16:11 EDT by Mark Macdonald CLA
Modified: 2012-03-01 23:15 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2011-04-29 16:11:53 EDT
0.2 M7

Unit tests in /js-tests/textMateStyler/test.html are failing during the build in some browsers.
Comment 1 Mark Macdonald CLA 2011-04-29 16:13:05 EDT
Firefox 4:

FAILURE][test TextMateStyler create TextMateStyler][TypeError: style is null] ([object HTMLDivElement])
  @http://localhost:8080/editor/js/editor.js:3238 ()
  @http://localhost:8080/editor/js/editor.js:2557 ([object Object])
  @http://localhost:8080/editor/js/editor.js:3773 Editor([object Object])
  @http://localhost:8080/editor/js/editor.js:267 createEditor()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:26 ()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:39 _run("",[object Object])
  @http://localhost:8080/file/C/static/js/test.js:67 ()
  @http://localhost:8080/file/C/static/js/test.js:190 _handleRequest("request[http://localhost:8080/file/C/static/js-tests/textMateStyler/test.html]",[object Object],(void 0))
  @http://localhost:8080/file/C/static/js/plugin.js:76 ([object Object])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:788 _ec([object MessageEvent])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:1114

[FAILURE][test TextMateStyler style one line][TypeError: style is null] ([object HTMLDivElement])
  @http://localhost:8080/editor/js/editor.js:3238 ()
  @http://localhost:8080/editor/js/editor.js:2557 ([object Object])
  @http://localhost:8080/editor/js/editor.js:3773 Editor([object Object])
  @http://localhost:8080/editor/js/editor.js:267 createEditor()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:26 ()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:39 _run("",[object Object])
  @http://localhost:8080/file/C/static/js/test.js:67 ()
  @http://localhost:8080/file/C/static/js/test.js:190 _handleRequest("request[http://localhost:8080/file/C/static/js-tests/textMateStyler/test.html]",[object Object],(void 0))
  @http://localhost:8080/file/C/static/js/plugin.js:76 ([object Object])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:788 _ec([object MessageEvent])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:1114

[FAILURE][test TextMateStyler style multiple lines][TypeError: style is null] ([object HTMLDivElement])
  @http://localhost:8080/editor/js/editor.js:3238 ()
  @http://localhost:8080/editor/js/editor.js:2557 ([object Object])
  @http://localhost:8080/editor/js/editor.js:3773 Editor([object Object])
  @http://localhost:8080/editor/js/editor.js:267 createEditor()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:26 ()
  @http://localhost:8080/file/C/static/js-tests/textMateStyler/testcase.js:39 _run("",[object Object])
  @http://localhost:8080/file/C/static/js/test.js:67 ()
  @http://localhost:8080/file/C/static/js/test.js:190 _handleRequest("request[http://localhost:8080/file/C/static/js-tests/textMateStyler/test.html]",[object Object],(void 0))
  @http://localhost:8080/file/C/static/js/plugin.js:76 ([object Object])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:788 _ec([object MessageEvent])
  @http://localhost:8080/openajax/release/all/OpenAjaxManagedHub-all.js:1114
Comment 2 Mark Macdonald CLA 2011-04-29 16:14:02 EDT
Internet Explorer 9:

LOG: [FAILURE][test TextMateStyler style one line][TypeError: Unable to get value of the property 'lineIndex': object is null or undefined]
 
LOG: [FAILURE][test TextMateStyler style multiple lines][TypeError: Unable to get value of the property 'lineIndex': object is null or undefined]
Comment 3 Mark Macdonald CLA 2011-04-29 16:25:30 EDT
Firefox 3.6 also fails with similar errors as FF4
Comment 4 Simon Kaegi CLA 2011-04-29 16:50:30 EDT
From my debugging in FF4 what I saw was that a call to getComputedStyle that looked ok was not working as expected. My bet is that this problem is specific to how we're running the tests and is occurring because we're running the test before the DOMContentLoaded event has fired. We need to track this and fix it for M8 but I don't think this is a blocker for M7.
Comment 5 John Arthorne CLA 2011-05-10 09:04:31 EDT
These tests have now been failing for nearly two weeks. If you believe this is a problem in the tests can you please disable the test until the problem is sorted out? It's hard for people to have confidence taking our builds if they are always failing.
Comment 6 Mark Macdonald CLA 2011-05-10 09:18:22 EDT
(In reply to comment #5)
They are disabled now.
Comment 7 Mark Macdonald CLA 2011-05-10 11:07:39 EDT
(In reply to comment #4)
> From my debugging in FF4 what I saw was that a call to getComputedStyle that
> looked ok was not working as expected. My bet is that this problem is specific
> to how we're running the tests and is occurring because we're running the test
> before the DOMContentLoaded event has fired. 

The problem seems to be that because the tests are run in a plugin, the editor gets created inside an iframe with "display:none". This causes getComputedStyle calls inside the editor to return undefined. I noticed that if you change pluginregistry.js to use display:"block" on the IframeContainer instead of "none", the tests pass.

Although IE throws different errors, the cause is the same.
Comment 8 Felipe Heidrich CLA 2011-11-01 13:37:59 EDT
This problem is very serious to editor component.
We can't port the editor unit tests to the orion test framework because of this bug.


Simon, any ideas how to fix this problem ?

Could you use display:block plus position:fixed;top=-1000px instead of display:none ?
this way the iframe would still be invisible but the CSS part would work.
(note that it still not ideal for ui test not to be able to see the component being tested but better than the current situation)
Comment 9 Mark Macdonald CLA 2012-03-01 18:04:48 EST
I added a 'MockTextView' test class that mimics the TextView API but does not touch the DOM. The tests now use this instead, so they will work during the build. I plan on using this mock class to test other stylers (CodeMirror) as well.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=6aaecc01c54af1d2810066ee1f8177984b6b6b9b

Added the tests to the jsTestSuite, marking fixed...
Comment 10 Simon Kaegi CLA 2012-03-01 23:15:48 EST
That's a great idea.
I think we really still need to figure out a better way to handle tests that require the browser to be shown however this is fine approach and I bet other portions of Orion could re-use this.