Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
tests for r:tabPanel fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ppitonak committed Jul 9, 2014
1 parent 3d78c87 commit 0c3e9ff
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
Expand Up @@ -35,7 +35,7 @@ public void check_tab_switch(WebElement tabPanel, List<WebElement> tabs, WebElem
guardAjax(tabs.get(0)).click();
Assert.assertEquals("content of tab 0", getTabContent(tabPanel).getText());

WebElement removeLink =tabs.get(6).findElement(By.tagName("a"));
WebElement removeLink = tabs.get(6).findElement(By.tagName("a"));
guardAjax(removeLink).click();
Assert.assertEquals(6, tabs.size());
}
Expand Down
Expand Up @@ -32,7 +32,7 @@ public class ITForEachTab {
@FindBy(id = "myForm:tabPanel")
private WebElement tabPanel;

@FindBy(className = "rf-tab-hdr-inact")
@FindBy(className = "rf-tab-hdr")
private List<WebElement> tabs;

@FindBy(id = "myForm:a4jCreateTabButton")
Expand Down
Expand Up @@ -35,7 +35,7 @@ public class ITRepeatTab {
@FindBy(id = "myForm:tabPanel")
private WebElement tabPanel;

@FindBy(className = "rf-tab-hdr-inact")
@FindBy(className = "rf-tab-hdr")
private List<WebElement> tabs;

@FindBy(id = "myForm:a4jCreateTabButton")
Expand Down
@@ -1,6 +1,7 @@
package org.richfaces.component.tabPanel;

import static org.jboss.arquillian.graphene.Graphene.guardAjax;
import static org.jboss.arquillian.graphene.Graphene.guardNoRequest;

import java.net.URL;
import java.util.List;
Expand Down Expand Up @@ -41,11 +42,8 @@ public class ITStaticTab {
@FindBy(id = "myForm:tabPanel")
private WebElement tabPanel;

@FindBy(className = "rf-tab-hdr-inact")
private List<WebElement> inactiveHeaders;

@FindBy(className = "rf-tab-hdr-act")
private List<WebElement> activeHeaders;
@FindBy(className = "rf-tab-hdr")
private List<WebElement> headers;

@FindBy(id = "out")
private WebElement out;
Expand Down Expand Up @@ -75,14 +73,14 @@ public static WebArchive createDeployment() {
}

/**
* RF-12839
* {@link https://issues.jboss.org/browse/RF-12839}
*/
@Test
@Category(Smoke.class)
public void check_tab_switch() {
browser.get(contextPath.toExternalForm() + "index.jsf");

guardAjax(inactiveHeaders.get(1)).click();
guardAjax(headers.get(1)).click();
Assert.assertTrue(out.getText().contains("begin"));
// Assert.assertTrue(out.getText().contains("tabpanel_complete"));
// Assert.assertTrue(out.getText().contains("beforedomupdate"));
Expand All @@ -93,13 +91,13 @@ public void check_tab_switch() {
}

/**
* RF-12969
* {@link https://issues.jboss.org/browse/RF-12969}
*/
@Test
public void check_click_active_tab() {
browser.get(contextPath.toExternalForm() + "index.jsf");
WebElement activeTab = tabTestHelper.getActiveTab(tabPanel);
guardAjax(activeTab).click();
guardNoRequest(activeTab).click();
Assert.assertEquals(null, body.getAttribute("JSError"));
}

Expand All @@ -108,19 +106,28 @@ public void check_tab_execute() {
browser.get(contextPath.toExternalForm() + "index.jsf");

inputText.sendKeys("abcd");
guardAjax(inactiveHeaders.get(1)).click();
guardAjax(headers.get(1)).click();
Assert.assertEquals("abcd", outputText.getText());
}

/**
* {@link https://issues.jboss.org/browse/RF-13278}
* {@link https://issues.jboss.org/browse/RF-13687}
*/
@Test
public void check_header_render() {

This comment has been minimized.

Copy link
@jhuska

jhuska Jul 9, 2014

Contributor

in this comment I am describing why I think whether failure of this test is a bug.
https://issues.jboss.org/browse/RF-13687?focusedCommentId=12983586&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12983586

Feedback is appreciated.

browser.get(contextPath.toExternalForm() + "header.jsf");
Assert.assertEquals("0 clicks", inactiveHeaders.get(1).findElement(By.className("rf-tab-lbl")).getText());
guardAjax(activeHeaders.get(0)).click();
Assert.assertEquals("1 clicks", inactiveHeaders.get(1).findElement(By.className("rf-tab-lbl")).getText());
Assert.assertEquals("0 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(1)).click();
guardAjax(headers.get(0)).click();
Assert.assertEquals("1 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(1)).click();
Assert.assertEquals("1 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(0)).click();
Assert.assertEquals("2 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());
}

/**
Expand All @@ -129,9 +136,17 @@ public void check_header_render() {
@Test
public void check_header_button_render() {
browser.get(contextPath.toExternalForm() + "headerButton.jsf");
Assert.assertEquals("0 clicks", inactiveHeaders.get(1).findElement(By.className("rf-tab-lbl")).getText());
guardAjax(activeHeaders.get(0).findElement(By.className("button"))).click();
Assert.assertEquals("1 clicks", inactiveHeaders.get(1).findElement(By.className("rf-tab-lbl")).getText());
Assert.assertEquals("0 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(0).findElement(By.className("button"))).click();
Assert.assertEquals("1 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(1)).click();
guardAjax(headers.get(0)).click();
Assert.assertEquals("1 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());

guardAjax(headers.get(0).findElement(By.className("button"))).click();
Assert.assertEquals("2 clicks", headers.get(1).findElement(By.className("rf-tab-lbl")).getText());
}


Expand All @@ -149,12 +164,12 @@ private static void addIndexPage(UIDeployment deployment) {
p.body(" onbeforedomupdate='$(\"#out\").append(\"beforedomupdate \\n\")'>");
p.body(" <rich:tab id='tab0' name='tab0' header='tab0 header' ");
p.body(" oncomplete='$(\"#out\").append(\"tab0_complete \\n\")'>");
p.body(" content of tab 1");
p.body(" content of tab 0");
p.body(" </rich:tab>");
p.body(" <rich:tab id='tab1' name='tab1' header='tab1 header' ");
p.body(" execute='inputText'");
p.body(" oncomplete='$(\"#out\").append(\"tab1_complete \\n\")'>");
p.body(" content of tab 2");
p.body(" content of tab 1");
p.body(" <h:outputText id = 'outputText' value='#{simpleBean.string}' />");
p.body(" </rich:tab>");
p.body("</rich:tabPanel> ");
Expand All @@ -168,21 +183,21 @@ private static void addIndexPage(UIDeployment deployment) {
private static void addHeaderPage(UIDeployment deployment) {
FaceletAsset p = new FaceletAsset();
p.body("<h:form id='myForm'>");
p.body("<rich:tabPanel id='tabPanel' >");
p.body("<rich:tabPanel id='tabPanel'>");
p.body(" <rich:tab id='tab0' name='tab0' "); // header='tab0 header' ");
p.body(" action='#{simpleBean.incrementCount()}' ");
p.body(" render='tabPanel@header'> ");
p.body(" <f:facet name='header'> ");
p.body(" Click Me ");
p.body(" </f:facet> ");
p.body(" content of tab 1");
p.body(" content of tab 0");
p.body(" </rich:tab>");
p.body(" <rich:tab id='tab1'>");
p.body(" <f:facet name='header'> ");
p.body(" <h:outputText id='label' value='#{simpleBean.count} clicks' /> ");
p.body(" </f:facet> ");
p.body(" content of tab 2");
p.body(" <h:outputText id = 'outputText' value='#{simpleBean.string}' />");
p.body(" content of tab 1");
p.body(" <h:outputText id='outputText' value='#{simpleBean.string}' />");
p.body(" </rich:tab>");
p.body("</rich:tabPanel> ");
p.body("</h:form>");
Expand All @@ -195,21 +210,22 @@ private static void addHeaderButtonPage(UIDeployment deployment) {
p.body("<h:form id='myForm'>");
p.body("<rich:tabPanel id='tabPanel' >");
p.body(" <rich:tab id='tab0' name='tab0'> "); // header='tab0 header' ");
p.body(" <f:facet name='header'> ");
p.body(" <f:facet name='header'>");
p.body(" Tab 0 ");
p.body(" <a4j:commandLink value='click me' ");
p.body(" styleClass='button' ");
p.body(" action='#{simpleBean.incrementCount()}' ");
p.body(" render='label' ");
p.body(" oncomplete='return false;' ");
p.body(" execute='@this' /> ");
p.body(" </f:facet> ");
p.body(" content of tab 1");
p.body(" content of tab 0");
p.body(" </rich:tab>");
p.body(" <rich:tab id='tab1'>");
p.body(" <f:facet name='header'> ");
p.body(" <h:outputText id='label' value='#{simpleBean.count} clicks' /> ");
p.body(" </f:facet> ");
p.body(" content of tab 2");
p.body(" content of tab 1");
p.body(" <h:outputText id = 'outputText' value='#{simpleBean.string}' />");
p.body(" </rich:tab>");
p.body("</rich:tabPanel> ");
Expand Down
Expand Up @@ -23,14 +23,14 @@

import java.io.Serializable;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
* @author <a href="http://community.jboss.org/people/bleathem">Brian Leathem</a>
*/
@Named
@RequestScoped
@ManagedBean
@ViewScoped
public class SimpleBean implements Serializable {
private static final long serialVersionUID = 1L;

Expand All @@ -56,5 +56,4 @@ public void setCount(Integer count) {
public void incrementCount() {
count++;
}

}

0 comments on commit 0c3e9ff

Please sign in to comment.