### Setup Project Source: https://github.com/usebruno/bruno/blob/main/contributing.md Installs dependencies and sets up the project for development. This is an alternative to manually building individual packages. ```bash npm run setup ``` -------------------------------- ### Install Dependencies and Start Test Server Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-tests/readme.md Installs Node.js dependencies and starts the test server. This server is used by the collections to hit endpoints. ```bash npm install ``` ```bash npm start ``` -------------------------------- ### Start Bruno Electron Development Server Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-electron/readme.md Run this command to start the development server for the bruno-electron project. ```bash npm start ``` -------------------------------- ### Install @usebruno/converters Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md Install the converters package using npm. ```bash npm install @usebruno/converters ``` -------------------------------- ### Install Dependencies and Run Electron App Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Ensure all project dependencies are installed before attempting to run the Electron app manually. ```bash npm install npm run dev:electron ``` -------------------------------- ### Install Bruno on Windows using Scoop Source: https://github.com/usebruno/bruno/blob/main/readme.md Use these commands to add the Scoop extras bucket and install Bruno on Windows. ```sh # On Windows via Scoop scoop bucket add extras scoop install bruno ``` -------------------------------- ### Install Bruno on Linux using Snap Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on Linux via the Snap package manager. ```sh # On Linux via Snap snap install bruno ``` -------------------------------- ### Install Bruno on Linux using Apt Source: https://github.com/usebruno/bruno/blob/main/readme.md Follow these steps to add the Bruno repository and install Bruno on Debian/Ubuntu-based Linux distributions using Apt. ```sh # On Linux via Apt sudo mkdir -p /etc/apt/keyrings sudo apt update && sudo apt install gpg curl curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9FA6017ECABE0266" \ | gpg --dearmor \ | sudo tee /etc/apt/keyrings/bruno.gpg > /dev/null sudo chmod 644 /etc/apt/keyrings/bruno.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/bruno.gpg] http://debian.usebruno.com/ bruno stable" \ | sudo tee /etc/apt/sources.list.d/bruno.list sudo apt update && sudo apt install bruno ``` -------------------------------- ### Example: Import WSDL File to Bruno Collection File Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md An example demonstrating how to read a WSDL file, convert it to a Bruno collection, and save it as a JSON file. Requires Node.js fs/promises module. ```javascript import { wsdlToBruno } from '@usebruno/converters'; import fs from 'fs/promises'; async function importWSDL() { try { // Read WSDL file const wsdlContent = await fs.readFile('service.wsdl', 'utf8'); // Convert to Bruno collection const brunoCollection = await wsdlToBruno(wsdlContent); // Save Bruno collection await fs.writeFile('soap-collection.json', JSON.stringify(brunoCollection, null, 2)); console.log('WSDL import successful!'); } catch (error) { console.error('Error during WSDL import:', error); } } importWSDL(); ``` -------------------------------- ### Install Bruno on Linux using Flatpak Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on Linux via the Flatpak package manager. ```sh # On Linux via Flatpak flatpak install com.usebruno.Bruno ``` -------------------------------- ### Run Development Server Source: https://github.com/usebruno/bruno/blob/main/contributing.md Starts the React frontend and Electron backend for local development. These commands can be run in separate terminals or concurrently. ```bash # run react app (terminal 1) npm run dev:web # run electron app (terminal 2) npm run dev:electron ``` ```bash # run electron and react app concurrently npm run dev ``` -------------------------------- ### Install Bruno on Windows using winget Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on Windows via the winget package manager. ```sh # On Windows via winget winget install Bruno.Bruno ``` -------------------------------- ### Install Playwright Browsers for CI Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Install necessary browsers for Playwright to run tests in a Continuous Integration environment. ```bash npx playwright install ``` -------------------------------- ### Install Bruno CLI Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Install the Bruno CLI globally using npm. This command makes the 'bru' command available in your terminal. ```bash npm install -g @usebruno/cli ``` -------------------------------- ### Troubleshoot Installation Source: https://github.com/usebruno/bruno/blob/main/contributing.md Commands to resolve 'Unsupported platform' errors during `npm install`. This involves recursively deleting `node_modules` and `package-lock.json` files from all subdirectories before reinstalling dependencies. ```bash # Delete node_modules in sub-directories find ./ -type d -name "node_modules" -print0 | while read -d $' ' dir; do rm -rf "$dir" done # Delete package-lock in sub-directories find . -type f -name "package-lock.json" -delete ``` -------------------------------- ### Run HTTPS Test Server Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Start the Node.js HTTPS server. It loads certificates from the 'certs/' directory and listens on port 8090. ```bash node index.js ``` -------------------------------- ### Install Bruno on Windows using Chocolatey Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on Windows via the Chocolatey package manager. ```sh # On Windows via Chocolatey choco install bruno ``` -------------------------------- ### Install Dependencies Source: https://github.com/usebruno/bruno/blob/main/contributing.md Installs project dependencies using npm. Ensure Node.js v22.x or the latest LTS version is used. The `--legacy-peer-deps` flag is used to handle potential peer dependency conflicts. ```bash nvm use npm i --legacy-peer-deps ``` -------------------------------- ### Install Bruno on Mac using Homebrew Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on macOS via the Homebrew package manager. ```sh # On Mac via Homebrew brew install bruno ``` -------------------------------- ### Example: Convert Postman Collection File to Bruno Collection File Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md An example demonstrating how to read a Postman collection from a file, convert it to Bruno format, and save it to a new file. Requires Node.js fs/promises module. ```javascript const { postmanToBruno } = require('@usebruno/converters'); const fs = require('fs/promises'); const path = require('path'); async function convertPostmanToBruno(inputFile, outputFile) { try { // Read Postman collection file const inputData = await fs.readFile(inputFile, 'utf8'); // Convert to Bruno collection const brunoCollection = await postmanToBruno(JSON.parse(inputData)); // Save Bruno collection await fs.writeFile(outputFile, JSON.stringify(brunoCollection, null, 2)); console.log('Conversion successful!'); } catch (error) { console.error('Error during conversion:', error); } } // Usage const inputFilePath = path.resolve(__dirname, 'demo_collection.postman_collection.json'); const outputFilePath = path.resolve(__dirname, 'bruno-collection.json'); convertPostmanToBruno(inputFilePath, outputFilePath); ``` -------------------------------- ### Vue Application Initialization Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/examples/report.html Initializes the Vue application and mounts it to the '#app' element. It also registers the 'naive' UI component library. This is a standard setup for a Vue application. ```javascript app.use(naive); app.mount('#app'); ``` -------------------------------- ### Install Bruno on Arch Linux via AUR Source: https://github.com/usebruno/bruno/blob/main/readme.md Use this command to install Bruno on Arch Linux via the AUR helper 'yay'. ```sh # On Arch Linux via AUR yay -S bruno ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Checks if the Docker image for Bruno CLI is working correctly by running a version check. ```bash docker run --rm usebruno/cli --version ``` -------------------------------- ### Create and Use Environment Variables in Playwright Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example of setting up a collection, creating a new environment, and adding a variable to it. ```typescript import { test, expect } from '../../playwright'; test('should create and use environment variables', async ({ page, createTmpDir }) => { const testDir = await createTmpDir('env-test'); // Setup collection await page.getByLabel('Create Collection').click(); await page.getByLabel('Name').fill('Environment Test'); await page.getByLabel('Location').fill(testDir); await page.getByRole('button', { name: 'Create' }).click(); // Create environment await page.getByRole('button', { name: 'Environments' }).click(); await page.getByRole('button', { name: 'Add Environment' }).click(); await page.getByLabel('Environment Name').fill('Development'); await page.getByRole('button', { name: 'Create' }).click(); // Add variable await page.getByRole('button', { name: 'Add Variable' }).click(); await page.getByLabel('Variable Name').fill('API_URL'); await page.getByLabel('Variable Value').fill('http://localhost:3000'); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByText('API_URL')).toBeVisible(); }); ``` -------------------------------- ### Generate PFX File for Windows Signing Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-electron/readme.md Use this command to generate a PFX file required for signing Windows builds. Ensure you have OpenSSL installed and the necessary key and certificate files. ```bash openssl pkcs12 -export -inkey sectigo.key -in sectigo.pem -out sectigo.pfx ``` -------------------------------- ### Verify CA Certificate Installation in Windows Certificate Store Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Check if the custom CA certificate has been successfully installed into the Windows Local Machine Root certificate store. ```powershell Get-ChildItem -Path Cert:\LocalMachine\Root | Where-Object { $_.Subject -like "*Local Dev CA*" } ``` -------------------------------- ### Using Multiple Playwright Fixtures Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example of how to utilize multiple custom Playwright fixtures, such as `createTmpDir` and `electronApp`, within a single test case. ```typescript test('Test with multiple fixtures', async ({ page, createTmpDir, electronApp }) => { const testDir = await createTmpDir('test-data'); // Your test logic here }); ``` -------------------------------- ### Create a New Collection in Playwright Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example test for creating a new collection, including setting its name and location. ```typescript import { test, expect } from '../../playwright'; test('should create a new collection', async ({ page, createTmpDir }) => { const testDir = await createTmpDir('new-collection'); await page.getByLabel('Create Collection').click(); await page.getByLabel('Name').fill('My Test Collection'); await page.getByLabel('Location').fill(testDir); await page.getByRole('button', { name: 'Create' }).click(); await expect(page.getByText('My Test Collection')).toBeVisible(); }); ``` -------------------------------- ### Playwright Configuration Example Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md This configuration sets the test directory, disables parallel execution and for bidding only in CI, configures retries for CI environments, and sets workers to undefined for CI and 1 otherwise. It also defines a project for the Bruno Electron App and configures web servers for the application and a ping endpoint. ```typescript export default defineConfig({ testDir: './e2e-tests', fullyParallel: false, forbidOnly: !!process.env.CI, retries: process.env.CI ? 1 : 0, workers: process.env.CI ? undefined : 1, projects: [ { name: 'Bruno Electron App' } ], webServer: [ { command: 'npm run dev:web', url: 'http://localhost:3000', reuseExistingServer: !process.env.CI }, { command: 'npm start --workspace=packages/bruno-tests', url: 'http://localhost:8081/ping', reuseExistingServer: !process.env.CI } ] }); ``` -------------------------------- ### Use Test Data Management in Playwright Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example of managing test data, including creating temporary directories and writing test files. ```typescript test('should work with test data', async ({ page, createTmpDir }) => { const testDir = await createTmpDir('test-data'); // Create test files await fs.writeFile(path.join(testDir, 'test.bru'), testContent); // Use in test await page.getByLabel('Open Collection').click(); await page.getByText(testDir).click(); }); ``` -------------------------------- ### Instalare Bruno cu Apt pe Linux Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_ro.md Instalează Bruno pe Linux folosind Apt, inclusiv configurarea cheii GPG și a sursei de pachete. ```shell # Pe Linux cu Apt sudo mkdir -p /etc/apt/keyrings sudo apt update && sudo apt install gpg curl curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9FA6017ECABE0266" \ | gpg --dearmor \ | sudo tee /etc/apt/keyrings/bruno.gpg > /dev/null sudo chmod 644 /etc/apt/keyrings/bruno.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/bruno.gpg] http://debian.usebruno.com/ bruno stable" \ | sudo tee /etc/apt/sources.list.d/bruno.list sudo apt update && sudo apt install bruno ``` -------------------------------- ### Instalacja Bruno za pomocą Snap (Linux) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Linux przy użyciu menedżera pakietów Snap. ```sh # On Linux via Snap snap install bruno ``` -------------------------------- ### Instalare Bruno cu Chocolatey pe Windows Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_ro.md Instalează Bruno pe Windows folosind Chocolatey. ```shell # Pe Windows cu Chocolatey choco install bruno ``` -------------------------------- ### Linux'ta Apt ile Bruno Kurulumu Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_tr.md Debian tabanlı Linux dağıtımları için Apt paket yöneticisini kullanarak Bruno'yu yüklemek için kullanılır. Bu yöntem, Bruno'nun resmi APT deposunu eklemeyi içerir. ```sh # Apt aracılığıyla Linux'ta sudo mkdir -p /etc/apt/keyrings sudo apt update && sudo apt install gpg curl curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9FA6017ECABE0266" \ | gpg --dearmor \ | sudo tee /etc/apt/keyrings/bruno.gpg > /dev/null sudo chmod 644 /etc/apt/keyrings/bruno.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/bruno.gpg] http://debian.usebruno.com/ bruno stable" \ | sudo tee /etc/apt/sources.list.d/bruno.list sudo apt update && sudo apt install bruno ``` -------------------------------- ### Instalare Bruno cu Homebrew pe Mac Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_ro.md Instalează Bruno pe macOS folosind Homebrew. ```shell # Pe Mac cu Homebrew brew install bruno ``` -------------------------------- ### Instalacja Bruno za pomocą Apt (Linux) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Linux przy użyciu menedżera pakietów Apt. Wymaga dodania klucza GPG i repozytorium. ```sh # On Linux via Apt sudo mkdir -p /etc/apt/keyrings sudo apt update && sudo apt install gpg curl curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9FA6017ECABE0266" \ | gpg --dearmor \ | sudo tee /etc/apt/keyrings/bruno.gpg > /dev/null sudo chmod 644 /etc/apt/keyrings/bruno.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/bruno.gpg] http://debian.usebruno.com/ bruno stable" \ | sudo tee /etc/apt/sources.list.d/bruno.list sudo apt update && sudo apt install bruno ``` -------------------------------- ### CLI: Import WSDL to Directory Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md Use the Bruno CLI to import a WSDL file into a specified directory as a Bruno collection. ```bash bruno import wsdl --source service.wsdl --output ~/Desktop/soap-collection --collection-name "SOAP Service" ``` -------------------------------- ### Linux'ta Snap ile Bruno Kurulumu Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_tr.md Linux kullanıcıları için Snap paket yöneticisini kullanarak Bruno'yu yüklemek için kullanılır. Snap, uygulamaları dağıtmak ve yönetmek için evrensel bir paketleme sistemidir. ```sh # Snap aracılığıyla Linux'ta snap install bruno ``` -------------------------------- ### Run Bru CLI on Collection Against Prod Server Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-tests/readme.md Navigates to the collection directory and runs the Bru CLI against a production server hosted at https://testbench.usebruno.com. Outputs results in JUnit XML format. ```bash cd collection # run collection against prod server hosted at https://testbench.usebruno.com node ../../bruno-cli/bin/bru.js run --env Prod --output junit.xml --format junit ``` -------------------------------- ### Run Bru CLI on Collection Against Local Server Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-tests/readme.md Navigates to the collection directory and runs the Bru CLI against a local server. Outputs results in JUnit XML format. ```bash cd collection # run collection against local server node ../../bruno-cli/bin/bru.js run --env Local --output junit.xml --format junit ``` -------------------------------- ### Add Meaningful Assertions in Playwright Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example demonstrating how to add assertions to verify expected outcomes after an action. ```typescript test('should save request successfully', async ({ page }) => { // Arrange await page.getByLabel('Create Collection').click(); // Act await page.getByRole('button', { name: 'Save' }).click(); // Assert await expect(page.getByText('Request saved successfully')).toBeVisible(); await expect(page.getByRole('tab', { name: 'GET request' })).toBeVisible(); }); ``` -------------------------------- ### Instalacja Bruno za pomocą Flatpak (Linux) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Linux przy użyciu menedżera pakietów Flatpak. ```sh # On Linux via Flatpak flatpak install com.usebruno.Bruno ``` -------------------------------- ### Create Isolated Playwright Tests Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Example of an isolated test that creates its own temporary directory for data and cleans up automatically. ```typescript test('should create collection', async ({ page, createTmpDir }) => { const testDir = await createTmpDir('collection-test'); // Test creates its own data await page.getByLabel('Create Collection').click(); await page.getByLabel('Name').fill('test-collection'); await page.getByLabel('Location').fill(testDir); // Clean up happens automatically via createTmpDir }); ``` -------------------------------- ### Access Nested Property Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-query/readme.md Use the `get` function to access a deeply nested property within a data object. ```javascript get(data, 'customer.orders.items.amount') ``` -------------------------------- ### CLI: Import WSDL from URL to Directory Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md Use the Bruno CLI to import a WSDL file from a URL into a specified directory as a Bruno collection. ```bash bruno import wsdl --source https://example.com/service.wsdl --output ~/Desktop --collection-name "Remote SOAP Service" ``` -------------------------------- ### Import OpenAPI Collection using Aliases Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Import an OpenAPI specification using shorthand aliases for source, output, and collection name. ```bash bru import openapi -s api.yml -o ~/Desktop/my-collection -n "My API" ``` -------------------------------- ### Run Requests with Environment Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Execute API requests using a specific environment configuration. Replace 'Local' with your desired environment name. ```bash bru run folder --env Local ``` -------------------------------- ### Instalacja Bruno za pomocą Homebrew (macOS) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie macOS przy użyciu menedżera pakietów Homebrew. ```sh # On Mac via Homebrew brew install bruno ``` -------------------------------- ### Instalacja Bruno za pomocą Scoop (Windows) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Windows przy użyciu menedżera pakietów Scoop. Wymaga dodania repozytorium 'extras'. ```sh # On Windows via Scoop scoop bucket add extras scoop install bruno ``` -------------------------------- ### CLI: Import WSDL to JSON File Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-converters/readme.md Use the Bruno CLI to import a WSDL file and save the resulting Bruno collection directly to a JSON file. ```bash bruno import wsdl --source service.wsdl --output-file ~/Desktop/soap-collection.json --collection-name "SOAP Service" ``` -------------------------------- ### Test Certificate Verification with OpenSSL (Unix/Linux/macOS) Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Use OpenSSL's s_client to connect to the server and verify the certificate chain using the generated CA certificate. ```bash openssl s_client -connect localhost:8090 -CAfile certs/ca-cert.pem ``` -------------------------------- ### Executing Bruno CLI from Repo Directory Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Navigates to the bruno-tests directory and runs the docker compose command to execute Bruno CLI tests. ```bash cd packages/bruno-tests docker compose run bruno-cli ``` -------------------------------- ### Import OpenAPI Collection to Directory Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Import an OpenAPI specification file into a Bruno collection directory. Specify the source file, output directory, and collection name. ```bash bru import openapi --source api.yml --output ~/Desktop/my-collection --collection-name "My API" ``` -------------------------------- ### Instalacja Bruno za pomocą winget (Windows) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Windows przy użyciu menedżera pakietów winget. ```sh # On Windows via winget winget install Bruno.Bruno ``` -------------------------------- ### Import OpenAPI Collection from URL Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Import an OpenAPI specification directly from a URL. The collection will be saved to the specified output directory. ```bash bru import openapi --source https://example.com/api-spec.json --output ~/Desktop --collection-name "Remote API" ``` -------------------------------- ### Build Packages Source: https://github.com/usebruno/bruno/blob/main/contributing.md Builds individual packages within the Bruno project. This includes generating GraphQL documentation, compiling query logic, common utilities, converters, request handlers, schema types, and filesystem utilities. It also bundles JavaScript sandbox libraries. ```bash npm run build:graphql-docs npm run build:bruno-query npm run build:bruno-common npm run build:bruno-converters npm run build:bruno-requests npm run build:schema-types npm run build:bruno-filestore npm run sandbox:bundle-libraries --workspace=packages/bruno-js ``` -------------------------------- ### Build Debian Docker Image Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/debian/README.md Builds the default Debian slim Docker image for the Bruno CLI. ```bash docker build -t usebruno/cli:debian ./images/debian ``` -------------------------------- ### Run Bruno Collection (Windows CMD) Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Executes Bruno collection commands using Docker for Windows CMD users, substituting `$(pwd)` with `%cd%`. ```cmd docker run -v %cd%:/bruno usebruno/cli run ``` -------------------------------- ### Mac'te Homebrew ile Bruno Kurulumu Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_tr.md macOS kullanıcıları için Homebrew paket yöneticisini kullanarak Bruno'yu yüklemek için kullanılır. Bu, Bruno'yu kurmanın en yaygın ve önerilen yollarından biridir. ```sh # Homebrew aracılığıyla Mac'te brew install bruno ``` -------------------------------- ### Run Collection with Debian Docker Image Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/debian/README.md Runs a Bruno collection using the default Debian slim Docker image. Mounts the current directory to /bruno inside the container. ```bash docker run -v $(pwd):/bruno usebruno/cli:debian run ``` -------------------------------- ### Windows'ta Scoop ile Bruno Kurulumu Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_tr.md Windows kullanıcıları için Scoop paket yöneticisini kullanarak Bruno'yu yüklemek için kullanılır. Scoop, uygulamaları yönetmek için başka bir popüler seçenektir. ```sh # Scoop aracılığıyla Windows'ta scoop bucket add extras scoop install bruno ``` -------------------------------- ### Run Bruno CLI Collection with Docker Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/alpine/README.md Executes a Bruno collection using the Docker image. Mounts the current directory to /bruno inside the container. Supports running with a pinned version of the CLI. ```bash docker run -v $(pwd):/bruno usebruno/cli:alpine run ``` ```bash docker run -v $(pwd):/bruno usebruno/cli:3.3.0-alpine run ``` -------------------------------- ### Instalacja Bruno za pomocą Chocolatey (Windows) Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_pl.md Instaluje Bruno na systemie Windows przy użyciu menedżera pakietów Chocolatey. ```sh # On Windows via Chocolatey choco install bruno ``` -------------------------------- ### Run Requests and Output Results Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Execute API requests and save the test results to a JSON file. Specify the desired output filename. ```bash bru run folder --output results.json ``` -------------------------------- ### Running Docker Compose for Bruno CLI Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Command to execute the Bruno CLI service defined in a docker-compose.yml file. ```bash docker compose run bruno-cli ``` -------------------------------- ### Run Single Request Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Execute a specific API request by providing its filename. This is useful for targeted testing. ```bash bru run request.bru ``` -------------------------------- ### Generate CA Certificates Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Execute this script to generate the necessary CA certificates and private keys. It also handles adding the CA certificate to your system's truststore. ```bash node scripts/generate-certs.js ``` -------------------------------- ### Run All Requests in Collection Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Execute all API requests within the current collection directory. Ensure you are in the collection's root directory before running. ```bash bru run ``` -------------------------------- ### Initialize Vue App with Test Results Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/examples/report.html This JavaScript code initializes a Vue.js application. It sets up reactive state using `ref` and computed properties for displaying test results and summaries. The `res` object contains the raw test data. ```javascript const { createApp, ref, computed } = Vue; const App = { setup() { const res = { summary: { totalRequests: 10, passedRequests: 10, failedRequests: 0, totalAssertions: 4, passedAssertions: 0, failedAssertions: 4, totalTests: 0, passedTests: 0, failedTests: 0 }, results: [ { test: { filename: 'group1/test1.bru' }, request: { method: 'GET', url: 'http://localhost:3000/test/v4', headers: { Accept: '*/*', 'Accept-Encoding': 'gzip, deflate, br' } }, response: { status: 404, statusText: 'Not Found', headers: { 'x-powered-by': 'Express', 'content-security-policy': "default-src 'none'", 'x-content-type-options': 'nosniff', 'content-type': 'text/html; charset=utf-8', 'content-length': '146', date: 'Fri, 29 Sep 2023 00:37:50 GMT', connection: 'close' }, responseTime: 96, data: '\n\n\n Error
Cannot GET /test/v4
\n' }, error: null, assertionResults: [ { uid: 'oidgfXLiyD8Jv0NBAHUHF', lhsExpr: 'res.status', rhsExpr: '200', r ``` -------------------------------- ### Build Debian Docker Image with Specific Version Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/debian/README.md Builds the Debian slim Docker image for a specific Bruno CLI version using the BRUNO_VERSION build argument. ```bash docker build \ --build-arg BRUNO_VERSION=3.3.0 \ -t usebruno/cli:3.3.0-debian \ ./images/debian ``` -------------------------------- ### Run Bruno CLI Commands Source: https://github.com/usebruno/bruno/blob/main/readme.md Execute API collections using the Bruno CLI. Supports running entire collections, single requests, or folders with specific environments. ```sh # Run every request in the collection bru run # Run a single request bru run request.bru # Run a folder against a specific environment bru run folder --env Local ``` -------------------------------- ### Import OpenAPI Collection to JSON File Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Import an OpenAPI specification and export the resulting Bruno collection directly as a JSON file. ```bash bru import openapi --source api.yml --output-file ~/Desktop/my-collection.json --collection-name "My API" ``` -------------------------------- ### Run Bruno Collection with Docker Source: https://github.com/usebruno/bruno/blob/main/readme.md Execute an API collection using the Bruno CLI Docker image by mounting the current directory. This allows running collections in isolated environments. ```sh docker run -v $(pwd):/bruno usebruno/cli run ``` -------------------------------- ### Build Bruno CLI Alpine Docker Image Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/alpine/README.md Builds the Docker image for the Bruno CLI using the Alpine base. You can specify a Bruno CLI version using the BRUNO_VERSION build argument. ```bash docker build -t usebruno/cli:alpine ./images/alpine ``` ```bash docker build \ --build-arg BRUNO_VERSION=3.3.0 \ -t usebruno/cli:3.3.0-alpine \ ./images/alpine ``` -------------------------------- ### Minimal Docker Compose for Bruno Collection Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md A basic docker-compose.yml to run a Bruno collection. Mounts the collection and reports directories, and specifies output formats. ```yaml services: bruno-cli: image: usebruno/cli:latest container_name: bruno-cli-runner volumes: - /path/to/collection:/bruno - /path/to/reports:/reports command: run . -r --env ci --reporter-json /reports/results.json --reporter-junit /reports/results.xml --reporter-html /reports/results.html ``` -------------------------------- ### Run Bruno Collection from Current Directory Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Executes all requests in the Bruno collection located in the current directory. Mounts the current directory to `/bruno` inside the container. ```bash # run every request in the Bruno collection (current dir) docker run -v $(pwd):/bruno usebruno/cli run ``` ```bash # run a specific subfolder (group of requests) within that collection docker run -v $(pwd):/bruno usebruno/cli run ./api-tests ``` ```bash # run a single .bru request file from that collection docker run -v $(pwd):/bruno usebruno/cli run ./api-tests/login.bru ``` ```bash # write a JUnit XML report (lands in the current directory because of the bind mount) docker run -v $(pwd):/bruno usebruno/cli run --reporter-junit results.xml ``` -------------------------------- ### Run Bruno Collection from Arbitrary Path Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Runs Bruno collections or specific files from a path different from the current directory. The specified path is mounted to `/bruno`. ```bash # run every request in a collection at an arbitrary path docker run -v /path/to/your/collection:/bruno usebruno/cli run ``` ```bash # run a single .bru file from a collection at an arbitrary path docker run -v /path/to/your/collection:/bruno usebruno/cli run ./auth/login.bru ``` -------------------------------- ### Run Playwright Tests with Trace Recording Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Execute Playwright tests with trace recording enabled to capture detailed execution information. ```bash npx playwright test --trace on ``` -------------------------------- ### Publish to Npm Registry Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-common/readme.md Command to publish the package to the Npm registry with public access. ```bash npm publish --access=public ``` -------------------------------- ### Windows'ta Chocolatey ile Bruno Kurulumu Source: https://github.com/usebruno/bruno/blob/main/docs/readme/readme_tr.md Windows kullanıcıları için Chocolatey paket yöneticisini kullanarak Bruno'yu yüklemek için kullanılır. Bu, Windows ortamlarında Bruno'yu kurmanın hızlı bir yoludur. ```sh # Chocolatey aracılığıyla Windows'ta choco install bruno ``` -------------------------------- ### Test HTTPS Server with .NET WebClient (Windows) Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Use .NET's WebClient in PowerShell to download content from the HTTPS server, testing the connection and certificate validation. ```powershell $client = New-Object System.Net.WebClient $client.DownloadString("https://localhost:8090") ``` -------------------------------- ### Run Requests with Custom CA Certificates Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Include custom CA certificates for validating peer certificates when making requests. These are used in addition to the default truststore. ```bash bru run folder --cacert myCustomCA.pem ``` -------------------------------- ### Run Collection with Pinned Version Debian Docker Image Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/images/debian/README.md Runs a Bruno collection using a Debian slim Docker image pinned to a specific version. Mounts the current directory to /bruno inside the container. ```bash docker run -v $(pwd):/bruno usebruno/cli:3.3.0-debian run ``` -------------------------------- ### GitHub Actions Workflow for Bruno Tests Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md This snippet shows a GitHub Actions workflow that checks out code, runs Bruno collections using Docker, and publishes the test report. ```yaml jobs: api-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Run Bruno collection run: | docker run --rm \ -v ${{ github.workspace }}:/bruno \ usebruno/cli:latest run --output results.xml --format junit - name: Publish Test Report uses: dorny/test-reporter@v3 if: success() || failure() with: name: Bruno Test Results path: ${{github.workspace}}/results.xml reporter: java-junit ``` -------------------------------- ### Test HTTPS Server with Curl (Unix/Linux/macOS) Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Use curl to make a request to the running HTTPS server and verify the response. ```bash curl https://localhost:8090 ``` -------------------------------- ### Create and Execute HTTP Request in Playwright Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Demonstrates creating a collection, then a new HTTP request within it, and executing the request. ```typescript import { test, expect } from '../../playwright'; test('should create and execute HTTP request', async ({ page, createTmpDir }) => { const testDir = await createTmpDir('request-test'); // Create collection await page.getByLabel('Create Collection').click(); await page.getByLabel('Name').fill('Request Test'); await page.getByLabel('Location').fill(testDir); await page.getByRole('button', { name: 'Create' }).click(); // Create request await page.locator('#create-new-tab').getByRole('img').click(); await page.getByPlaceholder('Request Name').fill('Test Request'); await page.locator('#new-request-url .CodeMirror').click(); await page.locator('textarea').fill('http://localhost:8081/ping'); await page.getByRole('button', { name: 'Create' }).click(); // Execute request await page.getByTestId('send-arrow-icon').click(); // Verify response await expect(page.getByRole('main')).toContainText('200 OK'); }); ``` -------------------------------- ### Environment Parsing and Stringifying Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Functions for parsing and stringifying Bruno environment files. ```APIDOC ## parseEnvironment ### Description Parses environment file content. ### Signature `parseEnvironment(content, options = { format: 'bru' })` ### Parameters - **content** (string) - The content of the environment file. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The format of the environment file. Currently supports 'bru'. ## stringifyEnvironment ### Description Converts an environment object to file content. ### Signature `stringifyEnvironment(envObj, options = { format: 'bru' })` ### Parameters - **envObj** (object) - The environment object to stringify. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The desired output format. Currently supports 'bru'. ``` -------------------------------- ### Playwright Test with Temporary Data Fixture Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Demonstrates using the `createTmpDir` fixture to generate temporary directories for test data within a Playwright test. ```typescript import { test, expect } from '../../playwright'; test('Test with temporary data', async ({ page, createTmpDir }) => { // Create temporary directory for test data const testDir = await createTmpDir('test-collection'); // Test steps await page.getByLabel('Create Collection').click(); await page.getByLabel('Name').fill('test-collection'); await page.getByLabel('Location').fill(testDir); // Assertions await expect(page.getByText('test-collection')).toBeVisible(); }); ``` -------------------------------- ### Run All Playwright E2E Tests Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Execute all end-to-end tests defined in the project using the provided npm script. ```bash npm run test:e2e ``` -------------------------------- ### Run Bruno CLI in Docker Compose Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-tests/reports/README.md Execute the Bruno CLI within a Docker container to generate test reports. This command mounts the current directory to the container's report path. ```bash cd packages/bruno-tests docker compose run bruno-cli ``` -------------------------------- ### Run Requests with Custom CA and Ignore Default Truststore Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Validate peer certificates using only the provided custom CA certificates, disabling the system's default truststore. ```bash bru run request.bru --cacert myCustomCA.pem --ignore-truststore ``` -------------------------------- ### Folder Parsing and Stringifying Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Functions for parsing and stringifying Bruno folder files. ```APIDOC ## parseFolder ### Description Parses folder file content. ### Signature `parseFolder(content, options = { format: 'bru' })` ### Parameters - **content** (string) - The content of the folder file. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The format of the folder file. Currently supports 'bru'. ## stringifyFolder ### Description Converts a folder object to file content. ### Signature `stringifyFolder(folderObj, options = { format: 'bru' })` ### Parameters - **folderObj** (object) - The folder object to stringify. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The desired output format. Currently supports 'bru'. ``` -------------------------------- ### Run Specific Playwright Test File Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Execute a single Playwright test file by specifying its path using the `npx playwright test` command. ```bash npx playwright test e2e-tests/001-sanity-tests/001-home-screen.spec.ts ``` -------------------------------- ### Import React Hooks Directly Source: https://github.com/usebruno/bruno/blob/main/CODING_STANDARDS.md Always import React hooks directly instead of using namespace access. This applies to hooks like useCallback, useMemo, and useState. ```javascript import { useCallback, useMemo, useState } from "react"; ``` ```javascript import * as React from "react"; // Avoid this pattern: React.useCallback(...) React.useMemo(...) React.useState(...) ``` -------------------------------- ### Run Workspace Tests Source: https://github.com/usebruno/bruno/blob/main/contributing.md Executes tests for specific packages (workspaces) within the Bruno project. This allows for targeted testing of individual components. ```bash # run bruno-schema tests npm run test --workspace=packages/bruno-schema # run bruno-query tests npm run test --workspace=packages/bruno-query # run bruno-common tests npm run test --workspace=packages/bruno-common # run bruno-converters tests npm run test --workspace=packages/bruno-converters # run bruno-app tests npm run test --workspace=packages/bruno-app # run bruno-electron tests npm run test --workspace=packages/bruno-electron # run bruno-lang tests npm run test --workspace=packages/bruno-lang # run bruno-toml tests npm run test --workspace=packages/bruno-toml ``` ```bash # run tests over all workspaces npm test --workspaces --if-present ``` -------------------------------- ### Run Requests in a Subfolder Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/readme.md Execute all API requests contained within a specified subfolder of your collection. ```bash bru run folder ``` -------------------------------- ### GitLab CI Configuration for Bruno Tests Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md This GitLab CI configuration uses the Bruno CLI Docker image to run collections and generate JUnit reports. ```yaml api-tests: image: usebruno/cli:latest script: - bru run --output results.xml --format junit artifacts: reports: junit: results.xml ``` -------------------------------- ### Generate Playwright Test with Codegen Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Use the npm script to generate Playwright tests by recording UI interactions. Specify a test name or let the script prompt for input. ```bash npm run test:codegen my-new-test ``` ```bash npm run test:codegen ``` -------------------------------- ### Test HTTPS Server with PowerShell Invoke-WebRequest (Windows) Source: https://github.com/usebruno/bruno/blob/main/tests/ssl/custom-ca-certs/server/readme.md Use PowerShell's Invoke-WebRequest cmdlet to make a request to the running HTTPS server. ```powershell Invoke-WebRequest -Uri https://localhost:8090 ``` -------------------------------- ### Parse and Stringify Bruno Files Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Import and use functions to parse content from .bru files into JavaScript objects and stringify JavaScript objects back into .bru format. The 'parseRequest' function can also accept a 'format' option for future extensibility. ```javascript const { parseRequest, stringifyRequest, parseCollection, stringifyCollection, parseEnvironment, stringifyEnvironment, parseDotEnv } = require('@usebruno/filestore'); // Parse a .bru request file const requestData = parseRequest(bruContent); // Stringify request data to .bru format const bruContent = stringifyRequest(requestData); // Example with future format support (not yet implemented) const requestData = parseRequest(yamlContent, { format: 'yaml' }); ``` -------------------------------- ### Run Playwright Tests with Specific Project Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Execute Playwright tests targeting a specific project configuration, identified by the project name. ```bash npx playwright test --project="Bruno Electron App" ``` -------------------------------- ### Use Stable Selectors and Wait for Network Idle Source: https://github.com/usebruno/bruno/blob/main/docs/playwright-testing-guide.md Employ stable selectors like `getByTestId` to avoid flaky tests. `page.waitForLoadState('networkidle')` can be used to wait until there are no more than 0 network connections for at least 500 ms. ```typescript await page.getByTestId('stable-id').click(); ``` ```typescript await page.waitForLoadState('networkidle'); ``` -------------------------------- ### .env File Parsing Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Function for parsing .env file content. ```APIDOC ## parseDotEnv ### Description Parses .env file content. ### Signature `parseDotEnv(content)` ### Parameters - **content** (string) - The content of the .env file. ``` -------------------------------- ### Run Bruno Collection with Auto-Cleanup Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-cli/docker/README.md Executes Bruno commands within a Docker container and automatically removes the container upon completion using the `--rm` flag. This is useful for CI environments. ```bash docker run --rm -v $(pwd):/bruno usebruno/cli run ``` -------------------------------- ### Request Parsing and Stringifying Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Functions for parsing and stringifying Bruno request files. ```APIDOC ## parseRequest ### Description Parses request file content. ### Signature `parseRequest(content, options = { format: 'bru' })` ### Parameters - **content** (string) - The content of the request file. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The format of the request file. Currently supports 'bru'. ## stringifyRequest ### Description Converts a request object to file content. ### Signature `stringifyRequest(requestObj, options = { format: 'bru' })` ### Parameters - **requestObj** (object) - The request object to stringify. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The desired output format. Currently supports 'bru'. ``` -------------------------------- ### Collection Parsing and Stringifying Source: https://github.com/usebruno/bruno/blob/main/packages/bruno-filestore/README.md Functions for parsing and stringifying Bruno collection files. ```APIDOC ## parseCollection ### Description Parses collection file content. ### Signature `parseCollection(content, options = { format: 'bru' })` ### Parameters - **content** (string) - The content of the collection file. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The format of the collection file. Currently supports 'bru'. ## stringifyCollection ### Description Converts a collection object to file content. ### Signature `stringifyCollection(collectionObj, options = { format: 'bru' })` ### Parameters - **collectionObj** (object) - The collection object to stringify. - **options** (object) - Optional. An object with a `format` property. Defaults to 'bru'. - **format** (string) - The desired output format. Currently supports 'bru'. ```