1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal.selenium.tests.reference;
|
10
|
|
11
|
import java.net.MalformedURLException;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.junit.Before;
|
15
|
import org.junit.Test;
|
16
|
|
17
|
import com.thoughtworks.selenium.webdriven.commands.WaitForPageToLoad;
|
18
|
|
19
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
20
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
21
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
22
|
import eu.etaxonomy.dataportal.pages.GenericPortalPage;
|
23
|
|
24
|
/**
|
25
|
* Issues to be covered by this TestClass:
|
26
|
*
|
27
|
* #3616
|
28
|
*
|
29
|
* @author a.kohlbecker
|
30
|
*
|
31
|
*/
|
32
|
|
33
|
@DataPortalContexts( { DataPortalSite.reference })
|
34
|
public class NamePageRedirectTest extends CdmDataPortalTestBase{
|
35
|
|
36
|
static final UUID taxon_achilllea_santolina_uuid = UUID.fromString("c246856f-c03e-4cb7-ac92-d9b2864084cd");
|
37
|
static final UUID name_achilllea_santolina_uuid = UUID.fromString("2ff1fb18-7055-420f-8c10-5105b66974de");
|
38
|
|
39
|
|
40
|
@Before
|
41
|
public void setUp() throws Exception {
|
42
|
driver.get(getContext().getSiteUri().toString());
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* related to https://dev.e-taxonomy.eu/redmine/issues/8304
|
47
|
*/
|
48
|
@Test
|
49
|
public void testNoRedirect() throws MalformedURLException {
|
50
|
|
51
|
GenericPortalPage p = new GenericPortalPage(driver, getContext(), "name/" + name_achilllea_santolina_uuid.toString() + "/null/null");
|
52
|
assertTrue(
|
53
|
"The target page should be a name page, no redirect must have happened.",
|
54
|
p.getDrupalPagePath().startsWith("cdm_dataportal/name/" + name_achilllea_santolina_uuid.toString()));
|
55
|
|
56
|
p = new GenericPortalPage(driver, getContext(), "name/" + name_achilllea_santolina_uuid.toString() + "/null/null/null");
|
57
|
assertTrue(
|
58
|
"The target page should be a name page, no redirect must have happened.",
|
59
|
p.getDrupalPagePath().startsWith("cdm_dataportal/name/" + name_achilllea_santolina_uuid.toString()));
|
60
|
|
61
|
p = new GenericPortalPage(driver, getContext(), "name/" + name_achilllea_santolina_uuid.toString() + "///");
|
62
|
assertTrue(
|
63
|
"The target page should be a name page, no redirect must have happened.",
|
64
|
p.getDrupalPagePath().startsWith("cdm_dataportal/name/" + name_achilllea_santolina_uuid.toString()));
|
65
|
|
66
|
}
|
67
|
|
68
|
|
69
|
/**
|
70
|
* related to https://dev.e-taxonomy.eu/redmine/issues/8304
|
71
|
*/
|
72
|
@Test
|
73
|
public void testRedirectToTaxon() throws MalformedURLException {
|
74
|
|
75
|
|
76
|
WaitForPageToLoad wait = new WaitForPageToLoad();
|
77
|
String timeout = "5";
|
78
|
GenericPortalPage p = new GenericPortalPage(driver, getContext(), "name/" + name_achilllea_santolina_uuid.toString() + "/null/null/redirect_to_taxon");
|
79
|
wait.apply(driver, new String[] {timeout});
|
80
|
wait.apply(driver, new String[] {timeout});
|
81
|
logger.debug("DrupalPagePath: " + p.getDrupalPagePath());
|
82
|
assertTrue(
|
83
|
"The target page should be a taxon page, the name page must have been redirected to the according taxon page.",
|
84
|
p.getDrupalPagePath().startsWith("cdm_dataportal/taxon/" + taxon_achilllea_santolina_uuid.toString()));
|
85
|
|
86
|
p = new GenericPortalPage(driver, getContext(), "name/" + name_achilllea_santolina_uuid.toString() + "///redirect_to_taxon");
|
87
|
wait.apply(driver, new String[] {timeout});
|
88
|
logger.debug("DrupalPagePath: " + p.getDrupalPagePath());
|
89
|
assertTrue(
|
90
|
"The target page should be a taxon page, the name page must have been redirected to the according taxon page.",
|
91
|
p.getDrupalPagePath().startsWith("cdm_dataportal/taxon/" + taxon_achilllea_santolina_uuid.toString()));
|
92
|
|
93
|
}
|
94
|
|
95
|
}
|