Skip to content

Instantly share code, notes, and snippets.

import { selectors } from "../fixtures/selectors";
import { PATHS, LITERALS } from "../fixtures/constants";
const screenshotOptions = {
overwrite: true
};
describe("My ToDo App", () => {
beforeEach(() => {
cy.visit("/");
<template>
<header>
<img
alt="Vue logo"
class="logo"
src="@/assets/logo.svg"
width="125"
height="125"
/>
<script setup>
//imports
import { ref, onMounted, computed } from "vue";
import BlogList from "src/components/ListBlog.vue";
import MainContainer from "src/components/MainContainer.vue";
import { useQuasar } from "quasar";
import { createSubscription } from "../services/ApiService";
import qs from "qs";
//variables
/*
events - push
*/
self.addEventListener("push", (event) => {
if (event.data) {
let data = JSON.parse(event.data.text());
event.waitUntil(
self.registration.showNotification(data.title, {
body: data.body,
<template>
<MainContainer>
<transition
appear
enter-active-class="animated fadeIn"
leave-active-class="animated fadeOut"
>
<div
v-if="showNotificationsBanner && pushNotificationsSupported"
class="banner-container bg-primary"
let webpush = require("web-push");
const publicKey =
"Your-public-key";
const privateKey = "Your-private-key";
/*
config - webpush
<script setup>
//imports
import { useRouter } from "vue-router";
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
//variables
const router = useRouter();
const showInsatllbanner = ref(false);
const leftDrawerOpen = ref(false);
<template>
//rest of the code
<q-card
class="my-card q-ma-lg"
:class="{ 'bg-red-1': blog.offline }"
flat
bordered
v-for="blog in blogList"
:key="blog.key"
@click="redirectToBlog(blog.id)"
if (!navigator.onLine && isBackgroundSyncSupported.value) {
// Notify user about successful blog creation
$q.notify({
message: "Offline Blog Created Successfully!",
type: "positive",
timeout: 2000,
});
// Redirect to the home page
router.push("/");
import { Queue } from "workbox-background-sync";
let backgroundSync = "sync" in self.registration ? true : false;
/*
queue- create post
*/
let createBlogQueue = null;
if (backgroundSync) {
createBlogQueue = new Queue("createBlogQueue", {