Skip to content

Commit

Permalink
Fixed #720 - handle global account select while a transactions is hig…
Browse files Browse the repository at this point in the history
…hlighted
  • Loading branch information
deadlocker8 committed Sep 11, 2022
1 parent d664085 commit 01b8fd1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ public String selectAccount(HttpServletRequest request, @PathVariable("ID") Inte
return ReturnValues.SETTINGS;
}

if(referer.contains("highlight"))
{
final StringBuffer requestURL = request.getRequestURL();
final String baseUrl = requestURL.substring(0, requestURL.length() - request.getRequestURI().length());
referer = baseUrl + "/transactions/";
}

if(referer.contains(ACCOUNT_SELECTED_INDICATOR))
{
return MessageFormat.format("redirect:{0}", referer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.File;
import java.time.Duration;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -131,10 +134,37 @@ void highlight()

List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top"));
assertThat(transactionsRows).hasSize(25);
assertThat(transactionsRows.get(0).getAttribute("class")).contains("background-blue-light");
assertThat(transactionsRows.get(0).getAttribute("class")).contains("transaction-row-highlighted");
for(int i = 1; i < transactionsRows.size(); i++)
{
assertThat(transactionsRows.get(i).getAttribute("class")).doesNotContain("background-blue-light");
assertThat(transactionsRows.get(i).getAttribute("class")).doesNotContain("transaction-row-highlighted");
}
}

@Test
void test_selectAccountWhileTransactionIsHighlighted()
{
driver.findElement(By.cssSelector(".main-card .search-result .hide-on-med-and-down .buttonHighlight")).click();

assertThat(driver.findElement(By.cssSelector(".headline-date")).getText()).isEqualTo("May 2019");

List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top"));
assertThat(transactionsRows).hasSize(25);
assertThat(transactionsRows.get(0).getAttribute("class")).contains("transaction-row-highlighted");

// open global account select
final WebElement globalAccountSelect = driver.findElement(By.id("globalAccountSelect"));
globalAccountSelect.click();

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#modalGlobalAccountSelect h4")));

driver.findElement(By.id("modalGlobalAccountSelect")).sendKeys("3");

wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("#modalGlobalAccountSelect h4")));

assertThat(driver.findElement(By.cssSelector("#globalAccountSelect .global-account-select-name")).getText())
.isEqualTo("sfsdf");
}
}

0 comments on commit 01b8fd1

Please sign in to comment.