Skip to content

Instantly share code, notes, and snippets.

View danielpotthast's full-sized avatar

Daniel Potthast danielpotthast

View GitHub Profile
it("expect no JavaScript error", () => {
let jsErrors = [];
let errorMessages = [];
jsErrors.forEach(error => errorMessages.push(error.message));
let allowedJsErrors = page.allowedJsErrors | 0;
expect(jsErrors).to.have.length(allowedJsErrors, "array of javascript errors must be empty, but found " + jsErrors.length + " error(s):\r\n" + errorMessages)
});
if (typeof site.gtmCodes !== "undefined") {
site.gtmCodes.forEach(gtmCode => {
it("expect GTM-Code '" + gtmCode + "'", () => {
let gtmArray = Object.keys(getWindowVariable("google_tag_manager"));
expect(gtmArray).to.include(gtmCode, "GTM-Code not found in google_tag_manager array keys '" + gtmArray + "'");
});
});
}
before(() => {
browser.url(site.baseUrl + page.path).waitForVisible("body", 2000);
});
{
"name": "sblum GmbH",
"short_name": "sblum",
"description": "sblum GmbH aus München",
"lang": "de",
"start_url": "./",
"display": "standalone",
"orientation": "any",
"background_color": "#fafafa",
"theme_color": "#9b348e",
<link rel="manifest" href="/manifest.json">
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("sw.js");
}
</script>
const VERSION = "1.0";
const CACHE_VERSION = "sblum-offline-v" + VERSION;
const OFFLINE_URL = "/offline";
let cacheablePages = [
"/",
"/offline",
"/css/public.css",
"/fonts/font-awesome/fontawesome-webfont.woff2",
"/img/header/homepage.jpg",
// Cleanup old cache storages
self.addEventListener("activate", event => {
event.waitUntil(
caches.keys()
.then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (CACHE_VERSION !== cacheName) {
return caches.delete(cacheName);
}
self.addEventListener("fetch", (event) => {
event.respondWith(
caches.match(event.request)
.then(response => {
if (response) {
return response;
}
// Version #1: Cache all (!) responses and return error page
// Clone the request
<?php
class data
{
private $data;
public function __construct($data)
{
$this->data = $data;
}
<?php
namespace Tests\Demo;
use Demo\ProductList;
class ProductListTest extends \PHPUnit_Framework_TestCase
{
public function testProductList()
{