Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,16 @@ public Control checkSystemPage(String name) {
* Check if the given credential is part of the domain.
*/
public Control checkIfCredentialsExist(String name) {
By xpath = by.xpath("//a[@title='" + name + "']");
if (getElement(xpath) == null) {
// post credentials-2.3.2
xpath = by.xpath("//td[contains(text(),'" + name + "')]");
}
By xpath = by.xpath("//td[contains(text(),'" + name + "')] | //a[contains(text(), '" + name + "')]");
return control(xpath);
}

/**
* Find the href of the associted
*/
public String credentialById(String name) {
By xpath = by.xpath("//a[@title='" + name + "']");
if (getElement(xpath) == null) {
// post credentials-2.3.2
xpath = by.xpath("//td[contains(text(),'" + name + "')]/parent::tr//a");
}
By xpath = by.xpath("//td[contains(text(),'" + name + "')]/parent::tr//a | //span[contains(text(),'" + name
+ "')]/parent::div/parent::div//a");
return control(xpath).resolve().getAttribute("href");
}
}
2 changes: 1 addition & 1 deletion src/test/java/core/CredentialsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CredentialsTest extends AbstractJUnitTest {
private static final String CRED_DOMAIN = "mydomain";
private static final String CRED_USER = "user";
private static final String CRED_PWD = "password";
private static final String CRED_DESCR = "descr";
private static final String CRED_DESCR = "My-super-unique-description";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if the tests used ID for locating the credentials but since its not I was a bit worried that this could end up not being unique enough so I just made it more specific, can drop this though.


@Test
@WithPlugins("ssh-credentials")
Expand Down