Dennes Schäffler 9a9e0aed87 initial commit
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00
2025-11-11 09:00:50 +01:00

Venabo GraphQL Templates

A simple JavaScript tool to run and test GraphQL queries against the Venabo API.

Features

  • 🚀 Automatically discovers and runs all .gql files in the directory
  • Validates GraphQL queries and mutations
  • 📊 Provides test results summary
  • 🔍 Verbose mode for detailed output
  • 🎨 Colorized terminal output

Setup

  1. Install dependencies:
yarn install

Usage

Run all tests

yarn test

Or directly:

node run-tests.js

Run with verbose output

yarn test:verbose

Or:

node run-tests.js --verbose

Custom GraphQL Endpoint

Set the GRAPHQL_ENDPOINT environment variable to use a different endpoint:

# Windows PowerShell
$env:GRAPHQL_ENDPOINT="https://your-endpoint.com/graphql"; node run-tests.js

# Windows CMD
set GRAPHQL_ENDPOINT=https://your-endpoint.com/graphql && node run-tests.js

# Linux/Mac
GRAPHQL_ENDPOINT=https://your-endpoint.com/graphql node run-tests.js

Default endpoint: https://venabo.phx-erp.cloud/backend-api/admin-api

Custom Authorization Token

Set the AUTH_TOKEN environment variable to use a different Bearer token:

# Windows PowerShell
$env:AUTH_TOKEN="your-token-here"; node run-tests.js

# Windows CMD
set AUTH_TOKEN=your-token-here && node run-tests.js

# Linux/Mac
AUTH_TOKEN=your-token-here node run-tests.js

Note: All requests include an Authorization: Bearer <token> header.

Using .env File

You can create a .env file in the project root to store your configuration:

GRAPHQL_ENDPOINT=https://venabo.phx-erp.cloud/backend-api/admin-api
AUTH_TOKEN=your-token-here

The .env file is automatically loaded when you run the tests. Environment variables set in your shell will override values in the .env file.

Test Files

Create .gql files in the project directory. Each file should contain a valid GraphQL query, mutation, or subscription:

Example: Artikel.gql

query {
  getProducts(input: { take: 10 }) {
    items {
      id
      identifierAlias: identifier
    }
  }
}

The tool will automatically:

  • Discover all .gql files
  • Extract the query/mutation/subscription
  • Send it to the GraphQL endpoint
  • Report success or failure

Output

The tool provides:

  • Success indicators for passing tests
  • Error messages for failing tests
  • 📊 Summary statistics at the end
  • 🔍 Detailed output in verbose mode (including query content and response data)

Exit Codes

  • 0 - All tests passed
  • 1 - One or more tests failed
Description
No description provided
Readme 30 KiB
Languages
JavaScript 100%