Skip to content

Commit

Permalink
SD-1699 Selenium test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gj0dcsa committed Nov 17, 2024
1 parent aed92f0 commit 22169e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,27 @@ private void completeAction() {
private void updateSandboxConfigBeforeStarting(SandboxConfig sandbox1, SandboxConfig sandbox2) {
log.info("Updating both sandbox configs before starting");
// Starts in the 2nd tab
driver.findElement(By.name("externalPartyUrlTextField")).sendKeys(sandbox1.sandboxUrl());
driver.findElement(By.name("externalPartyAuthHeaderNameTextField")).sendKeys(sandbox1.sandboxAuthHeaderName());
driver.findElement(By.name("externalPartyAuthHeaderValueTextField")).sendKeys(sandbox1.sandboxAuthHeaderValue());
driver.findElement(By.id("updateSandboxButton")).click();
if (sandbox1.sandboxUrl() != null) {
driver.findElement(By.name("externalPartyUrlTextField")).sendKeys(sandbox1.sandboxUrl());
driver.findElement(By.name("externalPartyAuthHeaderNameTextField")).sendKeys(sandbox1.sandboxAuthHeaderName());
driver.findElement(By.name("externalPartyAuthHeaderValueTextField")).sendKeys(sandbox1.sandboxAuthHeaderValue());
driver.findElement(By.cssSelector("[testId='updateSandboxButton']")).click();
} else {
driver.findElement(By.cssSelector("[testId='cancelUpdateSandboxButton']")).click();
}
waitForUIReadiness();
assertTrue(driver.findElement(By.className("pageTitle")).getText().startsWith("Sandbox: "));

// Starts in the 1st tab
switchToTab(0);
driver.findElement(By.name("externalPartyUrlTextField")).sendKeys(sandbox2.sandboxUrl());
driver.findElement(By.name("externalPartyAuthHeaderNameTextField")).sendKeys(sandbox2.sandboxAuthHeaderName());
driver.findElement(By.name("externalPartyAuthHeaderValueTextField")).sendKeys(sandbox2.sandboxAuthHeaderValue());
driver.findElement(By.id("updateSandboxButton")).click();
if (sandbox2.sandboxUrl() != null) {
driver.findElement(By.name("externalPartyUrlTextField")).sendKeys(sandbox2.sandboxUrl());
driver.findElement(By.name("externalPartyAuthHeaderNameTextField")).sendKeys(sandbox2.sandboxAuthHeaderName());
driver.findElement(By.name("externalPartyAuthHeaderValueTextField")).sendKeys(sandbox2.sandboxAuthHeaderValue());
driver.findElement(By.cssSelector("[testId='updateSandboxButton']")).click();
} else {
driver.findElement(By.cssSelector("[testId='cancelUpdateSandboxButton']")).click();
}
waitForUIReadiness();
assertTrue(driver.findElement(By.className("pageTitle")).getText().startsWith("Sandbox: "));
}
Expand Down Expand Up @@ -320,10 +328,11 @@ SandboxConfig createSandBox(Standard standard, String version, String suiteName,
driver.findElement(By.id("mat-input-0")).sendKeys(sandboxName);
driver.findElement(By.id("createSandboxButton")).click();

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("sandboxUrlInput")));
String sandboxURL = driver.findElement(By.id("sandboxUrlInput")).getAttribute("value");
String sandboxAuthHeaderName = driver.findElement(By.id("sandboxAuthHeaderNameInput")).getAttribute("value");
String sandboxAuthHeaderValue = driver.findElement(By.id("sandboxAuthHeaderValueInput")).getAttribute("value");
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[testId='sandboxNameInput']")));
boolean noSandboxUrlInput = driver.findElements(By.cssSelector("[testId='sandboxUrlInput']")).isEmpty();
String sandboxURL = noSandboxUrlInput ? null : driver.findElement(By.cssSelector("[testId='sandboxUrlInput']")).getAttribute("value");
String sandboxAuthHeaderName = noSandboxUrlInput ? null : driver.findElement(By.cssSelector("[testId='sandboxAuthHeaderNameInput']")).getAttribute("value");
String sandboxAuthHeaderValue = noSandboxUrlInput ? null : driver.findElement(By.cssSelector("[testId='sandboxAuthHeaderValueInput']")).getAttribute("value");
return new SandboxConfig(
null,
sandboxName,
Expand Down
11 changes: 7 additions & 4 deletions webui/src/app/pages/edit-sandbox/edit-sandbox.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<br/>
<mat-form-field class="fullWidth">
<input
testId="sandboxNameInput"
matInput
type="text"
autocomplete="off"
Expand All @@ -39,6 +40,7 @@
<div *ngFor="let method of endpointUriAndMethods.methods">
<div class="paragraph">{{ method }} {{ endpointUriAndMethods.endpointUri }}</div>
<input
testId="sandboxUrlInput"
class="readOnlyInput"
type="text"
readonly="readonly"
Expand All @@ -59,15 +61,15 @@
</div>
<div class="paragraph">Sandbox authentication header name:</div>
<input
id="sandboxAuthHeaderNameInput"
testId="sandboxAuthHeaderNameInput"
class="readOnlyInput"
type="text"
readonly="readonly"
[value]="originalSandboxConfig!.sandboxAuthHeaderName"
/>
<div class="paragraph">Sandbox authentication header value:</div>
<input
id="sandboxAuthHeaderValueInput"
testId="sandboxAuthHeaderValueInput"
class="readOnlyInput"
type="text"
readonly="readonly"
Expand All @@ -88,7 +90,7 @@
<div>
<br/>
<mat-form-field class="fullWidth">
<mat-label>Base URL for all your endpoints</mat-label>
<mat-label>Application endpoints base URL</mat-label>
<input
matInput
type="text"
Expand Down Expand Up @@ -218,7 +220,7 @@
<br/>
<div>
<button
id="updateSandboxButton"
testId="updateSandboxButton"
mat-raised-button
color="primary"
type="submit"
Expand All @@ -229,6 +231,7 @@
</button>
&nbsp;
<button
testId="cancelUpdateSandboxButton"
mat-raised-button
type="button"
(click)="onCancel()"
Expand Down

0 comments on commit 22169e5

Please sign in to comment.