This file contains hidden or 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
| const getPosts = async (username, from) => { | |
| let res = await fetch("https://medium.com/_/graphql", { | |
| "headers": { | |
| "content-type": "application/json", | |
| }, | |
| "body": JSON.stringify([{ | |
| variables: { | |
| homepagePostsFrom: from, | |
| includeDistributedResponses: true, | |
| id: null, |
This file contains hidden or 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
| { | |
| "version": "0", | |
| "id": "e683eeaa-4349-4921-7faf-232ac57cxf12", | |
| "detail-type": "My_Object__ChangeEvent", | |
| "source": "aws.partner/appflow/salesforce.com/1234567890", | |
| "account": "1234567890", | |
| "time": "2032-06-27T03:41:02Z", | |
| "region": "eu-west-1", | |
| "resources": [], | |
| "detail": { |
This file contains hidden or 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
| const readGlobalVar = async ({ page }) => { | |
| try { | |
| let variable = await page.evaluate(() => window.myVaraible) | |
| return variable | |
| } catch (error) { | |
| return Promise.reject(error) | |
| } | |
| } |
This file contains hidden or 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
| const takeAndSaveScreenShot = async ({ page }) => { | |
| try { | |
| const screenshot = await page.screenshot(); // now we have a png that we could save in s3 or locally with the fs package | |
| return 'Done' | |
| } catch (error) { | |
| return Promise.reject(error) | |
| } | |
| } |
This file contains hidden or 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
| const filterRequestForScript = (requestUrl) => { | |
| let someUrl = `https://somescript-cdn` // The script your looking for | |
| let myScriptWasFound = requestUrl.includes(someUrl) | |
| return myScriptWasFound | |
| } | |
| const checkIfScriptLoad = async ({ page, url }) => { | |
| try { | |
| let timeOutRacer = new Promise((resolve, reject) => { | |
| let wait = setTimeout(async () => { |
This file contains hidden or 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
| /** | |
| * @jest-environment jsdom | |
| */ | |
| import app from "../server/app"; | |
| import puppeteer from "puppeteer"; | |
| import { opts } from "./helpers/util"; | |
| const PORT = 3032; | |
| jest.setTimeout(60000); | |
| let browser = null; | |
| let instance = null |
This file contains hidden or 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
| import express from "express"; | |
| import path from "path"; | |
| import cookieParser from "cookie-parser"; | |
| const cors = require('cors'); | |
| let app = express(); | |
| app.use(cors()); | |
| app.use(express.json()); | |
| app.use(express.urlencoded({ extended: false })); | |
| app.use(cookieParser()); |
This file contains hidden or 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
| const store = createStore({ | |
| state: { | |
| count: 0 | |
| }, | |
| mutations: { | |
| increment (state) { | |
| state.count++ | |
| } | |
| }, | |
| actions: { |
This file contains hidden or 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
| export const useStore = defineStore('main', { | |
| state: () => ({ | |
| counter: 0, | |
| }), | |
| actions: { | |
| increment() { | |
| this.counter++ | |
| } | |
| }, | |
| }) |
NewerOlder