Revision a740abba
Added by Andreas Kohlbecker almost 13 years ago
.gitattributes | ||
---|---|---|
250 | 250 |
modules/cdm_dataportal/site/site.xml -text |
251 | 251 |
modules/cdm_dataportal/test/TestSuite-search.html -text |
252 | 252 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/pom.xml -text |
253 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/Browser.java -text |
|
253 | 254 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java -text |
254 | 255 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContextAwareRunner.java -text |
255 | 256 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalManager.java -text |
257 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/resources/log4j.properties -text |
|
256 | 258 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/CdmDataPortalSeleniumRCTestBase.java -text |
257 | 259 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/CdmDataPortalTestBase.java -text |
258 | 260 |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/ExampleTest.java -text |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/pom.xml | ||
---|---|---|
70 | 70 |
<scope>test</scope> |
71 | 71 |
</dependency> |
72 | 72 |
<dependency> |
73 |
<!-- used for executing drush commnads --> |
|
74 |
<groupId>org.apache.commons</groupId> |
|
75 |
<artifactId>commons-exec</artifactId> |
|
76 |
<version>1.1</version> |
|
73 |
<groupId>log4j</groupId> |
|
74 |
<artifactId>log4j</artifactId> |
|
75 |
<version>1.2.16</version> |
|
77 | 76 |
</dependency> |
78 | 77 |
<!-- |
79 | 78 |
selenium 2 webdriver, see |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/Browser.java | ||
---|---|---|
1 |
package eu.etaxonomy.dataportal; |
|
2 |
|
|
3 |
public enum Browser { |
|
4 |
|
|
5 |
firefox, |
|
6 |
iexplorer, |
|
7 |
chrome; |
|
8 |
|
|
9 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
1 | 10 |
package eu.etaxonomy.dataportal; |
2 | 11 |
|
3 | 12 |
import java.net.URI; |
4 | 13 |
import java.net.URISyntaxException; |
5 | 14 |
import java.util.UUID; |
6 | 15 |
|
16 |
import org.apache.log4j.Logger; |
|
17 |
|
|
7 | 18 |
public enum DataPortalContext { |
8 |
|
|
9 |
cichorieae( |
|
10 |
"http://160.45.63.201/dataportal/preview/cichorieae/", |
|
11 |
"http://127.0.0.1:8080", |
|
12 |
"534e190f-3339-49ba-95d9-fa27d5493e3e"), |
|
13 |
palmae( |
|
19 |
|
|
20 |
cichorieae("http://160.45.63.201/dataportal/preview/cichorieae/", |
|
21 |
"http://127.0.0.1:8080", "534e190f-3339-49ba-95d9-fa27d5493e3e"), palmae( |
|
14 | 22 |
"http://160.45.63.201/dataportal/preview/palmae/", |
15 |
"http://127.0.0.1:8080", |
|
16 |
"534e190f-3339-49ba-95d9-fa27d5493e3e");
|
|
17 |
//floraMalesiana; |
|
18 |
|
|
23 |
"http://127.0.0.1:8080", "534e190f-3339-49ba-95d9-fa27d5493e3e");
|
|
24 |
// floraMalesiana;
|
|
25 |
|
|
26 |
|
|
19 | 27 |
URI baseUri; |
20 | 28 |
URI cdmServerUri; |
21 | 29 |
UUID classificationUUID; |
22 | 30 |
String themeName; |
23 | 31 |
|
24 |
|
|
25 | 32 |
private DataPortalContext(String baseUri, String cdmServerUri, |
26 | 33 |
String classificationUUID) { |
27 | 34 |
try { |
... | ... | |
37 | 44 |
this.classificationUUID = UUID.fromString(classificationUUID); |
38 | 45 |
} |
39 | 46 |
|
40 |
|
|
41 | 47 |
public URI getBaseUri() { |
42 | 48 |
return baseUri; |
43 | 49 |
} |
44 | 50 |
|
45 |
|
|
46 | 51 |
public URI getCdmServerUri() { |
47 | 52 |
return cdmServerUri; |
48 | 53 |
} |
49 | 54 |
|
50 |
|
|
51 | 55 |
public UUID getClassificationUUID() { |
52 | 56 |
return classificationUUID; |
53 | 57 |
} |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
58 | 59 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContextAwareRunner.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
1 | 10 |
package eu.etaxonomy.dataportal; |
2 | 11 |
|
3 | 12 |
import java.lang.annotation.ElementType; |
... | ... | |
15 | 24 |
import org.junit.runners.model.Statement; |
16 | 25 |
|
17 | 26 |
public class DataPortalContextAwareRunner extends BlockJUnit4ClassRunner { |
18 |
|
|
19 | 27 |
|
20 | 28 |
@Retention(RetentionPolicy.RUNTIME) |
21 | 29 |
@Target(ElementType.TYPE) |
22 | 30 |
@Inherited |
23 | 31 |
public @interface DataPortalContexts { |
24 | 32 |
/** |
25 |
* @return an array of DataPortalContext to which the annotated test class is applicable |
|
33 |
* @return an array of DataPortalContext to which the annotated test |
|
34 |
* class is applicable |
|
26 | 35 |
*/ |
27 | 36 |
DataPortalContext[] value(); |
28 | 37 |
} |
29 |
|
|
30 |
private DataPortalContext dataPortalContext;
|
|
31 |
|
|
38 |
|
|
39 |
private DataPortalContext dataPortalContext; |
|
40 |
|
|
32 | 41 |
public DataPortalContextAwareRunner(Class<?> klass) |
33 | 42 |
throws InitializationError { |
34 | 43 |
super(klass); |
35 | 44 |
dataPortalContext = DataPortalManager.currentDataPortalContext(); |
36 | 45 |
} |
37 |
|
|
46 |
|
|
38 | 47 |
@Override |
39 | 48 |
public void run(final RunNotifier notifier) { |
40 |
EachTestNotifier testNotifier= new EachTestNotifier(notifier, |
|
49 |
EachTestNotifier testNotifier = new EachTestNotifier(notifier,
|
|
41 | 50 |
getDescription()); |
42 |
|
|
51 |
|
|
43 | 52 |
boolean isApplicableToContext = false; |
44 |
DataPortalContexts dataPortalContextsAnotation = getTestClass().getJavaClass().getAnnotation(DataPortalContexts.class); |
|
45 |
for(DataPortalContext cntxt : dataPortalContextsAnotation.value()){ |
|
46 |
if(dataPortalContext.equals(cntxt)){ |
|
53 |
DataPortalContexts dataPortalContextsAnotation = getTestClass() |
|
54 |
.getJavaClass().getAnnotation(DataPortalContexts.class); |
|
55 |
for (DataPortalContext cntxt : dataPortalContextsAnotation.value()) { |
|
56 |
if (dataPortalContext.equals(cntxt)) { |
|
47 | 57 |
isApplicableToContext = true; |
48 | 58 |
} |
49 | 59 |
} |
50 |
|
|
51 |
if(!isApplicableToContext){
|
|
60 |
|
|
61 |
if (!isApplicableToContext) {
|
|
52 | 62 |
testNotifier.fireTestIgnored(); |
53 | 63 |
return; |
54 | 64 |
} |
55 |
|
|
65 |
|
|
56 | 66 |
try { |
57 |
Statement statement= classBlock(notifier); |
|
67 |
Statement statement = classBlock(notifier);
|
|
58 | 68 |
statement.evaluate(); |
59 | 69 |
} catch (AssumptionViolatedException e) { |
60 | 70 |
testNotifier.fireTestIgnored(); |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalManager.java | ||
---|---|---|
1 |
// $Id$ |
|
1 | 2 |
/** |
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
2 | 6 |
* |
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
3 | 9 |
*/ |
4 | 10 |
package eu.etaxonomy.dataportal; |
5 | 11 |
|
... | ... | |
7 | 13 |
|
8 | 14 |
/** |
9 | 15 |
* @author a.kohlbecker |
10 |
* |
|
16 |
*
|
|
11 | 17 |
*/ |
12 | 18 |
public class DataPortalManager { |
13 |
|
|
19 |
|
|
14 | 20 |
static DataPortalManager managerInstance = null; |
15 |
|
|
21 |
|
|
16 | 22 |
private DataPortalContext currentDataPortalContext = cichorieae; |
17 |
|
|
23 |
|
|
18 | 24 |
public static void prepare() { |
19 |
if(managerInstance == null){
|
|
25 |
if (managerInstance == null) {
|
|
20 | 26 |
managerInstance = new DataPortalManager(); |
21 | 27 |
managerInstance.setupDataPortal(); |
22 | 28 |
} |
23 | 29 |
} |
24 |
|
|
25 |
public static DataPortalContext currentDataPortalContext(){ |
|
30 |
|
|
31 |
public static DataPortalContext currentDataPortalContext() {
|
|
26 | 32 |
prepare(); |
27 | 33 |
return managerInstance.currentDataPortalContext; |
28 | 34 |
} |
29 | 35 |
|
30 | 36 |
private void setupDataPortal() { |
31 |
//TODO
|
|
37 |
// TODO
|
|
32 | 38 |
} |
33 | 39 |
|
34 | 40 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/resources/log4j.properties | ||
---|---|---|
1 |
# |
|
2 |
# |
|
3 |
# If you are having problems with logging you may debug Log4J initialization, |
|
4 |
# start the application with a system property log4j.configDebug set to "true". |
|
5 |
# E.g.: |
|
6 |
# |
|
7 |
# java -Dlog4j.configDebug=true |
|
8 |
# |
|
9 |
|
|
10 |
log4j.rootLogger= INFO, stdout |
|
11 |
|
|
12 |
|
|
13 |
log4j.appender.stdout=org.apache.log4j.ConsoleAppender |
|
14 |
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout |
|
15 |
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/CdmDataPortalSeleniumRCTestBase.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
1 | 10 |
package eu.etaxonomy.dataportal.selenium; |
2 | 11 |
|
3 | 12 |
import org.junit.BeforeClass; |
... | ... | |
7 | 16 |
|
8 | 17 |
import eu.etaxonomy.dataportal.DataPortalManager; |
9 | 18 |
|
19 |
/** |
|
20 |
* http://seleniumhq.org/docs/03_webdriver.html#emulating-selenium-rc |
|
21 |
* |
|
22 |
* @author a.kohlbecker |
|
23 |
* |
|
24 |
*/ |
|
10 | 25 |
public abstract class CdmDataPortalSeleniumRCTestBase extends |
11 | 26 |
CdmDataPortalTestBase { |
12 | 27 |
|
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/CdmDataPortalTestBase.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.io.IOException; |
7 | 7 |
|
8 |
import org.apache.log4j.Logger; |
|
8 | 9 |
import org.junit.AfterClass; |
9 |
import org.junit.BeforeClass; |
|
10 |
import org.junit.BeforeClass; //$Id$ |
|
11 |
/** |
|
12 |
* Copyright (C) 2009 EDIT |
|
13 |
* European Distributed Institute of Taxonomy |
|
14 |
* http://www.e-taxonomy.eu |
|
15 |
* |
|
16 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
17 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
18 |
*/ |
|
10 | 19 |
import org.junit.runner.RunWith; |
11 | 20 |
import org.openqa.selenium.WebDriver; |
12 | 21 |
import org.openqa.selenium.chrome.ChromeDriver; |
... | ... | |
14 | 23 |
import org.openqa.selenium.firefox.FirefoxProfile; |
15 | 24 |
import org.openqa.selenium.ie.InternetExplorerDriver; |
16 | 25 |
|
26 |
import eu.etaxonomy.dataportal.Browser; |
|
17 | 27 |
import eu.etaxonomy.dataportal.DataPortalContextAwareRunner; |
18 | 28 |
|
19 | 29 |
/** |
20 | 30 |
* @author a.kohlbecker |
21 |
* |
|
31 |
*
|
|
22 | 32 |
*/ |
23 | 33 |
@RunWith(DataPortalContextAwareRunner.class) |
24 | 34 |
public abstract class CdmDataPortalTestBase { |
25 | 35 |
|
36 |
public static final Logger logger = Logger.getLogger(CdmDataPortalTestBase.class); |
|
37 |
|
|
38 |
private static final String SYSTEM_PROPERTY_NAME_BROWSER = "browser"; |
|
39 |
|
|
26 | 40 |
private static final String FIREBUG_VERSION = "1.6.2"; |
27 | 41 |
|
28 | 42 |
protected static WebDriver driver; |
29 | 43 |
|
30 |
@BeforeClass |
|
31 |
public static void setUpDriver() { |
|
32 |
driver = initFirefoxDriver(); |
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
@AfterClass |
|
37 |
public static void closeDriver() { |
|
38 |
if(driver != null){ |
|
39 |
driver.quit(); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
public WebDriver initChromeDriver() { |
|
44 |
//System.setProperty("webdriver.chrome.bin", "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe"); |
|
44 |
@BeforeClass |
|
45 |
public static void setUpDriver() { |
|
46 |
Browser browser = Browser.valueOf(System.getProperty( |
|
47 |
SYSTEM_PROPERTY_NAME_BROWSER, Browser.firefox.name())); |
|
48 |
if (browser == null) { |
|
49 |
throw new RuntimeException("Invalid system property: '" |
|
50 |
+ System.getProperty(SYSTEM_PROPERTY_NAME_BROWSER) + "'"); |
|
51 |
} |
|
52 |
logger.info("Using browser " + browser.name()); |
|
53 |
switch (browser) { |
|
54 |
case firefox: |
|
55 |
driver = initFirefoxDriver(); |
|
56 |
break; |
|
57 |
case chrome: |
|
58 |
driver = initChromeDriver(); |
|
59 |
break; |
|
60 |
case iexplorer: |
|
61 |
driver = initInternetExplorerDriver(); |
|
62 |
break; |
|
63 |
} |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
@AfterClass |
|
68 |
public static void closeDriver() { |
|
69 |
if (driver != null) { |
|
70 |
driver.quit(); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
public static WebDriver initChromeDriver() { |
|
75 |
// System.setProperty("webdriver.chrome.bin", |
|
76 |
// "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe"); |
|
45 | 77 |
return new ChromeDriver(); |
46 | 78 |
} |
47 |
|
|
48 |
public WebDriver initInternetExplorerDriver() { |
|
79 |
|
|
80 |
public static WebDriver initInternetExplorerDriver() {
|
|
49 | 81 |
return new InternetExplorerDriver(); |
50 | 82 |
} |
51 |
|
|
83 |
|
|
52 | 84 |
/** |
53 | 85 |
* -Dwebdriver.firefox.bin=/usr/lib/iceweasel/firefox-bin |
54 | 86 |
* |
55 | 87 |
* See http://code.google.com/p/selenium/wiki/FirefoxDriverInternals |
88 |
* |
|
56 | 89 |
* @return |
57 | 90 |
*/ |
58 | 91 |
public static WebDriver initFirefoxDriver() { |
59 |
//System.setProperty("webdriver.firefox.bin", "C:\\Programme\\Mozilla Firefox 3\\firefox.exe"); |
|
60 |
//System.out.println("##:" + System.getProperty("webdriver.firefox.bin")); |
|
92 |
// System.setProperty("webdriver.firefox.bin", |
|
93 |
// "C:\\Programme\\Mozilla Firefox 3\\firefox.exe"); |
|
94 |
// System.out.println("##:" + |
|
95 |
// System.getProperty("webdriver.firefox.bin")); |
|
61 | 96 |
FirefoxProfile firefoxProfile = new FirefoxProfile(); |
62 |
try { |
|
63 |
|
|
64 |
firefoxProfile.addExtension(CdmDataPortalTestBase.class, "/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi"); |
|
65 |
firefoxProfile.setPreference("extensions.firebug.currentVersion", FIREBUG_VERSION); // avoid displaying firt run page |
|
66 |
|
|
67 |
// --- allow enabling incompatible addons |
|
68 |
// firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi"); |
|
69 |
// firefoxProfile.setPreference("extensions.acr.firstrun", false); |
|
70 |
// firefoxProfile.setPreference("extensions.enabledAddons", "fxdriver@googlecode.com,compatibility@addons.mozilla.org:0.8.3,fxdriver@googlecode.com:0.9.7376,{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}:6.0.24,{20a82645-c095-46ed-80e3-08825760534b}:0.0.0,meetinglauncher@iconf.net:4.10.12.316,jqs@sun.com:1.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0"); |
|
71 |
// firefoxProfile.setPreference("extensions.checkCompatibility", false); |
|
72 |
// firefoxProfile.setPreference("extensions.checkCompatibility.4.0", false); |
|
73 |
// firefoxProfile.setPreference("extensions.checkCompatibility.4.1", false); |
|
74 |
|
|
75 |
} catch (IOException e) { |
|
97 |
try { |
|
98 |
|
|
99 |
firefoxProfile.addExtension(CdmDataPortalTestBase.class, |
|
100 |
"/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi"); |
|
101 |
firefoxProfile.setPreference("extensions.firebug.currentVersion", |
|
102 |
FIREBUG_VERSION); // avoid displaying firt run page |
|
103 |
|
|
104 |
// --- allow enabling incompatible addons |
|
105 |
// firefoxProfile.addExtension(this.getClass(), |
|
106 |
// "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi"); |
|
107 |
// firefoxProfile.setPreference("extensions.acr.firstrun", false); |
|
108 |
// firefoxProfile.setPreference("extensions.enabledAddons", |
|
109 |
// "fxdriver@googlecode.com,compatibility@addons.mozilla.org:0.8.3,fxdriver@googlecode.com:0.9.7376,{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}:6.0.24,{20a82645-c095-46ed-80e3-08825760534b}:0.0.0,meetinglauncher@iconf.net:4.10.12.316,jqs@sun.com:1.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0"); |
|
110 |
// firefoxProfile.setPreference("extensions.checkCompatibility", |
|
111 |
// false); |
|
112 |
// firefoxProfile.setPreference("extensions.checkCompatibility.4.0", |
|
113 |
// false); |
|
114 |
// firefoxProfile.setPreference("extensions.checkCompatibility.4.1", |
|
115 |
// false); |
|
116 |
|
|
117 |
} catch (IOException e) { |
|
76 | 118 |
// TODO Auto-generated catch block |
77 | 119 |
e.printStackTrace(); |
78 | 120 |
System.exit(-1); |
79 | 121 |
} |
80 | 122 |
driver = new FirefoxDriver(firefoxProfile); |
81 |
|
|
82 |
return driver;
|
|
123 |
|
|
124 |
return driver;
|
|
83 | 125 |
} |
84 |
|
|
85 | 126 |
|
86 | 127 |
} |
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/ExampleTest.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2009 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
1 | 10 |
package eu.etaxonomy.dataportal.selenium; |
2 | 11 |
|
3 | 12 |
import junit.framework.Assert; |
... | ... | |
10 | 19 |
import eu.etaxonomy.dataportal.DataPortalContext; |
11 | 20 |
import eu.etaxonomy.dataportal.DataPortalContextAwareRunner.DataPortalContexts; |
12 | 21 |
|
13 |
@DataPortalContexts({ |
|
14 |
DataPortalContext.palmae |
|
15 |
}) |
|
22 |
@DataPortalContexts( { DataPortalContext.cichorieae }) |
|
16 | 23 |
public class ExampleTest extends CdmDataPortalSeleniumRCTestBase { |
17 |
|
|
24 |
|
|
18 | 25 |
static String baseUrl = "http://wp6-cichorieae.e-taxonomy.eu/portal/"; |
19 | 26 |
|
20 | 27 |
public static String getBaseUrl() { |
21 | 28 |
return baseUrl; |
22 | 29 |
} |
23 | 30 |
|
24 |
@Test
|
|
31 |
@Test
|
|
25 | 32 |
public void testSearchLCommunis() throws Exception { |
26 |
driver.get(baseUrl + "?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0"); |
|
27 |
WebElement taxonElement = driver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']")); |
|
28 |
|
|
29 |
WebElement nameElement = taxonElement.findElement(By.className("BotanicalName")); |
|
30 |
|
|
31 |
RenderedWebElement namePart1 = (RenderedWebElement)nameElement.findElement(By.xpath("span[1]")); |
|
32 |
Assert.assertEquals("Lapsana", namePart1.getText()); |
|
33 |
Assert.assertEquals("italic", namePart1.getValueOfCssProperty("font-style")); |
|
34 |
|
|
35 |
RenderedWebElement namePart2 = (RenderedWebElement)nameElement.findElement(By.xpath("span[2]")); |
|
36 |
Assert.assertEquals("communis", namePart2.getText()); |
|
37 |
Assert.assertEquals("italic", namePart2.getValueOfCssProperty("font-style")); |
|
38 |
|
|
39 |
RenderedWebElement authorPart = (RenderedWebElement)nameElement.findElement(By.xpath("span[3]")); |
|
40 |
Assert.assertEquals("L.", authorPart.getText()); |
|
41 |
Assert.assertEquals("normal", authorPart.getValueOfCssProperty("font-style")); |
|
42 |
|
|
43 |
RenderedWebElement referenceElement = (RenderedWebElement)taxonElement.findElement(By.className("reference")); |
|
44 |
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText()); |
|
33 |
driver |
|
34 |
.get(baseUrl |
|
35 |
+ "?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0"); |
|
36 |
WebElement taxonElement = driver |
|
37 |
.findElement(By |
|
38 |
.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']")); |
|
39 |
|
|
40 |
WebElement nameElement = taxonElement.findElement(By |
|
41 |
.className("BotanicalName")); |
|
42 |
|
|
43 |
RenderedWebElement namePart1 = (RenderedWebElement) nameElement |
|
44 |
.findElement(By.xpath("span[1]")); |
|
45 |
Assert.assertEquals("Lapsana", namePart1.getText()); |
|
46 |
Assert.assertEquals("italic", namePart1 |
|
47 |
.getValueOfCssProperty("font-style")); |
|
48 |
|
|
49 |
RenderedWebElement namePart2 = (RenderedWebElement) nameElement |
|
50 |
.findElement(By.xpath("span[2]")); |
|
51 |
Assert.assertEquals("communis", namePart2.getText()); |
|
52 |
Assert.assertEquals("italic", namePart2 |
|
53 |
.getValueOfCssProperty("font-style")); |
|
54 |
|
|
55 |
RenderedWebElement authorPart = (RenderedWebElement) nameElement |
|
56 |
.findElement(By.xpath("span[3]")); |
|
57 |
Assert.assertEquals("L.", authorPart.getText()); |
|
58 |
Assert.assertEquals("normal", authorPart |
|
59 |
.getValueOfCssProperty("font-style")); |
|
60 |
|
|
61 |
RenderedWebElement referenceElement = (RenderedWebElement) taxonElement |
|
62 |
.findElement(By.className("reference")); |
|
63 |
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement( |
|
64 |
(By.className("reference"))).getText()); |
|
45 | 65 |
} |
46 |
|
|
47 |
/**
|
|
48 |
* This test emulates the Selenium RC API
|
|
49 |
*
|
|
50 |
* @throws Exception
|
|
51 |
*/
|
|
52 |
@Test
|
|
66 |
|
|
67 |
/**
|
|
68 |
* This test emulates the Selenium RC API
|
|
69 |
*
|
|
70 |
* @throws Exception
|
|
71 |
*/
|
|
72 |
@Test
|
|
53 | 73 |
public void testSearchLCommunisUsingSeleniumRC() throws Exception { |
54 |
selenium.open("?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0"); |
|
55 |
selenium.isTextPresent("Lapsana"); |
|
56 |
selenium.isTextPresent("communis"); |
|
57 |
selenium.isTextPresent("L."); |
|
58 |
selenium.isTextPresent("Sp. Pl.: 811. 1753"); |
|
74 |
selenium |
|
75 |
.open("?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0"); |
|
76 |
selenium.isTextPresent("Lapsana"); |
|
77 |
selenium.isTextPresent("communis"); |
|
78 |
selenium.isTextPresent("L."); |
|
79 |
selenium.isTextPresent("Sp. Pl.: 811. 1753"); |
|
59 | 80 |
} |
60 | 81 |
|
61 | 82 |
} |
Also available in: Unified diff
licence comments, log4j, browser configurable via -Dbrowser=[firefox,iexplorer,chrome]