Simple frontend TypeScript testing utility

Related tags

TestingTSFTest
Overview

TSFTest

Simple frontend TypeScript testing utility.

Installation

Install webpack in your project directory:

npm install --save-dev webpack webpack-cli typescript ts-loader

Install the typescript functions also in your project directory:

npm install --save-dev tsftest

Install chromedriver and add to path https://chromedriver.chromium.org/getting-started

Use pip to install the tsftest command (where path_to_dir is the folder containing setup.py):

pip install path_to_dir --user

Create a test folder in your project if you don't have one already.

Either:

  • Add tsconfig.json and webpack.config.js files to the test folder with settings to compile to test_dir/dist/test.js.

OR

  • See the setup command in the Usage section for a simple command to add these files with a default configuration.

Usage

To add default required configuration files if the files don't exist, run:

python -m tsftest setup path_to_test_folder

To run the tests use (consider setting this in your package.json->scripts.test):

python -m tsftest path_to_test_folder

You can make a browser window open with the tests allowing the use of browser developer tools with:

python -m tsftest --headed path_to_test_folder

Example Test

{ let request = new ApiRequest("GET", "/"); t.describe("ApiRequest should have GET method"); t.assert(request.method, "GET"); } ) test("Api class", async (t: Test) => { let api = new Api(new URL("http://127.0.0.1"), new ApiCredentials()) let request = new ApiRequest("GET", "/"); let response = await api.call(request) t.describe("Api.call should return an instance of Response"); t.assertInstance(response, Response); t.describe("Testing successful Api.call to /"); t.assert(response.ok, true); } ) ">
import { Api, ApiCredentials, ApiRequest } from "../src/api";
import { test, Test } from "tsftest"

test("ApiRequest class",
    (t: Test) => {
        let request = new ApiRequest("GET", "/");

        t.describe("ApiRequest should have GET method");
        t.assert(request.method, "GET");
    }
)

test("Api class",
    async (t: Test) => {
        let api = new Api(new URL("http://127.0.0.1"), new ApiCredentials())
        let request = new ApiRequest("GET", "/");

        let response = await api.call(request)

        t.describe("Api.call should return an instance of Response");
        t.assertInstance(response, Response);

        t.describe("Testing successful Api.call to /");
        t.assert(response.ok, true);
    }
)
Pymox - open source mock object framework for Python

Pymox is an open source mock object framework for Python. First Steps Installation Tutorial Documentation http://pymox.readthedocs.io/en/latest/index.

Ivan Rocha 7 Feb 02, 2022
Checks for a 200 response from your subdomain list.

Check for available subdomains Written in Python, this terminal based application looks for a 200 response from the subdomain list you've provided. En

Sean 1 Nov 03, 2021
Run ISP speed tests and save results

SpeedMon Automatically run periodic internet speed tests and save results to a variety of storage backends. Supported Backends InfluxDB v1 InfluxDB v2

Matthew Carey 9 May 08, 2022
Doing dirty (but extremely useful) things with equals.

Doing dirty (but extremely useful) things with equals. Documentation: dirty-equals.helpmanual.io Source Code: github.com/samuelcolvin/dirty-equals dir

Samuel Colvin 602 Jan 05, 2023
a socket mock framework - for all kinds of socket animals, web-clients included

mocket /mɔˈkɛt/ A socket mock framework for all kinds of socket animals, web-clients included - with gevent/asyncio/SSL support ...and then MicroPytho

Giorgio Salluzzo 249 Dec 14, 2022
bulk upload files to libgen.lc (Selenium script)

LibgenBulkUpload bulk upload files to http://libgen.lc/librarian.php (Selenium script) Usage ./upload.py to_upload uploaded rejects So title and autho

8 Jul 07, 2022
A small faсade for the standard python mocker library to make it user-friendly

unittest-mocker Inspired by the pytest-mock, but written from scratch for using with unittest and convenient tool - patch_class Installation pip insta

Vertliba V.V. 6 Jun 10, 2022
Fail tests that take too long to run

GitHub | PyPI | Issues pytest-fail-slow is a pytest plugin for making tests fail that take too long to run. It adds a --fail-slow DURATION command-lin

John T. Wodder II 4 Nov 27, 2022
自动化爬取并自动测试所有swagger-ui.html显示的接口

swagger-hack 在测试中偶尔会碰到swagger泄露 常见的泄露如图: 有的泄露接口特别多,每一个都手动去试根本试不过来 于是用python写了个脚本自动爬取所有接口,配置好传参发包访问 原理是首先抓取http://url/swagger-resources 获取到有哪些标准及对应的文档地

jayus 534 Dec 29, 2022
LuluTest is a Python framework for creating automated browser tests.

LuluTest LuluTest is an open source browser automation framework using Python and Selenium. It is relatively lightweight in that it mostly provides wr

Erik Whiting 14 Sep 26, 2022
Airspeed Velocity: A simple Python benchmarking tool with web-based reporting

airspeed velocity airspeed velocity (asv) is a tool for benchmarking Python packages over their lifetime. It is primarily designed to benchmark a sing

745 Dec 28, 2022
Webscreener is a tool for mass web domains pentesting.

Webscreener is a tool for mass web domains pentesting. It is used to take snapshots for domains that is generated by a tool like knockpy or Sublist3r. It cuts out most of the pentesting time by scree

Seekurity 3 Jun 07, 2021
Command line driven CI frontend and development task automation tool.

tox automation project Command line driven CI frontend and development task automation tool At its core tox provides a convenient way to run arbitrary

tox development team 3.1k Jan 04, 2023
Testing - Instrumenting Sanic framework with Opentelemetry

sanic-otel-splunk Testing - Instrumenting Sanic framework with Opentelemetry Test with python 3.8.10, sanic 20.12.2 Step to instrument pip install -r

Donler 1 Nov 26, 2021
A grab-bag of nifty pytest plugins

A goody-bag of nifty plugins for pytest OS Build Coverage Plugin Description Supported OS pytest-server-fixtures Extensible server-running framework w

Man Group 492 Jan 03, 2023
Object factory for Django

Model Bakery: Smart fixtures for better tests Model Bakery offers you a smart way to create fixtures for testing in Django. With a simple and powerful

Model Bakers 632 Jan 08, 2023
pytest splinter and selenium integration for anyone interested in browser interaction in tests

Splinter plugin for the pytest runner Install pytest-splinter pip install pytest-splinter Features The plugin provides a set of fixtures to use splin

pytest-dev 238 Nov 14, 2022
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.

Mockoon Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source. It has been built wi

mockoon 4.4k Dec 30, 2022
pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite

pytest_pyramid pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite. By default, pytest_pyramid will create

Grzegorz Śliwiński 12 Dec 04, 2022
PyAutoEasy is a extension / wrapper around the famous PyAutoGUI, a cross-platform GUI automation tool to replace your boooring repetitive tasks.

PyAutoEasy PyAutoEasy is a extension / wrapper around the famous PyAutoGUI, a cross-platform GUI automation tool to replace your boooring repetitive t

Dingu Sagar 7 Oct 27, 2022