Search in sources :

Example 1 with HtmlInlineFrame

use of com.gargoylesoftware.htmlunit.html.HtmlInlineFrame in project htmlpublisher-plugin by jenkinsci.

the class HtmlFileNameTest method fileNameWithSpecialCharactersAndMultipleSlashes.

@Test
public void fileNameWithSpecialCharactersAndMultipleSlashes() throws Exception {
    final String content = "<html><head><title>test</title></head><body>Hello world!</body></html>";
    FreeStyleProject job = j.createFreeStyleProject();
    job.getBuildersList().add(new CreateFileBuilder("subdir/subdir2/#$&+,;= @.html", content));
    job.getPublishersList().add(new HtmlPublisher(Arrays.asList(new HtmlPublisherTarget("report-name", "", "subdir/subdir2/*.html", true, true, false))));
    job.save();
    j.buildAndAssertSuccess(job);
    JenkinsRule.WebClient client = j.createWebClient();
    assertEquals(content, client.getPage(job, "report-name/subdir/subdir2/%23%24%26%2B%2C%3B%3D%20%40.html").getWebResponse().getContentAsString());
    // published html page(s)
    HtmlPage page = client.getPage(job, "report-name");
    HtmlInlineFrame iframe = (HtmlInlineFrame) page.getElementById("myframe");
    assertEquals("subdir/subdir2/%23%24%26%2B%2C%3B%3D%20%40.html", iframe.getAttribute("src"));
    HtmlPage pageInIframe = (HtmlPage) iframe.getEnclosedPage();
    assertEquals("Hello world!", pageInIframe.getBody().asNormalizedText());
}
Also used : CreateFileBuilder(org.jvnet.hudson.test.CreateFileBuilder) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) JenkinsRule(org.jvnet.hudson.test.JenkinsRule) FreeStyleProject(hudson.model.FreeStyleProject) HtmlInlineFrame(com.gargoylesoftware.htmlunit.html.HtmlInlineFrame) Test(org.junit.Test)

Example 2 with HtmlInlineFrame

use of com.gargoylesoftware.htmlunit.html.HtmlInlineFrame in project htmlpublisher-plugin by jenkinsci.

the class HtmlFileNameTest method fileNameWithSpecialCharactersAndSingleSlash.

@Test
public void fileNameWithSpecialCharactersAndSingleSlash() throws Exception {
    final String content = "<html><head><title>test</title></head><body>Hello world!</body></html>";
    FreeStyleProject job = j.createFreeStyleProject();
    job.getBuildersList().add(new CreateFileBuilder("subdir/#$&+,;= @.html", content));
    job.getPublishersList().add(new HtmlPublisher(Arrays.asList(new HtmlPublisherTarget("report-name", "", "subdir/*.html", true, true, false))));
    job.save();
    j.buildAndAssertSuccess(job);
    JenkinsRule.WebClient client = j.createWebClient();
    assertEquals(content, client.getPage(job, "report-name/subdir/%23%24%26%2B%2C%3B%3D%20%40.html").getWebResponse().getContentAsString());
    // published html page(s)
    HtmlPage page = client.getPage(job, "report-name");
    HtmlInlineFrame iframe = (HtmlInlineFrame) page.getElementById("myframe");
    assertEquals("subdir/%23%24%26%2B%2C%3B%3D%20%40.html", iframe.getAttribute("src"));
    HtmlPage pageInIframe = (HtmlPage) iframe.getEnclosedPage();
    assertEquals("Hello world!", pageInIframe.getBody().asNormalizedText());
}
Also used : CreateFileBuilder(org.jvnet.hudson.test.CreateFileBuilder) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) JenkinsRule(org.jvnet.hudson.test.JenkinsRule) FreeStyleProject(hudson.model.FreeStyleProject) HtmlInlineFrame(com.gargoylesoftware.htmlunit.html.HtmlInlineFrame) Test(org.junit.Test)

Aggregations

HtmlInlineFrame (com.gargoylesoftware.htmlunit.html.HtmlInlineFrame)2 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)2 FreeStyleProject (hudson.model.FreeStyleProject)2 Test (org.junit.Test)2 CreateFileBuilder (org.jvnet.hudson.test.CreateFileBuilder)2 JenkinsRule (org.jvnet.hudson.test.JenkinsRule)2