Skip to content

Commit

Permalink
Merge pull request #137 from Edirom/issue-123
Browse files Browse the repository at this point in the history
Issue 123
  • Loading branch information
peterstadler authored Dec 15, 2022
2 parents 24b3ee5 + 0821516 commit 8855ce4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions resources/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ function closeModal() {
function ajaxLogin(user, pass) {
const xhttp = new XMLHttpRequest();
let postBody;

// trigger page reload if login/logout via modal
const caller = arguments.callee.caller?.name;
const reload = caller === "closeModal" || caller === "showModal";

xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
updateLoginInfo(JSON.parse(this.responseText));
if (reload) {
window.location.reload();
}
}
};
if(user === "logout" && pass === "logout") {
Expand Down
5 changes: 3 additions & 2 deletions testing/src/test/java/mermeid/MermeidTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ public void enterLogin(){
modal.findElement(By.xpath(".//button[@type='submit']")).click();

// check login name
wait.until(ExpectedConditions.textToBePresentInElement(loginTextElement, loginUser));
WebElement loginTextElementOnNewPage = wait.until(ExpectedConditions.elementToBeClickable(By.id("login-info")));
wait.until(ExpectedConditions.textToBePresentInElement(loginTextElementOnNewPage, loginUser));
System.out.print("Function `enterLogin` log: new login name - ");
System.out.println(loginTextElement.getText());
System.out.println(loginTextElementOnNewPage.getText());
} catch(org.openqa.selenium.TimeoutException e) {
System.out.print("Function `enterLogin` log: ");
System.out.println("Timed out waiting for element 'login-info'!");
Expand Down

0 comments on commit 8855ce4

Please sign in to comment.