@Issue("JENKINS-18641")
 @Test
 public void display() throws Exception {
   User.get("bob");
   JenkinsRule.WebClient wc = j.createWebClient();
   HtmlPage page;
   try {
     page = wc.goTo("asynchPeople");
   } catch (FailingHttpStatusCodeException x) {
     System.err.println(x.getResponse().getResponseHeaders());
     System.err.println(x.getResponse().getContentAsString());
     throw x;
   }
   assertEquals(0, wc.waitForBackgroundJavaScript(120000));
   boolean found = false;
   for (DomElement table : page.getElementsByTagName("table")) {
     if (table.getAttribute("class").contains("progress-bar")) {
       found = true;
       assertEquals("display: none;", table.getAttribute("style"));
       break;
     }
   }
   assertTrue(found);
   /* TODO this still fails occasionally, for reasons TBD (I think because User.getAll sometimes is empty):
   assertNotNull(page.getElementById("person-bob"));
   */
 }
Exemple #2
0
 @Issue("JENKINS-9367")
 @Test public void allImagesCanBeLoaded() throws Exception {
     User.get("user", true);
     WebClient webClient = j.createWebClient();
     webClient.setJavaScriptEnabled(false);
     j.assertAllImageLoadSuccessfully(webClient.goTo("asynchPeople"));
 }
Exemple #3
0
    @Test public void privateView() throws Exception {
        j.createFreeStyleProject("project1");
        User user = User.get("me", true); // create user

        WebClient wc = j.createWebClient();
        HtmlPage userPage = wc.goTo("user/me");
        HtmlAnchor privateViewsLink = userPage.getFirstAnchorByText("My Views");
        assertNotNull("My Views link not available", privateViewsLink);

        HtmlPage privateViewsPage = (HtmlPage) privateViewsLink.click();

        Text viewLabel = (Text) privateViewsPage.getFirstByXPath("//div[@class='tabBar']//div[@class='tab active']/a/text()");
        assertTrue("'All' view should be selected", viewLabel.getTextContent().contains(Hudson_ViewName()));

        View listView = listView("listView");

        HtmlPage newViewPage = wc.goTo("user/me/my-views/newView");
        HtmlForm form = newViewPage.getFormByName("createItem");
        form.getInputByName("name").setValueAttribute("proxy-view");
        ((HtmlRadioButtonInput) form.getInputByValue("hudson.model.ProxyView")).setChecked(true);
        HtmlPage proxyViewConfigurePage = j.submit(form);
        View proxyView = user.getProperty(MyViewsProperty.class).getView("proxy-view");
        assertNotNull(proxyView);
        form = proxyViewConfigurePage.getFormByName("viewConfig");
        form.getSelectByName("proxiedViewName").setSelectedAttribute("listView", true);
        j.submit(form);

        assertTrue(proxyView instanceof ProxyView);
        assertEquals(((ProxyView) proxyView).getProxiedViewName(), "listView");
        assertEquals(((ProxyView) proxyView).getProxiedView(), listView);
    }
Exemple #4
0
    @Test public void deleteView() throws Exception {
        WebClient wc = j.createWebClient();

        ListView v = listView("list");
        HtmlPage delete = wc.getPage(v, "delete");
        j.submit(delete.getFormByName("delete"));
        assertNull(j.jenkins.getView("list"));

        User user = User.get("user", true);
        MyViewsProperty p = user.getProperty(MyViewsProperty.class);
        v = new ListView("list", p);
        p.addView(v);
        delete = wc.getPage(v, "delete");
        j.submit(delete.getFormByName("delete"));
        assertNull(p.getView("list"));

    }