google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

HTML host page is not parsed correctly #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Set a HTML element in the host page with ID = 'container'

2. Try to get it : RootPanel.get("container").setVisible(b);

What is the expected output? What do you see instead?

NullPointerException : the corresponding HTML element is not retrieved from the 
host HTML page

The host HTML page should be parsed at the beginning of the test

Original issue reported on code.google.com by gael.laz...@gmail.com on 11 Jan 2011 at 4:54

GoogleCodeExporter commented 9 years ago
I've just commited en deploy a new snapshot (0.24-SNAPSHOT) with a fix to this.

To get the "container" element reference, you will have to override the 
AbstractConfigurableTest.getHostPagePath() method in your test class.

The path is retrieved by the classloader.getRessourceAsStream method.
So, for example, if your HTML host page is 'public/Application.html' and is 
located under com.octo.gwt.test.demo package, you will have to override the new 
method this way :

    @Override
    protected String getHostPagePath() {
        return "com/octo/gwt/test/demo/public/Application.html";
    }

Thank you for trying this out and give me some feedback :)

Original comment by gael.laz...@gmail.com on 24 Jan 2011 at 11:50

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 1 Mar 2011 at 4:49

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 1 Mar 2011 at 4:49

GoogleCodeExporter commented 9 years ago
Hey Gael,

I am getting an error when using this.

I think it has to do with Style declarations. Do you need to parse the styles?

Also, my index.html is in my webapp folder is it possible to reference it there?

Thanks, A

Original comment by aodhag...@gmail.com on 28 Mar 2011 at 5:05

Attachments:

GoogleCodeExporter commented 9 years ago
Style attributes of your hostpage are parsed. But I could not reproduce the 
null value for a style, even when writing "<div style=>" or "<div style>" 

Could you please submit your index.html ?

You can put your module hostpage anywhere you want as soon as it is included in 
the test classpath.
For example, my Application.html file is under 
"src/main/resources/com/octo/gwt/test/demo/public/Application.html".
In your test classes, just override the getHostPagePath() method like this :

    @Override
    protected String getHostPagePath() {
        return "com/octo/gwt/test/demo/public/Application.html";
    }

Original comment by gael.laz...@gmail.com on 28 Mar 2011 at 5:36

GoogleCodeExporter commented 9 years ago
Hey Gael, 

I've attached my index.html. It worked when I removed the style section at the 
top.

Thanks A

Original comment by aodhag...@gmail.com on 29 Mar 2011 at 10:37

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I finally was able to reproduce the problem with a <style> markup in the 
head section, and fix it on the trunk.

Could you please checkout the lastest modifications and try it again ?

Original comment by gael.laz...@gmail.com on 29 Mar 2011 at 9:26

GoogleCodeExporter commented 9 years ago
I can confirm that my issue was fixed. Thanks A

Original comment by aodhag...@gmail.com on 30 Mar 2011 at 9:47

GoogleCodeExporter commented 9 years ago
Thanks again ;-)

Original comment by gael.laz...@gmail.com on 30 Mar 2011 at 9:52

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 9 Jun 2011 at 3:15