Tag: javascript

Postman urlencode multiple env variables

As an API development tool, Postman is widely used by developers for testing, documenting, and sharing APIs. One of the most powerful features of Postman is the ability to execute code before a request is sent, which is known as a pre-request script. This functionality allows dev…

How to do polling in Svelte and InertiaJS

Just a quick snippet about how to do polling the Svelte way. import { onDestroy } from "svelte" let interval const poll = () => { clearTimeout(interval) Inertia.reload() interval = setTimeout(poll, 1000) } poll() onDestroy(() => clearTimeout(interval)) …

Testing svelte-dnd-action with Cypress

Using Drag & Drop is probably easier than ever due to virtually unlimited supply of new front-end libraries appearing every day. Making Drag & Drop for a sortable trello-like boards or for file uploads work in the browser is thus becoming a matter of importing a module an…

Test preserveScroll in InertiaJS with Cypress

A short snippet that makes it possible to test if preserveScroll feature is enabled in InertiaJS. Can be used as a part of Test-Driven Development process (TDD). The snippet can probably be adapted for other scroll related tests, but is especially geared towards the InertiaJS fea…

A basic InertiaJS test macro

I've made a macro for the Illuminate\Testing\TestResponse class that I put into the TestCase.php file which is a part of pingcrm-svelte. I currently use this short macro in basically all HTTP tests for Inertia related endpoints in Laravel, so unless I am doing something wrong, it…