Project

General

Profile

« Previous | Next » 

Revision 6a5f5bdb

Added by Andreas Kohlbecker over 12 years ago

test for #2612: name page broken

View differences:

modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
43 43
 */
44 44
public class TaxonSynonymyPage extends PortalPage {
45 45

  
46
	public static final Logger logger = Logger.getLogger(TaxonSynonymyPage.class);
47

  
48
	private UUID taxonUuid;
49

  
50
	protected static String drupalPagePathBase = "cdm_dataportal/taxon";
51

  
52
	/* (non-Javadoc)
53
	 * @see eu.etaxonomy.dataportal.pages.PortalPage#getDrupalPageBase()
54
	 */
55
	@Override
56
	protected String getDrupalPageBase() {
57
		return drupalPagePathBase;
58
	}
59

  
60
	@FindBy(id = "synonymy")
61
	@CacheLookup
62
	private WebElement synonymy;
63

  
64

  
65

  
66
	/**
67
	 * @param driver
68
	 * @param context
69
	 * @param taxonUuid
70
	 * @throws MalformedURLException
71
	 */
72
	public TaxonSynonymyPage(WebDriver driver, DataPortalContext context, UUID taxonUuid) throws MalformedURLException {
73

  
74
		super(driver, context, taxonUuid.toString() + "/synonymy");
75

  
76
		this.taxonUuid = taxonUuid;
77
	}
78

  
79

  
80
	/**
81
	 * @param driver
82
	 * @param context
83
	 * @throws Exception
84
	 */
85
	public TaxonSynonymyPage(WebDriver driver, DataPortalContext context) throws Exception {
86
		super(driver, context);
87
	}
88

  
89

  
90
	/**
91
	 * Returns the profile image of the taxon profile page. This image is
92
	 * located at the top of the page. The Profile Image can be disabled in the
93
	 * DataPortal settings.
94
	 *
95
	 * @return The Url of the profile image or null if the image is not visible.
96
	 */
97
	public String getAcceptedName() {
98
		WebElement acceptedName = synonymy.findElement(
99
				By.xpath("./span[contains(@class,'accepted-name')]")
100
		);
101
		return acceptedName.getText();
102
	}
103

  
104
	public List<LinkElement> getAcceptedNameFootNoteKeys() {
105
		List<WebElement> fnkListElements = synonymy.findElements(
106
				By.xpath("./span[contains(@class,'accepted-name')]/following-sibling::span[contains(@class, 'footnote-key')]/a")
107
		);
108
		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
109
	}
110

  
111
	/**
112
	 * @param synonymIndex
113
	 *            the 1-based position of the synonym in the list of homotypical
114
	 *            synonyms
115
	 * @return the full text line of the synonym including the prepending symbol
116
	 *         and all information rendered after the name. All whitespace is
117
	 *         normalized to the SPACE character.
118
	 */
119
	public String getHomotypicalGroupSynonymName(Integer synonymIndex) {
120
		WebElement acceptedName = synonymy.findElement(
121
				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]")
122
		);
123
		return acceptedName.getText().replaceAll("\\s", " ");
124
	}
125

  
126
	public List<LinkElement> getHomotypicalGroupFootNoteKeys() {
127
		List<WebElement> fnkListElements = synonymy.findElements(
128
				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a")
129
		);
130
		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
131
	}
132

  
133
	public List<BaseElement> getHomotypicalGroupFootNotes() {
134
		List<WebElement> fnListElements = synonymy.findElements(
135
				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
136
		);
137
		return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
138

  
139
	}
140

  
141

  
142

  
143
	/**
144
	 * @param heterotypicalGroupIndex
145
	 *            the 0-based index of the heterotypical group
146
	 * @param synonymIndex
147
	 *            the 1-based position of the synonym in the list specified
148
	 *            group of heterotypical synonyms
149
	 * @return the full text line of the synonym including the prepending symbol
150
	 *         and all information rendered after the name. All whitespace is
151
	 *         normalized to the SPACE character.
152
	 */
153
	public String getHeterotypicalGroupSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
154
		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[" + synonymIndex + "]"));
155
		return acceptedName.getText().replaceAll("\\s", " ");
156
	}
157

  
158
	public List<LinkElement> getHeterotypicalGroupFootNoteKeys(Integer heterotypicalGroupIndex) {
159
		List<WebElement> fnkListElements = synonymy.findElements(
160
				By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/*/span[contains(@class, 'footnote-key')]/a")
161
		);
162
		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
163
	}
164

  
165
	public List<BaseElement> getHeterotypicalGroupFootNotes(Integer heterotypicalGroupIndex) {
166
		List<WebElement> fnListElements = synonymy.findElements(
167
				By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnotes')]")
168
		);
169
		return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
170
	}
46
    public static final Logger logger = Logger.getLogger(TaxonSynonymyPage.class);
47

  
48
    private UUID taxonUuid;
49

  
50
    protected static String drupalPagePathBase = "cdm_dataportal/taxon";
51

  
52
    /* (non-Javadoc)
53
     * @see eu.etaxonomy.dataportal.pages.PortalPage#getDrupalPageBase()
54
     */
55
    @Override
56
    protected String getDrupalPageBase() {
57
        return drupalPagePathBase;
58
    }
59

  
60
    @FindBy(id = "synonymy")
61
    @CacheLookup
62
    private WebElement synonymy;
63

  
64

  
65

  
66
    /**
67
     * @param driver
68
     * @param context
69
     * @param taxonUuid
70
     * @throws MalformedURLException
71
     */
72
    public TaxonSynonymyPage(WebDriver driver, DataPortalContext context, UUID taxonUuid) throws MalformedURLException {
73

  
74
        super(driver, context, taxonUuid.toString() + "/synonymy");
75

  
76
        this.taxonUuid = taxonUuid;
77
    }
78

  
79

  
80
    /**
81
     * @param driver
82
     * @param context
83
     * @throws Exception
84
     */
85
    public TaxonSynonymyPage(WebDriver driver, DataPortalContext context) throws Exception {
86
        super(driver, context);
87
    }
88

  
89

  
90
    /**
91
     * Returns the profile image of the taxon profile page. This image is
92
     * located at the top of the page. The Profile Image can be disabled in the
93
     * DataPortal settings.
94
     *
95
     * @return The Url of the profile image or null if the image is not visible.
96
     */
97
    public String getAcceptedName() {
98
        WebElement acceptedName = synonymy.findElement(
99
                By.xpath("./span[contains(@class,'accepted-name')]")
100
        );
101
        return acceptedName.getText();
102
    }
103

  
104
    public List<LinkElement> getAcceptedNameFootNoteKeys() {
105
        List<WebElement> fnkListElements = synonymy.findElements(
106
                By.xpath("./span[contains(@class,'accepted-name')]/following-sibling::span[contains(@class, 'footnote-key')]/a")
107
        );
108
        return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
109
    }
110

  
111
    /**
112
     * @param synonymIndex
113
     *            the 1-based position of the synonym in the list of homotypical
114
     *            synonyms
115
     * @return the full text line of the synonym including the prepending symbol
116
     *         and all information rendered after the name. All whitespace is
117
     *         normalized to the SPACE character.
118
     */
119
    public String getHomotypicalGroupSynonymName(Integer synonymIndex) {
120
        WebElement synonym = getHomotypicalGroupSynonym(synonymIndex);
121
        return synonym.getText().replaceAll("\\s", " ");
122
    }
123

  
124

  
125
    /**
126
     * @param synonymIndex
127
     * @return
128
     */
129
    public WebElement getHomotypicalGroupSynonym(Integer synonymIndex) {
130
        WebElement synonym = synonymy.findElement(
131
                By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]")
132
        );
133
        return synonym;
134
    }
135

  
136
    public List<LinkElement> getHomotypicalGroupFootNoteKeys() {
137
        List<WebElement> fnkListElements = synonymy.findElements(
138
                By.xpath("./ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a")
139
        );
140
        return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
141
    }
142

  
143
    public List<BaseElement> getHomotypicalGroupFootNotes() {
144
        List<WebElement> fnListElements = synonymy.findElements(
145
                By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
146
        );
147
        return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
148

  
149
    }
150

  
151

  
152

  
153
    /**
154
     * @param heterotypicalGroupIndex
155
     *            the 1-based index of the heterotypical group
156
     * @param synonymIndex
157
     *            the 1-based position of the synonym in the list specified
158
     *            group of heterotypical synonyms
159
     * @return the full text line of the synonym including the prepending symbol
160
     *         and all information rendered after the name. All whitespace is
161
     *         normalized to the SPACE character.
162
     */
163
    public String getHeterotypicalGroupSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
164
        WebElement synonym = getHeterotypicalGroupSynonym(heterotypicalGroupIndex, synonymIndex);
165
        return synonym.getText().replaceAll("\\s", " ");
166
    }
167

  
168

  
169
    /**
170
     * @param heterotypicalGroupIndex
171
     *            the 1-based index of the heterotypical group
172
     * @param synonymIndex
173
     *            the 1-based position of the synonym in the list specified
174
     *            group of heterotypical synonyms
175
     * @return
176
     */
177
    public WebElement getHeterotypicalGroupSynonym(Integer heterotypicalGroupIndex, Integer synonymIndex) {
178
        WebElement synonym = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[" + synonymIndex + "]"));
179
        return synonym;
180
    }
181

  
182
    public List<LinkElement> getHeterotypicalGroupFootNoteKeys(Integer heterotypicalGroupIndex) {
183
        List<WebElement> fnkListElements = synonymy.findElements(
184
                By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/*/span[contains(@class, 'footnote-key')]/a")
185
        );
186
        return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
187
    }
188

  
189
    public List<BaseElement> getHeterotypicalGroupFootNotes(Integer heterotypicalGroupIndex) {
190
        List<WebElement> fnListElements = synonymy.findElements(
191
                By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnotes')]")
192
        );
193
        return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
194
    }
171 195

  
172 196
}

Also available in: Unified diff