Skip to content

Commit

Permalink
[E2E Tests] Disable default HTTPS scheme when creating a new connecti…
Browse files Browse the repository at this point in the history
…on (#3452)
  • Loading branch information
jsolovjo committed May 13, 2024
1 parent 758fdb9 commit df63602
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ public class ConnectPage extends HawtioPage {
private static final By MODAL = By.cssSelector(".pf-c-modal-box");
private static final By CONNECTION_FORM = By.id("connection-form");

private static final By CONNECTION_SCHEME = By.id("connection-form-scheme");

private static final By CONNECTION_SCHEME_TOGGLE = By.cssSelector("span.pf-c-switch__toggle");

private static final By CONNECTION_LIST = By.id("connection-list");

private static final By CONNECTION_LOGIN_FORM = By.id("connect-login-form");

private static final By FOOTER_BUTTON = By.cssSelector("footer button.pf-m-primary");

public void addConnection(String name, URL connection) {
final String connectionSchemeHttps = "connection-form-scheme-on";

//Don't try to create the same connection twice
try {
$(ByUtils.byAttribute("rowid", "connection " + name)).shouldNot(Condition.exist, Duration.ofSeconds(10));
Expand All @@ -37,6 +43,12 @@ public void addConnection(String name, URL connection) {
$(CONNECT_BUTTON).shouldBe(Condition.interactable).click();

$(CONNECTION_FORM).$(By.id("connection-form-name")).setValue(name);

// If Scheme is HTTPS, switch to HTTP
if (connectionSchemeHttps.equals($(CONNECTION_SCHEME).getAttribute("aria-labelledby"))) {
$(CONNECTION_SCHEME_TOGGLE).click();
}

$(CONNECTION_FORM).$(By.id("connection-form-host")).setValue(connection.getHost());
$(CONNECTION_FORM).$(By.id("connection-form-port")).setValue(String.valueOf(connection.getPort()));
$(CONNECTION_FORM).$(By.id("connection-form-path")).setValue(connection.getPath());
Expand Down

0 comments on commit df63602

Please sign in to comment.