Merge pull request #1863 from stianst/KEYCLOAK-2050
KEYCLOAK-2050 KEYCLOAK-2051 Fix notifications
This commit is contained in:
commit
c05e21c049
5 changed files with 27 additions and 27 deletions
|
@ -53,10 +53,10 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feedback-aligner" data-ng-show="notification">
|
||||
<div class="feedback-aligner" data-ng-show="notification.display">
|
||||
<div class="alert alert-{{notification.type}} alert-dismissable">
|
||||
<button type="button" class="close">
|
||||
<span class="pficon pficon-close" data-ng-click="notification = null"/>
|
||||
<button type="button" class="close" data-ng-click="notification.remove()" id="notification-close">
|
||||
<span class="pficon pficon-close"/>
|
||||
</button>
|
||||
|
||||
<span class="pficon pficon-ok" ng-show="notification.type == 'success'"></span>
|
||||
|
|
|
@ -142,31 +142,32 @@ module.factory('Notifications', function($rootScope, $timeout) {
|
|||
var delay = 5000;
|
||||
|
||||
var notifications = {};
|
||||
|
||||
var scheduled = null;
|
||||
var schedulePop = function() {
|
||||
if (scheduled) {
|
||||
$timeout.cancel(scheduled);
|
||||
notifications.current = { display: false };
|
||||
notifications.current.remove = function() {
|
||||
if (notifications.scheduled) {
|
||||
$timeout.cancel(notifications.scheduled);
|
||||
delete notifications.scheduled;
|
||||
}
|
||||
delete notifications.current.type;
|
||||
delete notifications.current.header;
|
||||
delete notifications.current.message;
|
||||
notifications.current.display = false;
|
||||
console.debug("Remove message");
|
||||
}
|
||||
|
||||
scheduled = $timeout(function() {
|
||||
$rootScope.notification = null;
|
||||
scheduled = null;
|
||||
}, delay);
|
||||
};
|
||||
|
||||
if (!$rootScope.notifications) {
|
||||
$rootScope.notifications = [];
|
||||
}
|
||||
$rootScope.notification = notifications.current;
|
||||
|
||||
notifications.message = function(type, header, message) {
|
||||
$rootScope.notification = {
|
||||
type : type,
|
||||
header: header,
|
||||
message : message
|
||||
};
|
||||
notifications.current.type = type;
|
||||
notifications.current.header = header;
|
||||
notifications.current.message = message;
|
||||
notifications.current.display = true;
|
||||
|
||||
schedulePop();
|
||||
notifications.scheduled = $timeout(function() {
|
||||
notifications.current.remove();
|
||||
}, delay);
|
||||
|
||||
console.debug("Added message");
|
||||
}
|
||||
|
||||
notifications.info = function(message) {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class Authentication extends AdminConsoleRealm {
|
|||
@FindBy(xpath = "//div[contains(@class, 'alert-success')]")
|
||||
private WebElement success;
|
||||
|
||||
@FindBy(xpath = "//button[@class='close']/span")
|
||||
@FindBy(id = "notification-close")
|
||||
private WebElement close;
|
||||
|
||||
public String getSuccessMessage() {
|
||||
|
|
|
@ -67,7 +67,6 @@ public class OTPPolicyTest extends AbstractConsoleTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore //KEYCLOAK-2051 when you close notification, it is not displayed again
|
||||
public void invalidValuesTest() {
|
||||
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "", "30");
|
||||
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage());
|
||||
|
|
|
@ -47,7 +47,7 @@ public class URLAssert {
|
|||
// }
|
||||
// };
|
||||
// wait.until(urlStartsWith);
|
||||
assertTrue(startsWithNormalized(driver.getCurrentUrl(), url));
|
||||
assertTrue("'" + driver.getCurrentUrl() + " does not start with '" + url + "'", startsWithNormalized(driver.getCurrentUrl(), url));
|
||||
}
|
||||
|
||||
public static void assertCurrentUrlDoesntStartWith(AbstractPage page) {
|
||||
|
|
Loading…
Reference in a new issue