Revision 646c0cae
Added by Andreas Kohlbecker over 11 years ago
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java | ||
---|---|---|
324 | 324 |
* @param <T> |
325 | 325 |
* @param link the link to click |
326 | 326 |
* @param isTrue see {@link org.openqa.selenium.support.ui.FluentWait#until(Function)} |
327 |
* @param type the return type
|
|
327 |
* @param pageType the return type
|
|
328 | 328 |
* @param duration may be null, if this in null <code>waitUnit</code> will be ignored. |
329 | 329 |
* @param waitUnit may be null, is ignored if <code>duration</code> is null defaults to {@link TimeUnit.SECONDS} |
330 | 330 |
* @return |
331 | 331 |
* @throws SecurityException |
332 | 332 |
*/ |
333 |
public <T extends PortalPage> T clickLink(BaseElement element, Function<? super WebDriver, Boolean> isTrue, Class<T> type, Long duration, TimeUnit waitUnit) {
|
|
333 |
public <T extends PortalPage> T clickLink(BaseElement element, Function<? super WebDriver, Boolean> isTrue, Class<T> pageType, Long duration, TimeUnit waitUnit) {
|
|
334 | 334 |
|
335 |
if( pageType.getClass().equals(PortalPage.class) ) { |
|
336 |
throw new RuntimeException("Parameter pageType must be a subclass of PortalPage"); |
|
337 |
} |
|
335 | 338 |
String targetWindow = null; |
336 | 339 |
List<String> targets = element.getLinkTargets(driver); |
337 | 340 |
if(targets.size() > 0){ |
... | ... | |
364 | 367 |
Constructor<T> constructor; |
365 | 368 |
T pageInstance; |
366 | 369 |
try { |
367 |
constructor = type.getConstructor(WebDriver.class, DataPortalContext.class);
|
|
370 |
constructor = pageType.getConstructor(WebDriver.class, DataPortalContext.class);
|
|
368 | 371 |
pageInstance = constructor.newInstance(driver, context); |
369 | 372 |
} catch (Exception e) { |
370 | 373 |
throw new RuntimeException(e); |
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/WebDriverFactory.java | ||
---|---|---|
62 | 62 |
SystemUtils.handleInvalidSystemProperty(SYSTEM_PROPERTY_NAME_BROWSER, e); |
63 | 63 |
} |
64 | 64 |
|
65 |
newDriver.manage().timeouts().implicitlyWait(IMPLICIT_WAIT_DEFAULT, TimeUnit.SECONDS); |
|
66 |
logger.info("Implicit wait set to : " + IMPLICIT_WAIT_DEFAULT + TimeUnit.SECONDS);
|
|
65 |
// newDriver.manage().timeouts().implicitlyWait(IMPLICIT_WAIT_DEFAULT, TimeUnit.SECONDS);
|
|
66 |
// logger.info("Implicit wait set to : " + IMPLICIT_WAIT_DEFAULT + " " + TimeUnit.SECONDS);
|
|
67 | 67 |
|
68 | 68 |
return newDriver; |
69 | 69 |
} |
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/resources/eu/etaxonomy/dataportal/DataPortalTest.xml | ||
---|---|---|
49 | 49 |
The browser to be used for testing (defaults to firefox) |
50 | 50 |
--> |
51 | 51 |
<!-- <entry key="browser">iexplorer</entry> --> |
52 |
<!-- <entry key="browser">chrome</entry> --> |
|
52 | 53 |
</properties> |
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/CichorieaeSearchTest.java | ||
---|---|---|
73 | 73 |
WebElement referenceElement = lapsanaCommunnis.getElement().findElement(By.className("reference")); |
74 | 74 |
Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText()); |
75 | 75 |
|
76 |
PortalPage taxonProfilLapsanaCommunnis = searchResultPage.clickTaxonName(lapsanaCommunnis, PortalPage.class); |
|
76 |
PortalPage taxonProfilLapsanaCommunnis = searchResultPage.clickTaxonName(lapsanaCommunnis, GenericPortalPage.class);
|
|
77 | 77 |
assertEquals(getContext().prepareTitle("Lapsana communis"), taxonProfilLapsanaCommunnis.getTitle()); |
78 | 78 |
} |
79 | 79 |
|
Also available in: Unified diff
fixing problems with abstract pageTypes, related to r16719