This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void doWebNotificationTesting() throws Exception { | |
driver = utils.launchBrowser(); | |
driver.navigate().to("https://pushjs.org/#"); | |
UINotificationService uiNotificationService = UINotificationService.getInstance(driver); | |
uiNotificationService.startWebNotificationListener(); | |
driver.findElement(By.id("demo_button")).click(); | |
utils.waitFor(2); | |
Map<String,String> notificationFilter = new HashMap<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sahajamit.utils; | |
import org.openqa.selenium.JavascriptExecutor; | |
import org.openqa.selenium.WebDriver; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.concurrent.atomic.AtomicBoolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To Stop Listening to all Web Push Notifications | |
clearInterval(window.notificationListener); | |
window.notificationsMap = Object.create(null); | |
window.notifications = [] ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To Collect all the notifications arrived till now | |
function getCollectedNotifications(){ | |
window.notifications = [] ; | |
var count = 0; | |
for (var prop in window.notificationsMap) | |
count++; window.notifications.push(window.notificationsMap[prop]); | |
} | |
console.log("Total notifications count is: " + count); | |
return window.notifications; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To Start Listening to all Web Push Notifications | |
window.notificationsMap = Object.create(null); | |
async function getServiceWorkerRegistration(){ | |
window.myServiceWorkerRegistration = await navigator.serviceWorker.getRegistration("https://framework.realtime.co/demo/web-push/"); | |
return window.myServiceWorkerRegistration; | |
}; | |
async function getNotifications() { | |
window.myNotifications = await window.myServiceWorkerRegistration.getNotifications(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.notifications = []; | |
window.Notification = window.DefaultNotification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To Start Listening to all the Web Notifications | |
window.notifications = []; | |
window.DefaultNotification = window.Notification; | |
(function () { | |
function notificationCallback(title, opt) { | |
console.log("notification title: ", title); | |
console.log("notification body: ", opt.body); | |
console.log("notification tag: ", opt.tag); | |
console.log("notification icon: ", opt.icon); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//inject before starting the notification testing | |
window.notifications = []; | |
window.DefaultNotification = window.Notification; | |
(function () { | |
function notificationCallback(title, opt) { | |
console.log("notification title: ", title); | |
console.log("notification body: ", opt.body); | |
console.log("notification tag: ", opt.tag); | |
console.log("notification icon: ", opt.icon); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token) | |
NAMESPACE=myapp-dev | |
CONFIGMAP_NAME=testconfig | |
curl -sSk \ | |
-X PATCH \ | |
-d @- \ | |
-H "Authorization: Bearer $KUBE_TOKEN" \ | |
-H 'Accept: application/json' \ | |
-H'Content-Type: application/strategic-merge-patch+json' \ | |
https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/$NAMESPACE/configmaps/$CONFIGMAP_NAME <<'EOF' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/41789470/files-write-appending-new-lines-in-a-text-file | |
Files.write(Paths.get(filePath), (columnHeaders + System.lineSeparator()).getBytes(UTF_8), StandardOpenOption.CREATE,StandardOpenOption.APPEND); |