Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sergey.pensov
authored and
sergey.pensov
committed
Nov 27, 2014
1 parent
c55bce8
commit e4015a7
Showing
12 changed files
with
281 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
OpenFacesWebDriverInspector/OpenFacesWebDriverInspector.iml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="selenide" level="project" /> | ||
<orderEntry type="library" name="selenium-webDriver" level="project" /> | ||
</component> | ||
</module> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
89 changes: 89 additions & 0 deletions
89
webDriverFuncTests/source/org/openfaces/test/AjaxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* OpenFaces - JSF Component Library 3.0 | ||
* Copyright (C) 2007-2014, TeamDev Ltd. | ||
* licensing@openfaces.org | ||
* Unless agreed in writing the contents of this file are subject to | ||
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License). | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* Please visit http://openfaces.org/licensing/ for more details. | ||
*/ | ||
package org.openfaces.test; | ||
|
||
import com.thoughtworks.selenium.DefaultSelenium; | ||
import com.thoughtworks.selenium.Selenium; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.openfaces.test.componentInspector.Element; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.firefox.FirefoxDriver; | ||
import org.openqa.selenium.server.SeleniumServer; | ||
|
||
import static com.codeborne.selenide.Selenide.*; | ||
import static com.codeborne.selenide.Condition.*; | ||
import static com.codeborne.selenide.Selenide.open; | ||
import static com.thoughtworks.selenium.SeleneseTestBase.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Tatyana Matveyeva | ||
*/ | ||
public class AjaxTest extends WebDriverSeleniumTestCase { | ||
private DefaultSelenium localhost; | ||
private SeleniumServer seleniumServer; | ||
private WebDriver driver; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
// localhost = new DefaultSelenium("localhost", 4444, "*chrome", "http://openfaces.org.test"); | ||
seleniumServer = new SeleniumServer(); | ||
seleniumServer.start(); | ||
driver = new FirefoxDriver(); | ||
// localhost.start(); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
seleniumServer.stop(); | ||
} | ||
|
||
|
||
//All DataTable features, that use Ajax is Tested on the demo (DataTable_general.jsf) | ||
@Test | ||
public void testFoldingPanelAjax() throws Exception { | ||
open("/components/foldingpanel/foldingPanelAjax.jsf"); | ||
assertFalse(element("form1:Output").isElementInPage()); | ||
foldingPanel("form1:fp1").toggle(); | ||
assertTrue(element("form1:output1").isElementInPage()); | ||
assertTrue(element("form1:input1").isElementInPage()); | ||
|
||
} | ||
|
||
@Test | ||
public void testTabbedPaneAjax() throws Exception { | ||
open("/components/tabbedpane/tabbedPaneAjax.jsf"); | ||
Element tab1Output = element("form1:tab1Output"); | ||
assertTrue(tab1Output.isElementInPage()); | ||
Element tab2Output = element("form1:tab2Output"); | ||
assertFalse(tab2Output.isElementInPage()); | ||
Element tab3Output = element("form1:tab3Output"); | ||
assertFalse(tab3Output.isElementInPage()); | ||
Element tab4Output = element("form1:tab4Output"); | ||
assertFalse(tab4Output.isElementInPage()); | ||
List<Element> tabs = tabbedPane("form1:tp1").tabSet().getTabs(); | ||
/* tabs.get(1).clickAndWait(OpenFacesAjaxLoadingMode.getInstance()); | ||
tab2Output.assertElementExists(true); | ||
tabs.get(2).clickAndWait(OpenFacesAjaxLoadingMode.getInstance()); | ||
tab3Output.assertElementExists(true); | ||
tabs.get(3).clickAndWait(OpenFacesAjaxLoadingMode.getInstance()); | ||
tab4Output.assertElementExists(true); | ||
tabs.get(0).click(); | ||
tab1Output.assertElementExists(true);*/ | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
webDriverFuncTests/source/org/openfaces/test/componentInspector/Element.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.openfaces.test.componentInspector;/* | ||
* OpenFaces - JSF Component Library 3.0 | ||
* Copyright (C) 2007-2014, TeamDev Ltd. | ||
* licensing@openfaces.org | ||
* Unless agreed in writing the contents of this file are subject to | ||
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License). | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* Please visit http://openfaces.org/licensing/ for more details. | ||
*/ | ||
|
||
import org.openfaces.test.WebDriverSeleniumTestCase; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
/** | ||
* Author: SergeyPensov@teamdev.com | ||
*/ | ||
public class Element extends WebDriverSeleniumTestCase { | ||
private String locator; | ||
|
||
public Element(String id) { | ||
this.locator = id; | ||
} | ||
|
||
public String getId() { | ||
return locator; | ||
} | ||
|
||
public boolean isElementInPage(){ | ||
try{ | ||
driver.findElements(By.id(locator)); | ||
return true; | ||
}catch (Exception e){ | ||
return false; | ||
} | ||
} | ||
|
||
public String toString() { | ||
return "elementByLocator[" + locator + "]"; | ||
} | ||
|
||
public void click(){ | ||
$(this.locator).click(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
webDriverFuncTests/source/org/openfaces/test/componentInspector/FoldingPanelInspector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* OpenFaces - JSF Component Library 3.0 | ||
* Copyright (C) 2007-2014, TeamDev Ltd. | ||
* licensing@openfaces.org | ||
* Unless agreed in writing the contents of this file are subject to | ||
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License). | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* Please visit http://openfaces.org/licensing/ for more details. | ||
*/ | ||
|
||
package org.openfaces.test.componentInspector; | ||
|
||
/** | ||
* Author: SergeyPensov@teamdev.com | ||
*/ | ||
public class FoldingPanelInspector extends Element { | ||
|
||
private static final String TOGGLE_SUF ="--_defaultButtonsArea--toggle"; | ||
public FoldingPanelInspector(String id) { | ||
super(id); | ||
} | ||
public void toggle(){ | ||
if(isElementInPage()){ | ||
Element toggleButton = new Element(this.getId()+TOGGLE_SUF); | ||
toggleButton.click(); | ||
} | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
webDriverFuncTests/source/org/openfaces/test/componentInspector/TabSetInspector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* OpenFaces - JSF Component Library 3.0 | ||
* Copyright (C) 2007-2014, TeamDev Ltd. | ||
* licensing@openfaces.org | ||
* Unless agreed in writing the contents of this file are subject to | ||
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License). | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* Please visit http://openfaces.org/licensing/ for more details. | ||
*/ | ||
|
||
package org.openfaces.test.componentInspector; | ||
|
||
import org.openqa.selenium.By; | ||
|
||
import java.util.AbstractList; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
/** | ||
* Author: SergeyPensov@teamdev.com | ||
*/ | ||
public class TabSetInspector extends Element { | ||
public TabSetInspector(String id) { | ||
super(id); | ||
} | ||
|
||
public List<Element> getTabs() { | ||
int i = 0; | ||
List<Element> tabs = new LinkedList<Element>(); | ||
while (true) { | ||
Element tab = new Element(this.getId() + "::" + i); | ||
if ( !tab.isElementInPage()) | ||
break; | ||
tabs.add(tab); | ||
|
||
} | ||
return tabs; | ||
|
||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
webDriverFuncTests/source/org/openfaces/test/componentInspector/TabbedPaneInspector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* OpenFaces - JSF Component Library 3.0 | ||
* Copyright (C) 2007-2014, TeamDev Ltd. | ||
* licensing@openfaces.org | ||
* Unless agreed in writing the contents of this file are subject to | ||
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License). | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* Please visit http://openfaces.org/licensing/ for more details. | ||
*/ | ||
|
||
package org.openfaces.test.componentInspector; | ||
|
||
/** | ||
* Author: SergeyPensov@teamdev.com | ||
*/ | ||
public class TabbedPaneInspector extends Element { | ||
public TabbedPaneInspector(String id) { | ||
super(id); | ||
} | ||
public TabSetInspector tabSet() { | ||
return new TabSetInspector(this.getId() + "--tabSet"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters